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

(DTPtechNote:1750) Re: Illustratorのオブジェクト情報



のりかかった船というか、自分でも忘れないうちに

リンク情報にある『変形」と同じ値を返すルーチンです。

on get_henkei_of_link_info(thePlacedItem)
	tell application "Adobe Illustrator"
		set theClass to class of thePlacedItem
		if theClass is not placed item and theClass is not raster item then return 0
		set theMatrix to matrix of thePlacedItem
		set _a to mvalue_a of theMatrix
		set _b to mvalue_b of theMatrix
		set _c to mvalue_c of theMatrix
		set _d to mvalue_d of theMatrix
		set theRad to do javascript "Math.atan2(" & _b & "," & _a & ");"
		set tateRad to do javascript "Math.atan2(" & _d & "," & _c & ");"
		set tateRatio to do javascript "Math.cos(" & theRad - tateRad - 90 / 180 * pi & ");"
		set tateRatio to ((tateRatio * ((_c ^ 2 + _d ^ 2) ^ 0.5) + 5.0E-6) div 1.0E-5) * 1.0E-3
		set yokoRatio to (((_a ^ 2 + _b ^ 2) ^ 0.5 + 5.0E-6) div 1.0E-5) * 1.0E-3
		set theAngle to theRad * 180 / pi
		if theAngle < 0 then
			set theAngle to -((theRad * 180 / pi - 5.0E-4) div 1.0E-3) * 1.0E-3
		else
			set theAngle to -((theRad * 180 / pi + 5.0E-4) div 1.0E-3) * 1.0E-3
		end if
		return {yoko:yokoRatio, tate:tateRatio, kaiten:theAngle}
	end tell
end get_henkei_of_link_info

tell application "Adobe Illustrator"
	my get_henkei_of_link_info(item 1 of selection of document 1)
end tell