Jump to content
Developer Wiki and Function Reference Links ×

Can a script change viewport class/layer visibilities?

Recommended Posts

@MarcelP102 Good catch!  Since Saved Views are technically stored as Script resources, my script filters out any script outside of the default location of Saved Views in the Resource Manager, named "Saved Views" in the English version.


The good news is that this is a really simple fix that you can do.


Vectorworks has a built in way to be able to localize plug-ins without getting to the source code in cases like these where something needs to be coded in using strings.


If you go to the Plug-in Manager, find my Saved Views to Viewports plug-in in the Third-party Plug-ins tab and click the Customize button, you should get a dialog box to pop up.  The third tab should be named Strings.  Double click on Resource ID 5000, labeled Misc Strings.  From here, the one you are looking for is Resource ID 5006, which is likely set to "Saved Views".  Double-click this and type in the name of the folder in the Resource Manager where Saved Views are stored.  Then my plug-in should be able to find your Saved View.


Consequently, all of my scripts can be localized in this way if you would prefer them to be in your native language.  For this particular one, the only strings you shouldn't change are 5000 and 5001, as they're the file paths to the checkmark and blank icons needed for the list browser, but all of the rest of them are free to be changed.


Please let me know if you need any further help with this.  It's a feature I really like and appreciate but can be on the clunky side.

  • Like 3
Link to comment
  • 3 weeks later...



I have incorporated some requests from @line-weight to the Saved Views to Viewports command.  These changes include:

  • Patched bug when creating viewports on sheet that is currently active not updating Viewport properly
  • Added Viewport Scale to List Browser.  If empty, Viewport Settings will populate with currently active layer scale
  • Allows for selecting multiple rows of List Browser.  Viewport Settings dialog will show limited fields, just Sheet Layer and Viewport Scale
  • Added Generate Name from Saved View Name button to the main List Browser

I tested this in VW2019 and VW2021.  Please let me know if there are any troubles.


I've never tried it, but I assume that replacing an existing plug-in with this file will wipe out any localization that's been done to the plug-in (such as the name of the Saved Views folder), so be prepared to redo any localization that has been done.

Saved Views to Viewports.vsm

  • Like 1
Link to comment
  • 2 weeks later...

@Jesse Cogswell sorry for the delay but I've now had a chance to test this out (in VW2021) and as far as I can see all is working perfectly . Thank you for the additional changes - the ability to bulk-copy from multiple saved views will be a massive time-saver for me.


It takes a while to do its stuff (about 30 seconds when I tested it doing 15 saved views/viewports) but my guess is that this is Vectorworks itself, creating the viewports in what is quite a large model, rather than a slowness in the script.


Thanks again for this.

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.

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