Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Client Feature Right Click Menu

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
tneff2
781 Views, 3 Replies

Client Feature Right Click Menu

Does anyone out there know how to add to the right click menu of a client feature in the browser using the API? I'm trying to mimmick the right click menu that pops up when you right click other features like extrusion or hole in the browser. ie: "edit feature", "redefine",  etc.

Tags (1)
3 REPLIES 3
Message 2 of 4
cadull_rb
in reply to: tneff2

It took me a while to find it too, as the name wasn't what I was expecting. You need to handle events for Application.CommandManager.UserInputEvents.OnLinearMarkingMenu.

 

Regards,

cadull

Message 3 of 4
tneff2
in reply to: cadull_rb

Okay that's a good start. Would you happen to have an example handle? I'm trying to use the "rack face" sample to figure out how events are handled.

 

Thanks again for the help so far.

-Thomas

Message 4 of 4
cadull_rb
in reply to: tneff2

My event framework is a little complex, but the following should give you some ideas. I verify that just my client feature is selected before adding a button definition to the linear menu.

 

void OnLinearMarkingMenu(ObjectsEnumerator selectedEntities, SelectionDeviceEnum selectionDevice, CommandControls linearMenu, NameValueMap additionalInfo)
{
    AssemblyDocument assembly = Addin.Application.ActiveEditDocument as AssemblyDocument;
    if (assembly != null && selectedEntities.Count == 1 && new NotchDefinitionFeature(assembly, selectedEntities[1]).Exists)
        linearMenu.AddButton(m_editButton.ButtonDefinition, false, true, "AssemblyShowAssemblyFeatureDimsCtxCmd", false);
}

 

 Then my button execute handler, which is also used for the button on the ribbon panel to create a new client feature, displays a dialog to edit the client feature. My event framework inserts the first parameter which could be avoided if we used a different handler for each button.

 

void OnExecute(ButtonDefinition events, NameValueMap context)
{
    AssemblyDocument assembly = Addin.Application.ActiveEditDocument as AssemblyDocument;
    if(assembly==null)
        throw new Exception(events.DisplayName + " requires an active assembly document.");

    object selected = (events.InternalName==m_editButton.InternalName && assembly.SelectSet.Count==1) ? assembly.SelectSet[1] : null;
    NotchDefinitionFeature clientFeature = new NotchDefinitionFeature(assembly, selected);
    new NotchDefinitionDialog(clientFeature);
}

 

Regards,

cadull

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report