Jump to content
Martin Crawford

Reset Object & Active Layer

Recommended Posts

Is there a way to reset some custom plug-ins, and when done return to the layer that called the refresh?

 

I have two custom plug-in, the first is a "data circuit", the second is a "data note" with info from the data circuit. From a Sheet layer I want to use a menu command to run "Refresh Notes", that will refresh the "data circuit", then refresh the "data note" and when all done I would like to stay on the Sheet Layer.

 

Currently when I do the refresh on the "data circuit" it changes to the Design layer and so far nothing I have done can get it back to the Sheet Layer.

 

I suspect is has to do with the ForEachObject not working like I think it should.

 

Any thoughts on how to move forward?

 

Thanks

 

Martin

Share this post


Link to post

You can store the name of the active layer and then call vs.Layer( storedLayerName ) at the end of your script — however, your refresh script shouldn't be changing your view.

First determine if your reset script is changing the view (it should basically be vs.ForEachObject( vs.ResetObject, "PON='{plug-in_name}'") ) or if your data circuit object is unnecessarily changing the view.

Share this post


Link to post

My code is super simple. When the routine completes, it always up on the Design Layer.

 

 

layerName = vs.GetLName(vs.ActLayer())

 

vs.ForEachObject( vs.ResetObject, "PON='Create Data'" )

vs.ForEachObject( vs.ResetObject, "PON='Create Circuit'" )

vs.ForEachObject( vs.ResetObject, "PON='Create Notes'" )

vs.ForEachObject( vs.ResetObject, "PON='Create Scehdule'" )

 

vs.Layer(layerName)

 

 

 

I do change layers inside of Create Data and Create Circuit and it looks like whichever of those two runs last determines what layer it is on. Create Note and Create Schedule are on Sheet Layers and neither change layers.

 

What does not make sense is why my Vs.Layer at the end does not change back to the sheet layer.

 

Martin

 

 

 

 

Share this post


Link to post

Script-based plug-ins run linearly, so the resets actually happen after the script completes. You should look at your Create scripts. There's no reason to switch the active layer — you can send any object to any layer without making it active, and if you do change the view, you should always restore it.

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