Jump to content
Sign in to follow this  
Patrick Winkler

Batch Converting - Open, Change and Close Files with python

Recommended Posts


I'm working on a script which changes the units off all VWX files in a folder.

The Problem is that the file opens to late when the script is already finished. I also tried it with the sleep () command.

Is there a way to open a file and make it active within a function?

def main ():    

   # Get File
   succes, path = vs.GetFileN('', None, None)

   # Open File

   if get_OS_Code() == OS_WIN:
       # Windows command
       os.system('start' + path )
       # Mac command
       os.system('open  ' + path ) 

   # Set Units 
   Millimeters =     7
   Centimeters =   8
   Meters = 9
   Kilometers = 10

   vs.Units (Centimeters)

   # Save the File
   vs.DoMenuTextByName("Save", 0)

   # Close the File
   vs.DoMenuTextByName("Close", 0)

Share this post

Link to post

If you're on the Mac, use AppleScript to handle opening and saving. VW provides an apple script command to run a python script.


Share this post

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  


7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114


© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

  • Create New...