Illustrator - create line or path

Hi all - I have been working on this all morning but can’t figure it out. I basically want to just make a simple, two-point line in Illustrator. I can make a rectangle, ellipse and polygon (star or other multi-sided shape), but I don’t know the syntax to make a line.

If it’s as simple as creating two points that are connected, how do you do that?

I would also like to know if it’s possible to create more complex paths, with lines that curve and what not. Anyone know the syntax for something like this? I figure it involves specifying a bunch of point positions, with curve in/out properties or something similar.

Thanks,
Dave

You want the “entire path” command to create a line. So it can be simple like:


		make path item at layer "Layer 1" with properties {entire path:{{100, 200}, {300, 400}}, stroke width:2, name:"Path 1"}

OR complex, like:


		make path item at layer "Layer 1" with properties {entire path:{{100, 100}, {150, 300}, {200, 200}, {275, 400}, {350, 300}, {500, 600}}, stroke width:2, name:"Path 2"}

From the dictionary - “entire path {list of path point info} – all the path item’s path points”
Have fun! :slight_smile:

Awesome - that’s exactly what I was looking for. Thank you!

Not sure anyone will still be looking at this post, but I was wondering:

While this is an excellent and very fast way to draw complex paths in Illustrator, the path created does not respond to AppleScript in the standard fashion. For instance, I cannot get the position of path point 2 of path item 1. I also cannot get the geometric bounds of path points, left directions, right directions or anchors…

Does anyone have some insight on how to work with these complex paths once they are created via the entire path property?

Hi Brad

Not sure what your wanting to do but here’s just a few ways of getting some info back about a illustrator path
remember that individual points aren’t the same as the entire path so you won’t be able to get the geometric bounds but you can still get the points coordinates.
Hope this helps.

tell application "Adobe Illustrator"
	tell document 1
		make path item at layer "Layer 1" with properties {entire path:{{100, 100}, {150, 300}, {200, 200}, {275, 400}, {350, 300}, {500, 600}}, stroke width:2, name:"Path 2"}
		get geometric bounds of path item 1 --> get bounds of the whole path
		set selected of path point 2 of path item 1 to anchor selected --> get individual anchors
		get left direction of path point 2 of path item 1 --> get left direction
		get anchor of path point 3 of path item 1 --> coordinates of path point 3's anchor
	end tell
end tell

Cheers