Jump to content
Julian Carr

Create New Layer Event

Recommended Posts

Does anyone know if it is possible to detect an event if a design layer or sheet layer is duplicated?

 

Thanks,

 

Julian

Share this post


Link to post

There is no tool for finding duplicated layers that I know of however duplicated design and sheet layers get a "-2" after them by default as they can't have the same name.

Share this post


Link to post

Thanks for your reply. To elaborate, I have an event enabled object on a layer (sheet or design). The object has a hidden parameter that contains a unique ID generated using CreateUUID. This name is also given to a locus within the object's profile group. When the layer is duplicated, the locus loses its name and the unique ID field is no longer unique. This can be problematic down the track.

 

If the object could detect its creation, it could rectify this and generate a new unique ID. Thanks for any ideas.

Share this post


Link to post

You can try to look for the state kObjectCreated (13), not sure if Vectorscript will get this notification or not.

It was added for 2012.

 

The problem is that you you are using the name field of the locus.

If you attach a hidden record to the loci then duplication would be less problematic.

The other issue is that the locus is a dumb object so it can't react to a change.

 

I would try changing your logic slightly.

Store the UUID in a hidden field of the PIO AND name the PIO with the UUID. With a PIO you can Hide and disable the object name so the user can't change it.

Attach a record to the the loci with the UUID as a record field. (You can also name the Loci with the UUID+"Loci" to make it easier to find but you can't keep the user form changing it.)

When you need to find the loci you can do a quick name search for the UUID+Loci, or do a more complex search for the record and filed value if it fails.

 

When the user duplicates the PIO, the object name will change but your hidden UUID will stay the same. You will know the PIO has been duplicated when the UUID does not match the name. Generate a new UUID and rename the object.

The duplicated Loci will still have the record attached with the old UUID but you can find it and update it with the new UUID.  (For VS this portion of the workflow will fail with duplicate array because could have multiple loci with the same UUID in the record field but you can check the parent to see what the new UUID should be.)

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