Shift Right Click Menu while using Editor.Drag

Shift Right Click Menu while using Editor.Drag

mhillis
Advocate Advocate
487 Views
2 Replies
Message 1 of 3

Shift Right Click Menu while using Editor.Drag

mhillis
Advocate
Advocate

Hello Everyone,

 

I've got a dimensioning routine that uses the Editor.Drag routine to have the user select a point for the dimension ends.  I'm wondering, using my setup, is there a means of enabling the Shift-Right Click snap menu?  I'd like for my users to be able to use this menu.

 

Below is my code used right now.

 

Thanks!

 

public PromptStatus StartJig()
        {
            Editor ed = 
                Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            // Loop until the user is done
            for (; ; )
            {
                myPR = (PromptPointResult)ed.Drag(this);

                if (myPR.Status != PromptStatus.OK)
                {
                    return PromptStatus.Cancel;
                }

                // If the end point has not been set then set it
                if (double.IsNaN(DimEndPoint.X))
                {
                    DimEndPoint = myPR.Value;
                }
                else // Else means the end point was set so set the text point
                {
                    DimTextPoint = myPR.Value;
                    // The text point has been set so we are finished
                    return PromptStatus.OK;
                }
            }
        }
0 Likes
488 Views
2 Replies
Replies (2)
Message 2 of 3

norman.yuan
Mentor
Mentor

You did not show your code in the Jig where you override the function JobSamplerStatus Samper(JigPrompts prompts), where you you call prompts.Acquirexxx(JigPromptOptioon), you can initialize the JigPromptOption with keywords.

 

That means, when jig starts, user can either moves mouse and click a location to end the jig; or, user can enter one of the keyword at commandline to end the jig, or user can RIGHT-CLICK to bright up context menu, which shows all the possible options corresponding to the Jig's input requirement, INCLUDEING all the keyword options added by your code.

 

For example, I may have a TransformJig, which allows user to MOVE/SCALE/ROTATE an selected entity, so, in the Samper() functiono, I could have code like this:

 

protected override SamplerStatus Smapler(JigPrompts prompts)

{

    var opt=new JigPromptPointOptions("\nMove to point:");

    opt.UserBasePoint=...

    opt.BasePoint=...

    opt.UserInputControls=UserInputControls.Accept3DCoordinates | ....

    opt.Keywords.Add("Scale");

    opt.Keywords.Add("Rotate");

 

    var res=prompts.AcquirePoint(opt);

    if (res.Status==...)

 

}

 

When this code runs, when user moves the mouse, jig keeps running (sampling and updating the ghost image); when user click, the jig returns with a point value; when user enter a keyword at command line, jig returns, I should have a loop outside the drag to run the jig again to either allow user do "Scale" or do "Rotate"; when user right-click, a context menu shows with options like "Enter", "Cancel", "Scale", "Rotate" (and a few other items, depending on the jig type), among them "Scale" and "Rotate" are generated based on the keywords in your code by AutoCAD. That is, you do not have to do anything other than define your keywords to have a custom context menu available during jigging.

 

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 3 of 3

norman.yuan
Mentor
Mentor

Well, if you actually mean to use "SHIFT+Right-Click", during jig, the default AutoCAD context menu for Selection is presented (for set OSNAP mode...) to help user to move mouse/select position; but I do not think there is way to customize it by your code

Norman Yuan

Drive CAD With Code

EESignature

0 Likes