Copy link to clipboard
Copied
to add Rectangle i using:
var oRec= oDocument.rectangles.add();
But Can i setting this Rectangle to a parallelogram shape?
or
How can add a parallelogram shape by Script?
HI,
Would setting the shear angle get you the result you want?
oRec.shearAngle = 45;
hope this helps
Malcolm
Copy link to clipboard
Copied
HI,
Would setting the shear angle get you the result you want?
oRec.shearAngle = 45;
hope this helps
Malcolm
Copy link to clipboard
Copied
Hi,
Setting shear angle is certainly a good way to go given that you would be able to compute the angle so the final shape has the expected dimensions.
Another solution would be to set you own geometry playing with path and pathPoints Array but then you would loose editability regarding to shear angle property.
Copy link to clipboard
Copied
Hi Loic,
good point. One could work with the entirePath array of an added polygon or rectangle.
Or one could move two path points of an added rectangle.
Also possible:
Combine the two ways, the one with the shearAngle and building a new polygon with entirePath array.
Example:
var doc = app.documents[0];
var rect = doc.rectangles.add({geometricBounds : [0,0,100,100] ,fillColor : doc.colors.itemByName("Magenta") });
rect.shearAngle = 10;
var polygon = doc.polygons.add({fillColor : doc.colors.itemByName("Yellow")});
polygon.paths[0].entirePath = rect.paths[0].entirePath;
Rectangle and polygon are two distinct objects. And it's not only the fill color.
The rectangle is transformed, the polygon is not transformed:
Depending on what you want you could remove the rectangle.
Regards,
Uwe
Copy link to clipboard
Copied
You'll see the difference of the two construction methods more easily if you fill the objects with the same image.
In the example below I set the value for shearAngle to 45 so that this effect is better visible:
Regards,
Uwe