How create grip like parameter-grip in dynamic block in a custom entity?

How create grip like parameter-grip in dynamic block in a custom entity?

maisoui
Advocate Advocate
834 Views
4 Replies
Message 1 of 5

How create grip like parameter-grip in dynamic block in a custom entity?

maisoui
Advocate
Advocate

Hi,

 

I created a custom entity, and I'd like to implement grip points with special behaviour like parameter in dynamic block (like flip, align, visibility, ...). So, I overrided the two methods:

  • subGetGripPoints(AcDbGripDataPtrArray & grips, const double curViewUnitSize, const int gripSize, const AcGeVector3d & curViewDir, const int bitflags) const
  • subMoveGripPointsAt(const AcDbVoidPtrArray & gripAppData, const AcGeVector3d & offset, const int bitflags)

To have a custom graphical representation of my grip, I used AcDbGripData::setWorldDraw(...) and defined the callback for the world draw of the grip.

 

The problem is that when subMoveGripPointsAt is called, I need to stop the "move grip point process" (in case of my special grip) to reproduce parameter-grip behaviour in dynamic block.

 

All suggestions are welcomed.

 

Regards,

Jonathan

--
Jonathan
0 Likes
Accepted solutions (1)
835 Views
4 Replies
Replies (4)
Message 2 of 5

maisoui
Advocate
Advocate

I've found a solution. In the methode subMoveGripPointsAt I send a command to execute to stop the move grip process, like this:

 

if(offset.length() == 0.)
acDocManager->sendStringToExecute(acDocManager->curDocument(), _T("@10,10\n"), false, false, false);

 

I guess, it's not very clean, so topic keeps opened.

Best regards,

Jonahtan

--
Jonathan
0 Likes
Message 3 of 5

Virupaksha_aithal
Autodesk Support
Autodesk Support

Hi,

 

If I understand your issue correctly, you want to stop or not process call to moveGripPointsAt  with specific grip in custom entity. In that case, you can always not to apply transformation to the grips by identifying grip point. For identification you can use “AcDbGripData” of the grip which comes as node in “AcDbVoidPtrArray” (first parameter).

 

Correct me if I have misunderstood your issue.



Virupaksha Aithal KM
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 4 of 5

maisoui
Advocate
Advocate

Hi,

 

Yes you well understood. I already implemented what you suggest. My problem is how to "tell AutoCAD to stop the grip move process" without requiring the user to click. So that why I use my workaround by calling a command to simulate user's click.

 

Process steps ares:

1. subGetGripPoints -> create app data and set a custom grip world draw

2. custom grip world draw callback

3. subMoveGripPointsAt -> identify the grip with app data, apply the modification (ex: mirroring), call command to stop moveGripPointsAt

 

My second idea was to use a callback when grip becomes hot (GripOperationPtr) to apply the modification and the return AcDbGripOperations::eGripHotToWarm. Not yet already test, but it's maybe a cleaner way to reach my goal.

 

What do you think about it?

Regards,

Jonathan


--
Jonathan
0 Likes
Message 5 of 5

maisoui
Advocate
Advocate
Accepted solution

I've found a "cleaner" solution. As I wrote in my last post, I use the operation callback when grip becomes hot:

 

1. retrieve gripAppData

2. check if grip is a dynamic grip (and not move)

3. open entity for write (with AcDbObjectId argument of the callback)

4. apply the modification

5. close entity

6. return AcDbGripOperations::eGripHotToWarm (so the grip will return as warm)

 

It reproduces the same behaviour of parameters grips in dynamic block. In the console, it will only print "Command: ".

 

I hope it will help somebody else.

Regards,

Jonathan

 

--
Jonathan
0 Likes