Changing path/anchor item property in Illustrator CS2

Hi together,
I have a rounded line (path item object) with two anchors. This line looks like a quarter of a circle, hence it is to describe graphically an enclosed angle. I would like to re-set the x,y property of the second anchor to new values and let the object have new drawn. Any idea is more then welcome. Here is so far what I got:


		--#select the first path item in the layer
		set myPathRef to item 1 of selection	
		set tempX to (count every path point of myPathRef) --ok, only two path points
		
		--the 1st anchor
		set anchorRef1 to (anchor of path point 1 of myPathRef)	--list of 2 item values
		set {anchorX1, anchorY1} to anchorRef1
		
		--the 2nd anchor
		set anchorRef2 to (anchor of path point 2 of myPathRef)	--list of 2 item values
		set {anchorX2, anchorY2} to anchorRef2

		--#change the anchor values 
		set anchorX2 to 200.0 --test value
		set anchorY2 to 400.0 --test value
		
		--now, I want to redraw my path item with the changed values for anchorX2 and anchorY2
		--any idea appreciated :)
		--so far I tried:
		--set properties of (anchor of path point 1 of myPathRef) to {anchor:{113.0, 431.0}}
		--set anchorRef2 to (anchor of path point 2 of myPathRef)
		--set properties of anchorRef2 to {anchor:{anchorX2, anchorY2}}

Thank you a lot in advance. Best regards from rainy Germany ;(
Erden

Erden,
Not sure if this does what you’re looking for, but it does move the path points to new locations. The resulting curvature of the line is another issue. :wink:


tell application "Illustrator CS"
	tell document 1
		--#select the first path item in the layer
		set myPathRef to item 1 of selection
		set tempX to (count every path point of myPathRef) --ok, only two path points
		
		--the 1st anchor
		set anchorRef1 to (anchor of path point 1 of myPathRef) --list of 2 item values
		set {anchorX1, anchorY1} to anchorRef1
		
		--the 2nd anchor
		set anchorRef2 to (anchor of path point 2 of myPathRef) --list of 2 item values
		set {anchorX2, anchorY2} to anchorRef2
		
		--#change the anchor values 
		set anchorX2 to 200.0 --test value
		set anchorY2 to 400.0 --test value
		
		set properties of (path point 1 of myPathRef) to {anchor:{113.0, 431.0}}
		set properties of (path point 2 of myPathRef) to {anchor:{anchorX2, anchorY2}}
	end tell
end tell

Mark

Hi Mark,

thank you very much. I was quite close but the final syntax needed bit of polishing - thank you very much :slight_smile:

Cheers,
Erden

To avoid the curves you need to set the right and left anchors, and probably the corner type:

tell application "Illustrator CS"
	get item 1 of selection
		path item 1 of layer 1 of document 1
	count every path point of path item 1 of layer 1 of document 1
		3
	get anchor of path point 1 of path item 1 of layer 1 of document 1
		{321.9521484375, 609.76171875}
	get anchor of path point 2 of path item 1 of layer 1 of document 1
		{211.23828125, 541.90478515625}
	set properties of path point 1 of path item 1 of layer 1 of document 1 to {anchor:{113.0, 431.0}, right direction:{113.0, 431.0}, left direction:{113.0, 431.0}, point type:corner}
	set properties of path point 2 of path item 1 of layer 1 of document 1 to {anchor:{200.0, 400.0}, right direction:{200.0, 400.0}, left direction:{200.0, 400.0}, point type:corner}
end tell