[Pythonmac-SIG] Making py-appscript classes for Adobe Illustrator

grzessnik at interia.pl grzessnik at interia.pl
Thu Jan 17 12:57:48 CET 2008


Hi.
I'm py-appscript newbie and I'm trying to write a script for Adobe Illustrator.
My idea is:
make a class f.e. Object, with some methods (move(), rotate(), ...)
make a subclass f.e. Rectangle and in this class I wan't to initialize new rectangles in my document.

I have problems with reference to objects, I've made.

my script is:

class Obiekt:

	global kreator #this is variable, that is used to creates new objects
	kreator = mojDokument
	
	def __init__(self, kreator):
#		self.kreator = kreator
		pass
		
	def rotation(self, angle):
		rot = kreator.get_rotation_matrix(angle=angle)
#		self.obiekt.transform(using = rot)
	

class Rectangle(Obiekt):
	def __init__(self, kreator, wspolrzedne=[0,0,100,100], nazwa='figura'):
		self.obiekt = kreator.make(new = k.rectangle,
			with_properties = {k.name: nazwa, k.bounds: wspolrzedne})
		self.name = nazwa

rect1 = Rectangle(mojDokument, [200,200, 100, 100])
rect2 = Rectangle(mojDokument, [100,200, 200, 100], 'prostokat02')

both objects reference to the same path item
app(u'/Applications/Adobe Illustrator CS2/Adobe Illustrator.app').documents[1].layers[1].path_items[1]
app(u'/Applications/Adobe Illustrator CS2/Adobe Illustrator.app').documents[1].layers[1].path_items[1] 

I suppose, that is because, new objects are always numbered at 1.
Can I refere to my created objects via names (self.name)?

Thanks for help.

Regards
Grzessnik


----------------------------------------------------------------------
Sprawdz, ktore komorki sa najmodniejsze!
Kliknij >>> http://link.interia.pl/f1cd4



More information about the Pythonmac-SIG mailing list