Julian Carr Posted March 12, 2018 Share Posted March 12, 2018 Does anyone know if it is possible to detect an event if a design layer or sheet layer is duplicated? Thanks, Julian Quote Link to comment
Boh Posted March 12, 2018 Share Posted March 12, 2018 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. Quote Link to comment
Julian Carr Posted March 12, 2018 Author Share Posted March 12, 2018 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. Quote Link to comment
Vectorworks, Inc Employee klinzey Posted March 13, 2018 Vectorworks, Inc Employee Share Posted March 13, 2018 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.) Quote Link to comment
Recommended Posts
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.