Copy link to clipboard
Copied
I need to know two things:
1) I want my drawn rectangle to be the same size as the drawing area.
2) I want the horizontal line to be as long as the width of the canvas. How do I do that?
Thanks
Copy link to clipboard
Copied
Hello,
There are many ways to achieve
I want my drawn rectangle to be the same size as the drawing area.
1. Script - Here is the sample script, make sure your item is selected before running this
function getABbounds () {
var activeAB = app.activeDocument.artboards[0];
var abBounds = activeAB.artboardRect; // get bounds [left, top, right, bottom]
var ableft = abBounds[0];
var abtop = abBounds[1];
var abright = abBounds[2];
var abbottom = abBounds[3]
var abwidth = abright-ableft;
var abheight = abtop-abbottom;
return AB = {left:ableft, top:abtop, width:abwidth, height:abheight};
}
function main()
{
var ABprops = getABbounds (); // get top, left, width & height
var sel = app.selection[0];
sel.width = ABprops.width;
sel.height = ABprops.height;
sel.top = ABprops.top;
sel.left = ABprops.left;
sel.selected = false;
}
main();
2. Manually - Steps below
3. Simply drag and drop the rectangle to the artboard bounds.
Same goes for the line, script will be little different for the horizontal line.
Let us know if this helps you.
Copy link to clipboard
Copied
Hello,
my rectangle has the same coordinates and same width and height as my artboard.
But my rectangle is still in another place than my artboard.
Why is that happen?
See picture.
Copy link to clipboard
Copied
user,
If you mean what your words seem to imply (Workspace), you can select the rectangle, and then with the centre Reference Point selected in the Transform palette set the following values in pt/px: X = 298, Y = 420, W = 16384, H = 16384 (you cannot ask for more). If you wish to have a separate horizontal line, you can Direct Select one of the horizontal segments, then copy it to the front and move it as desired.
If you mean what is normally meant, you can do what charu said.
More specifically, purely manually, you can ClickDrag with the Rectangle Tool between opposite corners of the Artboard; Smart Guides are your friends, telling when you are within snapping distance from them.
Or, using an existing rectangle, you can ClickDrag one corner to the corresponding Artboard and then ClickDrag the opposite corner in place with the Free Transform Tool (you can also do it more laboriously with the Scale Tool).
Concerning the horizontal line, in an extension of the latter interpretation, where you want it to have the full width of the Workspace, you can Direct Select one of the horizontal segments of the rectangle, then copy it to the front and set the W value to 16384 pt/px, and move it if desired.