I have an add-in that's watching for right-clicks on Parts Lists in drawings. I'm able to watch for that event with this:
Sub OnPartsListRMB(SelectedEntities As ObjectsEnumerator, SelectionDevice As SelectionDeviceEnum, LinearMenu As CommandControls, AdditionalInfo As NameValueMap) Handles UserInputEvents.OnLinearMarkingMenu If SelectedEntities.Count = 1 AndAlso TypeOf SelectedEntities(1) Is PartsList Then MsgBox("Parts List right-clicked!") End If End Sub
However, what I actually want is to determine the document associated with the specific row that was right-clicked.
When we right-click a row, there's an "Open" button that will open the document associated with the row. So that information must be available under the hood somewhere.
Is that information (the specific row/document clicked) accessible via the OnLinearMarkingMenu event, or some other API?
Solved! Go to Solution.
Solved by DRoam. Go to Solution.
The OnLinearMarkingMenu event is just indicating that you right-clicked (somewhere) with one or more entities selected. The parts list is a single entity as far as the event is concerned. I'm not even sure there's a hack that would let you translate the cursor position to an item in the parts list. You would have to know how Inventor is graphically laying out the parts list.
That's what I figured. The OnLinearMarkingMenu event probably isn't going to have what I need.
But Inventor itself somehow knows which row was clicked (in order for the "Open" function to work). I'm wondering if there's some API that exposes that...
The "AdditionalInfo" NameValueMap parameter in the OnLinearMarkingMenu event is currently unused (at least in my 2017 version). Maybe post a suggestion in the Inventor Ideas forums to have information about the parts list row passed along to the event handler. As you pointed out, Inventor clearly knows which row of the parts list you right-clicked on. It wouldn't be a stretch for Inventor to pass along something to identify the row.
The AdditionalInfo parameter would be a good place to pass along the selected row, good idea. I'll wait a bit more to see if someone knows of a solution that would work now. But if there isn't one (which is looking likely), I'll create an idea for that.
Thanks Mike. Since this is not currently possible, idea created here: Provide API access to which Parts List row was right-clicked.
Can't find what you're looking for? Ask the community or share your knowledge.