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

ACAD 2013 Copy and Paste on custom entities

3 REPLIES 3
Reply
Message 1 of 4
gatti.massimo
873 Views, 3 Replies

ACAD 2013 Copy and Paste on custom entities

Hi Everyone,

 

I'm looking about implementing copy & paste functionality on my custom entities.

 

Shoud I implement some interface?

 

Another problem could be the copy of associated extended dictionary..

 

I tried to copy an object with CTRL+c and CTRL+V and the pasted object is of the base class type.

 

Thank you for your help!

3 REPLIES 3
Message 2 of 4

Hi,

Copy / Paste is implemented through deep cloning, I suggest you to have a look in ObjectARX documentation:

Object ARX developer's guide > Advanced topics > Deep cloning.

 

As a brief summary, there are three main types of cloning operations:

  1. shallow clone (AcRxObject::clone)

  2. deep clone (AcDbObject::deepClone / subDeepClone)

  3. wblock clone ((AcDbObject::wblockClone / subWblockClone)

 

1. shallow clone performs a clone on the current object only

2. deep clone performs a more complex cloning operation, it clones the object and follows all soft references (pointers and ownsership(*)) is has , this type of cloning is used to clone objects in a single database

3. wblock clone performs yet another kind of cloning, it clones the object itself and follows all hard references (*). This kind of cloning is used to clone objects accross databases.

 

(*) hard and soft references are an important concept when talking about cloning in acad, I strongly suggest to understand these concepts perfectly (see doc).

 

To implement cloning correctly, you'll have to override:

 - AcDbObject::dwgInFields

 - AcDbObject::dwgFields

 - AcDbObject::subDeepClone

 - AcDbObject::subWblockClone

Note that default implementation of subDeepClone and subWblockClone is often enough to perform correct cloning on custom objects.

 

 Ctrl+C / Ctrl+V involves both wblock clone and deep clone operations.

 

 

I hope this helps

 

loic

----
20-20 CAD / 20-20 Technologies
Message 3 of 4

Perfect,

I'm reading this section on the documentation.

 

Then I don't have to override the acdbobject::clone function on my custom entities?

 

Thank you for your precious answer.

 

Have a good day!

Message 4 of 4

I've completed my first answer,
regards

loic
----
20-20 CAD / 20-20 Technologies

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

Post to forums  

Autodesk Design & Make Report

”Boost