Show marking menu from code

Show marking menu from code

alain_miltenburg
Advocate Advocate
459 Views
4 Replies
Message 1 of 5

Show marking menu from code

alain_miltenburg
Advocate
Advocate

I am looking for a way to display the marking menu from code.

The only related API call I found so far does not seem to work:

_application.CommandManager.ControlDefinitions["AppViewMarkingMenuCmd"].Execute

 

0 Likes
460 Views
4 Replies
Replies (4)
Message 2 of 5

WCrihfield
Mentor
Mentor

Hi @alain_miltenburg.  The command within the code you posted actually toggles the "Use Classic Context Menu" checkbox setting within the Tools tab > Options panel > Customize (dialog) > Marking Menu tab ...(in the lower right area).

WCrihfield_0-1645452426739.png

I don't know if there is a regular command for showing the marking menu.  Normally it is triggered to show when you right click somewhere within the model area of the application screen, but there are exceptions to that too.  I would assume you would need to reproduce that scenario by simulating positioning the mouse pointer somewhere within the model area of the screen, then simulate a right mouse button click (or right mouse button down).  Have you ever simulated mouse interactions by code before?

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 5

alain_miltenburg
Advocate
Advocate

Hi @WCrihfield,

 

That command is not very useful for me then. The name suggested otherwise.

 

Thanks for the suggestion about simulating right mouse clicks. I am indeed familiar with simulated user input and I have considered this path as an escape in absence of an API call. However I am afraid this would function unreliable. More importantly, the marking menu would show up on a different location from where the mouse was right clicked. That is not really acceptable for me.

 

Maybe there is another way... Do you know by chance of the existence of a form control comparable in behaviour to a BrowserNode, but which can be used on your own windows? I could not find any information about reusable controls in general, so I do not have high hopes.

0 Likes
Message 4 of 5

WCrihfield
Mentor
Mentor

Hi @alain_miltenburg.  I'm not sure if this is anything like you were looking for, but if you have ever looked into customizing the user interface by code, you may have already come across some of this.  The UI customization generally starts with the Environment object.  Then the Ribbon(s) and RadialMarkingMenus directly available within that specific environment.  At the ribbon level, you also have access to the QuickAccessControls (CommandControls) which populate the Quick Access Toolbar.  Then from the Ribbon, it steps down to RibbonTabs, RibbonTab, RibbonPanels, & RibbonPanel.  Then the RibbonPanel can have CommandControls and/or SlideOutControls (more CommandControls). The CommandControls is where you have the different types of controls (buttons, button pop-up, combo box, gallery, macro, pop-up, separator, split button, and the like).  Under those are the actual ControlDefinition objects.

 

Then on the RadialMarkingMenu side, you have the 'directional' controls, and the ability to create sub controls within a directional control.  I honestly have not created any of my own Inventor add-ins yet, due to corporate restrictions and red tape, so I have not done a ton of UI customization of my own by code yet, but I have created my own panels and buttons before by code.  I'm not really sure about how to display a specific RadialMarkingMenu in a specific location on the modeling screen yet, though.  I hope this helps some.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 5 of 5

alain_miltenburg
Advocate
Advocate

Hi @WCrihfield,

 

Sorry for the late reply and thanks for your extensive suggestion! But that was not what I am looking for.

I was examining whether it would be possible to create an alternative Model Browser which would implement several intuitive production improvements I have in mind. But I had to conclude the API is too restrictive for these ideas to be worked out.

 

0 Likes