Jump to content

Wild Card for string match layer name, criteria in Worksheet Formula


Recommended Posts

In my Worksheet Database criteria Formula:

 I want to use a partial match on layer name -

to allow for future change to the name, according to each file's needs

using VectorWorks Designer 2017

The following is  not finished, as I'd like to filter for any layer name, containing the word "Demolition"


=IF((((L='Demolition') & (C='(Spaces-Existing-Non Living Enclosed')))=TRUE, space.area, 0)

New at vectorscript, Thanks to anyone with this knowledge


Link to comment

I don't think there is a way to use a substring in a layer name or a classname as criteria for a worksheet.


If you want to get fancy, you could write a Vectorscript that would present a dialog box of the layers allow a multiple selection and then have the script create the criteria for the database.  The hardest part will be the dialog box. There was another thread here recently that was talking about a selectable list of either layers or classes that would be a good place to start.


You can put multiple layers into a criteria is you edit the criteria manually.  Something like:


=DATABASE((L='Layer-3') | (L='Design Layer-2'))


The vertical bar indicates a logical OR so it will return things on Layer-3 OR Design Layer-2


Other fields like Name and (I think) Field values will allow you to use a wildcard of *


So another possibility is to write a script that will store the current layer into a custom Record.Field and then use that field with wildcards as the database criteria.  The problem is that if you move an object between layers (or add more objects) you will have to remember to rerun the script or manually update the field.


Wildcards for Layer and Class names would be a good wishlist item.

Link to comment



It does work for Classes.


I wonder if that's a bug.  I do this exact trick often with classes and it works great.


=DATABASE((C='Demolition*'))  will return everything in the class Demolition-Man, Demolition-Derby ,etc.


Never knew it didn't work for Layers.





Link to comment

Interesting. I only tried it for Layers and then looked at the options for classes and did not see a CONTAINS option in the criteria builder and assumed it would not work for Classes either.


I doubt it is a bug on Layers. Layers live in an entirely different List inside Vectorworks. Ever noticed that you can have a Layer with the same name as a class or any other object.


Like I said before, It would be a good wish to have Wildcard for Layer names be acceptable criteria.

Link to comment

There's no GUI for using wildcards, you have to do it the old fashioned way.  I always thought that it worked on everything (I've done it with names of hatches fills).  I just never tried Layers.


But you're right.  I never thought of Layer names like that.  VW will let you name a Layer as "Door", but doing that with a Class name is a real bad idea.


I think we could start a nice wish list database criteria improvements :-)



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