Jump to content
Martin Crawford

Counting Plug-In Object

Recommended Posts

What is the best way to count the number of plug-in objects in a drawing.

 

I tired the following, however it always returns 1

 

        crit           = "N='Create Processor'"
        processorCount = int(vs.Count(crit))
 

Thanks

 

Share this post


Link to post

The criteria builder in the VectorScript editor can be useful for this. 
 

To count a specific plug-in, use PON=‘Plug-in Name’. To count all plug-ins, use T=PLUGINOBJECT. 

Share this post


Link to post

Joshua is correct. As always. But perhaps a little more detail will help.

 

The =N returns the Name of the object. This is the name that you can type into the OIP. I think it also returns the "source" object for PIOs and Symbols. VW is very picky about names and only one object in a file can have a specific name. You can't have a class named Door in a file that has a Door object in it. 

 

Your script retuned 1 because there is only 1 object with that name in the file. It is the definition of the PIO.

 

PON to return the plug-in name or S to return the symbol name are usually better options for criteria.

 

  • Like 1

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.

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.


 

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