[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(DTPtechNote:976) [AS-Illustrator CS] 線分の作成

なんていうか、make new path itemって成功するのに、パスは作成されないんだね。

tell application "Illustrator CS"
	set my_pt to 2.834644
	set line_width to 0.1 --線幅
	set dash_x to 1.69 --破線の実線長さ
	set dash_y to 0.56 --破線の空白長さ
	set line_length to 317 * my_pt --線の長さ
	set line_angle to 157 --線の角度
	set line_color to {class:CMYK color info, cyan:0.0, magenta:0.0, yellow:0.0, black:100.0} --スミ100%
	set doc_h to height of document 1 --ドキュメントの高さ
	set doc_w to width of document 1 --ドキュメントの幅
	set dup_move to 6.66 --移動量
	set dup_angle to 23 --複製角度
	set dup_angle_r to dup_angle * pi / 180 --ラジアン角度
	set dup_mv_Y to dup_move * (do shell script "ruby -e 'print Math.sin(" & dup_angle_r & ")'")
	set dup_mv_X to dup_move * (do shell script "ruby -e 'print Math.cos(" & dup_angle_r & ")'")
	--set dup_mv_Y to 2.602269315739 --移動量Y ←計算時間がもったいないなら、こちらを使う
	--set dup_mv_X to 6.130562323993 --移動量X ←計算時間がもったいないなら、こちらを使う
	set my_pathitem to make new polygon at beginning of document 1 ¬
		with properties {sides:4}
	tell my_pathitem
		set width to line_length
		set height to 0
		set stroke width to line_width
		set stroke dashes to {dash_x, dash_y}
		set stroke color to line_color
		set position to {(doc_w - line_length) / 2, doc_h / 2}
	end tell
	rotate my_pathitem angle line_angle about center
	repeat with i from 1 to dup_cnt
		set tmp_obj to duplicate my_pathitem
		translate tmp_obj delta x dup_mv_X delta y dup_mv_Y
	end repeat
end tell