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

Move or Copy Custom Entity

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
DonatasAzaravicius
896 Views, 3 Replies

Move or Copy Custom Entity

Hi,

I have custom entity and I want to copy or move it using autocad copy and move commands.

My entity have base point around which entity are drawn.

If I use copy command I can see image of custom entity move with mouse cursor, but pressing on insert location here are no custom entity it is at original custom entity location. So I guess, a copy of custom entity is made but base point are not changed and it is save at original entity location.

Move command too don't change base point.

I don't know which methods I need to implement for move and copy commands to work.

3 REPLIES 3
Message 2 of 4

Overwrite these methods in your custom entity class:

 

virtual Acad::ErrorStatus subTransformBy(const AcGeMatrix3d& xform);
virtual Acad::ErrorStatus subGetTransformedCopy(const AcGeMatrix3d& xform,
AcDbEntity*& pEnt) const;


Thomas Brammer ● Software Developer ● imos AGLinkedIn
If an answer solves your problem please [ACCEPT SOLUTION]. Otherwise explain why not.

Message 3 of 4
KIMHENGHOR98
in reply to: tbrammer

***virtual Acad::ErrorStatus subGetTransformedCopy(const AcGeMatrix3d& xform,
AcDbEntity*& pEnt) const;***

 

***This method does not work to copy entity ****

Message 4 of 4
tbrammer
in reply to: KIMHENGHOR98


@KIMHENGHOR98 wrote:

***virtual Acad::ErrorStatus subGetTransformedCopy(const AcGeMatrix3d& xform,
AcDbEntity*& pEnt) const;***

 

***This method does not work to copy entity ****


You should not call subGetTransformedCopy()  directly. Instead call

  • AcDbEntity::getTransformedCopy(const AcGeMatrix3d& xform, AcDbEntity*& pEnt)
  • AcDbEntity::clone()
  • or use "Deep Cloning".

I recomment reading the "Deep Cloning" article to understand in which cases you need Deep Cloning and how to implement custom classes that support Deep Cloning. Also make sure to understand the difference between copying within one database and from one database to another.


Thomas Brammer ● Software Developer ● imos AGLinkedIn
If an answer solves your problem please [ACCEPT SOLUTION]. Otherwise explain why not.

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report