How to cancel a jig drag loop from a modeless dialog

How to cancel a jig drag loop from a modeless dialog

hbxiaogui
Advocate Advocate
738 Views
5 Replies
Message 1 of 6

How to cancel a jig drag loop from a modeless dialog

hbxiaogui
Advocate
Advocate

I have a modeless dialog showing during jig.

There is a command in modeless dialog that uses acedEntSel() to pick an entity, and it returns RTREJ immediately.

I think the reason is I'm inside the jig. drag() loop, so I can't use acedEntSel().

So how can I cancel the drag loop from a modeless dialog?

0 Likes
Accepted solutions (1)
739 Views
5 Replies
Replies (5)
Message 2 of 6

hbxiaogui
Advocate
Advocate

I can't find a way to cancel the drag loop,and finally I move the command from dialog into my jig class, then use keywords to pick the entity.

0 Likes
Message 3 of 6

tbrammer
Advisor
Advisor

Try to send <ESC> like this:

AcApDocument *pCurrDoc = acDocManager->curDocument(); 
LPCTSTR cmd = _T("\x1B"); // ESC
Acad::ErrorStatus es = acDocManager->sendStringToExecute(pCurrDoc, cmd);

If you have added a keyword to cancel the jig, you can also send the keyword with cmd=_T("yourkey\n").


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

0 Likes
Message 4 of 6

hbxiaogui
Advocate
Advocate

I want to change the jig entity's property by picking another entity, the jig loop should still be there after the pick action.

I tried the solution by sending esc, it seems the esc will execute later than the pick action. 

0 Likes
Message 5 of 6

tbrammer
Advisor
Advisor
Accepted solution

I don't think that it is possible to call acedEntSel() during a jig loop. If you need to select an entity "within" the jig, you should exit the drag loop, select and re-enter the jig by calling jig.drag().

 

The effect of

acDocManager->sendStringToExecute(pCurrDoc, cmd);

is the same as entering cmd on the commandline. cmd is sent to AutoCAD's command queue and will be processed as soon as the command processor is ready to parse input.

 

 


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

0 Likes
Message 6 of 6

hbxiaogui
Advocate
Advocate

Thanks!

I add the button back to my dialog, and the click event only sends a keyword.

Now the loop works as expected.

 

0 Likes