.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Best way to clone a group

1 REPLY 1
Reply
Message 1 of 2
Keith.Brown
600 Views, 1 Reply

Best way to clone a group

I have created my own copy command to copy block references and polylines for an application that I am working on.  The block references and polylines have custom information saved in their xdata and extension dictionaries that need updated after the cloning process.  I now need to do the same for some custom items that are basically groups with custom data attached also in their xdata and extension dictionaries.

 

Using Database.DeepCloneObjects on groups does not work well as the individual items of the groups will get cloned but the group itself will not.  In addition, the individual items in the group will still have its persistent reactor to the group even though the actual group itself is not cloned and in addition, the cloned items are not added to the group.  This leads to some funky behavior with the cloned objects.  Clicking on a cloned object will select the previous group if your pickstyle is set to 1.   This is because the individual cloned item still has a persistent reactor to the group, even though the group does not know about it.  Clicking the original group will not select any of the cloned items.  I need to use deepcloning on the individual items of the group because I need to be able to clone the data that is attached to them as well as keep alive all of the linking to other objects that is going on behind the scenes with the ObjectId's.  Is there a way to erase an items persistent reactors without going thru the container such as the group?

 

Below is a quick video I created that shows the group creation and the interaction of the data between items.  It does not show the actual problem of cloning the group.

 

1 REPLY 1
Message 2 of 2
Keith.Brown
in reply to: Keith.Brown

I thought I would add that I have tried .GetPersistentReactorIds that returns the objectidcollection and removed the offending Id but it did not stick which leads me to believe either the collection is a copy or something else is happening behind the scenes that I am not aware of and/or do not understand.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost