Asked this over in the Autodesk discussion groups with no answers, so I thought I would try here as well.
I have code that adds my own custom menu group to a contextmenu when right-clicking with a particular object selected (in this case a dimension). Works great!
My questions are:
1) How can I get my custom menu item located where I want it rather than appearing where it wants in the contextmenu?
2) Can I add my own custom menu item to an existing context menu group? For example: It you right-click on a dimension string in AutoCAD 2012, you get a group of dimension commands: Dimension Style, Precision, Etc... Is it possible to add my menu item to that group? If so, how can I do this. I cannot seem to find it documented anywhere! Below is my code for adding my own menu group. (Got help from an API Webcast). See attached image for an example of what I want to do.
Private Sub AddObject_RightClickMenu()
Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
Try
m_ObjectMenu = New ContextMenuExtension
m_ObjectMenu.Title = "Dimension Objects Menu"
Dim mnuItem As MenuItem = New MenuItem("Extension Line Toggle")
AddHandler mnuItem.Click, AddressOf run_dimExtEdit_WhenClicked
m_ObjectMenu.MenuItems.Add(mnuItem)
' create an rxclass
Dim dimensionClass As RXClass = RXObject.GetClass(GetType(Dimension))
' adding the object menu
Application.AddObjectContextMenuExtension(dimensionClass, m_ObjectMenu)
Catch ex As System.Exception
ed.WriteMessage("Error Adding Object Menu: " + ex.Message)
End Try
End Sub
I think I saw somewhere that Kean said #1 is not possible with the AutoCAD API, but I am still not sure about #2.
TIA!