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.
Solved! Go to Solution.
Solved by cadull_rb. Go to Solution.
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
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
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