Advertisement
ylSiew

Untitled

May 17th, 2015
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. from win32com.client import Dispatch, VARIANT
  2. from pythoncom import VT_VARIANT
  3. import collections
  4.  
  5.  
  6. appObj = Dispatch("Illustrator.Application")  
  7. docObj = appObj.Documents.Add()
  8.  
  9. def variant(data):
  10.     return VARIANT(VT_VARIANT, data)
  11.  
  12. def vararr(*data):
  13.     if (  len(data) == 1 and
  14.           isinstance(data, collections.Iterable) ):
  15.         data = data[0]
  16.     return map(variant, data)
  17.  
  18. pathItem = docObj.PathItems.Add()
  19. pathItem.SetEntirePath( vararr( [0.0,0.0], [20.0,20.0] )  )
  20.  
  21. #or you can have a iterable of iterables
  22. pathItem = docObj.PathItems.Add()
  23. pathItem.SetEntirePath( vararr( [[30.0,10.0], [60.0,60.0]] )  )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement