Jump to content
Developer Wiki and Function Reference Links Read more... ×
Andy Broomell

Script to work on visible layers only?

Recommended Posts

I have a couple custom scripts that I've collected over the years, many created by the fine folks on this forum.


A number of these scripts operate on "selected objects", but I've noticed that they also operate on selected objects on layers that are set to invisible (an odd concept, but that's what VW does). This sometimes produces unexpected results, so I'm wondering if there's a way to make the scripts operate on selected objects on visible, editable layers only?


For example, the script I currently have to hide selected objects looks like this:




What would I add to change the criteria? I should note that some of the scripts I'd like to modify are more complex, but this is a good starting point. Since I don't know Vectorscript at all, any help would be appreciated. Thanks!



Share this post

Link to post

There was a new call added a few years ago.


VSEL  for Visible Selection State. This only handles objects that are both visible (not in a hidden layer or class) AND selected.


Change your SEL above to VSEL and you should be good to go.


Other steps may be required for other scripts. Especially ones that use something like BLAH:=FSActLayer;





  • Like 1

Share this post

Link to post

Thanks Pat! Didn't see this till now somehow.


Does there happen to be a call for selected objects that are on layers that are both visible and currently editable? (Or if not, perhaps on the Active Layer only?)


I run into issues when I have Layer Options set to "Show/Snap" others: I can technically have objects on the non-active layer selected, but the OIP only tells me what I have selected on the active layer.


What happens is I don't realize that a script might be acting on objects that are on a visible (but not active or editable) layer since the OIP is not telling me I have them selected.


As an example... the lovely "Rotate Randomly" script that you wrote for me a while back (and that I use all the time) has occasionally left me parts of the entire venue rotated since there were objects selected on the non-active layer. Just trying to fool-proof against myself 🙂

Share this post

Link to post

Not really a criteria for what you want. Easiest way I know of to see the available criteria is to go to a worksheet and Insert:Criteria and look at the options in the first pull down menu.


In a script, you could use something like:




This should DeSelect everything not on the active layer.


For Manual use, make a script with a single line of:




Then run that script before you start a big selection process to run a script.

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


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.