ObjectARX

ObjectARX

Reply
New Member
Garthenius
Posts: 2
Registered: ‎05-26-2011
Message 1 of 3 (369 Views)

Using acedDragGen with AcDbEntity derived class

369 Views, 2 Replies
05-26-2011 06:21 AM

Hi,

 

I'm having trouble using acedDragGen to translate a custom AcDbEntity derived class.

 

  • The assumption I've made is that acedDragGen transforms its selection set using acedXformSS (or in a similar) ;

 

  • My solution was to implement subTransformBy in my custom class;

 

  • The problem is that subTransformBy is not getting called.

 

My callback (scnf) function constructs a translation matrix and returns RTNORM.

I've also overridden subCloneMeForDragging and subHideMeForDragging to see if they are being called and I've found they are both being called (even if subCloneMeForDragging returns Adesk::kFalse). When I've coded them to return Adesk::kTrue and true, respectively, I've found that clone is called but and overridden subGetTransformedCopy isn't.

 

I've checked my overloads' signatures, a direct call to acedXformSS before acedDragGen will trigger my subTransformBy.

 

I'm guessing I'm missing something; most likely my initial assumption (that acedDragGen transforms its selection set using acedXformSS or similar) is wrong.

 

At the moment I'm looking for a solution that does not involve using global/static data (e.g. having a global pointer to my entity and calling transformBy inside scnf).

 

Any information as to what I'm doing wrong or any method to get the translation information from acedDragGen to my custom entity would be much appreciated.

Active Member
TomBengsch
Posts: 8
Registered: ‎05-26-2011
Message 2 of 3 (348 Views)

Re: Using acedDragGen with AcDbEntity derived class

05-27-2011 12:53 AM in reply to: Garthenius

Dear Garthenius,

 

ok, it is not possible to use an AcDbEntity derived Object with an ADS-Dragger without to install a Dragger Class derived from AcEdJig. I think there are many examples in the ObjectARx Samples.If you need more information post me, then I look for some examples.

 

But I think that the best what you can do is to implemented the Dragobject in your AcDbEntity Object. Look for dragStatus(), set a flag and draw in subWorldDraw whatever you want. It works. But I have to warn you because you have to implemeted two different ways (transformBy() and subMoveGripPointsAt(). One get a transformation vector, one get a transformation matrix.

New Member
Garthenius
Posts: 2
Registered: ‎05-26-2011
Message 3 of 3 (328 Views)

Re: Using acedDragGen with AcDbEntity derived class

05-31-2011 08:25 AM in reply to: Garthenius

Thanks for your reply, I've managed to find a solution myself.

 

The actual problem was subtle: my assumption (that acedDragGen transforms its selection set using acedXformSS or similar) was definetely wrong. The way it actually works is that it applies the transformation similar to pushModelTransform. It won't appear if you call getModelToWorldTransform; my best guess is that it gets cached and applied right before any drawing takes place, but it definetely gets applied.

 

What prevented me from seeing this was the fact that I was using worldLine to draw a mesh representation of my object and this function is unaffected by the transform stack or the tracking callback (scnf).

 

It took a simple fix (using polyline instead of worldLine) and everything worked out fine.

 

Hope this helps someone!

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.