Jump to content
Developer Wiki and Function Reference Links ×

Create New Document


Recommended Posts

If you are on a Mac you should be able to use an Applescript to open a new file from the template and then run the script to do the dwg import.

 

Vectorscript/Pythonscript are very document centric, so there is really no way to have them open a different VWX file.

 

It seems like you should be able to script importing of layers and classes like you can from the Organization Palette, but I can't find the right calls in the Function Reference. @JBenghiat Do you have a way to script importing layers and classes?

 

Do you have a single template file or different templates for different uses? If you have only one, then if you name it default.sta (and store it in the right place), it will automatically open when you open VW.

 

Or what about storing the import script as part of a template file. Then to get the script they have to open a new document from the Import Template and then run the script.

 

Ask again if you need more information.

 

Link to comment

Thanks for the tips, it's a shame about the lack of file manipulation functions - but not the end of the world. Putting the script in the template and running it from there is the approach I have gone with, just thought it would have been nice for the script to handle the file creation and saved a couple of clicks (lazy I know!)

 

One other question though - the script selects objects on an imported layer and copy & pastes them to a different layer. I want to paste it in the middle of the "page" as the template contains viewports targeted at this layer. When it was manual I'd just click in the middle and then paste. The closest I've got so far with scripting is

DoMenuTextByName('Fit To Window',0);
DoMenuTextByName('Paste',0);

and it works mostly but every now and then it pastes off centre. Is there a better way to do it?

 

 

Link to comment

The script equivalent to clicking in the middle would be MoveTo(0,0);

 

Another option would be to  Group the objects, get a handle to the group, get the center of the group, HMove the group by the negative of the center (i.e. back to 0,0), Change the layer, and ungroup.

 

The ones that are not centered probably have some object way out in space that you need to investigate and either move in closer or delete.

Link to comment

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.

Guest
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.

×
×
  • Create New...