.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Reply
Message 1 of 5
SRSDS
737 Views, 4 Replies

Copy Event

Any way to handle this returning the objectIDs being copied? 

 

4 REPLIES 4
Message 2 of 5
StephenPreston
in reply to: SRSDS

There are a number of commands that 'copy' entities, but the underlying mechanism is called 'cloning':

 

- DeepCloning is used to copy entities within a database

- WblockCloning is used to copy entities between databases.

 

Take a look at the various deepclone/wblockclone events exposed by the Dataabse class to understand the notifications you can receive. Some of these are passed an IdMapping object that allows you to query the objectid of the clone and the clonee. And you'll find a lot of detail on cloning in the ObjectARX Developers Guide. Although that's about the C++ classes, the concepts (as always) are equally applicable to the .NET API.

 

You can also implement an ObjectOverrule to modify the deepclone/wblockclone behavior of a specific set of objects. E.g.. If you want to know when any circle in the drawing is cloned, you can register a global overrule against the Circle class and do whatever you need to do in the overruled cloning methods.

 

Cheers,

 

Stephen Preston

Autodesk Developer Network 

Cheers,

Stephen Preston
Autodesk Developer Network
Message 3 of 5
SRSDS
in reply to: StephenPreston

Stephen,

Thanks for the help.

 I tried starting by copying the VB coding from the ObjectARX documentation but errors are generated. No idea how to implement the event or handler .

<Wrapper("AcDbObjectOverrule")>
Public abstract Class ObjectOverrule
Inherits Overrule

I've googled the problem to death and can't find an example for what I am trying to achieve.

Doesn't appear to be a simple case of adding a reactor and handling the selectionset.

OK if it were a Noun-Verb action.

 

Mirroring an object I can also see being an issue if the objectID changes as a result of the clone.

Message 4 of 5
StephenPreston
in reply to: SRSDS

Download the samples from my AU 2010 class on overrules from AU online. You'll find my 'Network' sample implements WblockClone and Deepclone overrules, although for a different reason that you.

 

Cheers,

Stephen Preston
Autodesk Developer Network
Message 5 of 5
SRSDS
in reply to: StephenPreston

I can’t figure out how to look at the ObjectIDs of the selection to be cloned. I need to crosscheck them with entries stored in the NOD to work out how they should be copied.

I’ve tried using.. If IdMapping.Contains(objID)… but it doesn’t come back as true when it should.

 

I've searched a fair bit but the only exaples are how to deal with the collection as a whole.

 

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