Some questions about ObjectARX

Some questions about ObjectARX

Anonymous
Not applicable
1,120 Views
6 Replies
Message 1 of 7

Some questions about ObjectARX

Anonymous
Not applicable

Hello, i'm trying to create a custom ObjectARX entity to help me in my job and i'm facing some problems. Since i wont share my custom entity with our costumers i'm creating it with ObjectARX instead ObjectDBX. First off, that is the code i got so far, a simple basic entity (.cpp file 😞

 

Duto::Duto () : AcDbEntity (), mCenter(100.0, 100.0, 0.0) {
}

Duto::~Duto () {
}

Adesk::Boolean Duto::subWorldDraw (AcGiWorldDraw *mode) { assertReadEnabled () ; mode->geometry().circle(mCenter, 50.0, AcGeVector3d(0.0, 0.0, 1.0)); return Adesk::kTrue; } Acad::ErrorStatus Duto::subGetGripPoints ( AcGePoint3dArray &gripPoints, AcDbIntArray &osnapModes, AcDbIntArray &geomIds ) const { assertReadEnabled() ; gripPoints.append(mCenter); return Acad::eOk; } Acad::ErrorStatus Duto::subMoveGripPointsAt (const AcDbIntArray &indices, const AcGeVector3d &offset) { assertWriteEnabled (); mCenter += offset; return Acad::eOk; } Acad::ErrorStatus Duto::subTransformBy(const AcGeMatrix3d &xfm) { assertWriteEnabled(); mCenter.transformBy(xfm); return ( AcDbEntity::subTransformBy(xfm)); }

 

That is the first weird thing, look this video:

 

https://www.youtube.com/watch?v=fRAeMQLaeL0

 

When i move/stretch/drag the circle the peview apears in the wrong place. The final position is right though.

 

 

Another problem is i can't select my entity with ssget:


(ssget "x" '((0 . "Duto")))

But when i use the Autolisp command

 

(entget (car (entsel)))

and select my entity, i get this: "... (100 . "Duto") ...".

 

I did rename the entity .cpp file as a .lsp file in order to  put it in the attachments.

I'm using Autocad2012/ObjectARX 2012/VS 2010. That's all, thanks in advance and sorry my english.

 

 

0 Likes
Accepted solutions (2)
1,121 Views
6 Replies
Replies (6)
Message 2 of 7

artc2
Autodesk
Autodesk
Accepted solution
For drag operations, AutoCAD clones the entity for each drag and displays the clone as the drag image. Cloning uses the dwgOutFields() and dwgInFields() methods to copy the data from the source entity to the clone. Your methods are not writing/reading the circle's center point, so the clone will end up with the default from the constructor. When you pick to end the drag, then transformBy() is called on the original entity. You do have that implemented, so that would explain why the final is where it should be.

I don't know why ssget won't work for you, and I really don't understand how you are getting a group 100 . "Duto" from entget because that requires that you have your dxfOutFields() method implemented and that you are using "Duto" as your subclass data marker string in a call to the filer's writeItem() using AcDb::kDxfSubclass as the first argument , but the code file you attached doesn't have a dxfOutFields() method in it.
Message 3 of 7

BerndCuder8196
Advocate
Advocate

ssget needs the DXF name of your entity.

 

I think you must implement this macro in your custom entity:

 

ACRX_DXF_DEFINE_MEMBERS
(
 Duto, AcDbEntity,
 AcDb::kDHL_CURRENT, AcDb::kMReleaseCurrent,
 AcDbProxyEntity::kNoOperation, DUTO,
 "MyApp"
 )

 

with DUTO in ssget (case sensitiv)

 

 

 

Message 4 of 7

BerndCuder8196
Advocate
Advocate

Sorry, have seen yet you have implement ACRX_DXF_DEFINE_MEMBERS.

 

Change dxf name to upper case: DUTO, also in ssget.

Message 5 of 7

Anonymous
Not applicable

Implemented "dwgInFields" and "dwgOutFields", preview is working fine now!

 

I still don't understand why ssget doesn'r work for my entity.

 

 

0 Likes
Message 6 of 7

artc2
Autodesk
Autodesk
Accepted solution
To get SSGET to work you need to change the DXFNAME in your ACRX_DXF_DEFINE_MEMBERS macro to be all uppercase like so:

ACRX_DXF_DEFINE_MEMBERS (
Duto, AcDbEntity,
AcDb::kDHL_CURRENT, AcDb::kMReleaseCurrent,
AcDbProxyEntity::kNoOperation, DUTO,
CAIROAPP
|Product Desc: A description for your object
|Company: Your company name
|WEB Address: Your company WEB site address
)

SSGET changes the dxf name string in the filter list to be all uppercase, and the string compare done against the actual entity dxf names is case sensitive.
0 Likes
Message 7 of 7

Anonymous
Not applicable

The ssget problem was the name, changed to DUTO and is perfect now, thank you all guys.

0 Likes