In drawing,I have selected one segment and I want to know that how to get which part it belongs to?
Please look at the information selected below in the diagram .
I am fluent in VB.
Thank you for all your help！
Click RMB and choice Open Part
SOOORY... I'm stupid, did not notice that the question concerns the API.
Artem Taturevych wrote: ISelectionMgr::GetSelectedObjectsDrawingView2->IView::ReferencedDocument
Artem Taturevych wrote:
Unless I miss my guess, this is an assembly drawing, and he wants the document for the component owning the edge selected.
One thing to recognize... when you select an edge/face in a drawing view, it's not actually the only selected object. The view is selected also.
See this snippet:
If Part.GetType = swDocDRAWING Then If SelMgr.GetSelectedObjectType2(1) = swSelDRAWINGVIEWS Then Set myView = SelMgr.GetSelectedObject5(1) Set modRefByView = myView.ReferencedDocument If modRefByView.GetType = swDocPART Then Set Part2Open = swApp.ActivateDoc2(modRefByView.GetPathName, False, dummy) ElseIf modRefByView.GetType = swDocASSEMBLY Then If SelMgr.GetSelectedObjectCount = 2 Then Set MyDwgComp = SelMgr.GetSelectedObjectsComponent2(2) Set MyComp = MyDwgComp.Component Set Part2Open = swApp.ActivateDoc2(MyComp.GetPathName, False, dummy) End If End If ElseIf SelMgr.GetSelectedObjectType3(1, -1) = swSelCOMPONENTS Then Set MyDwgComp = SelMgr.GetSelectedObject6(1, -1) Set MyComp = MyDwgComp.Component Set Part2Open = swApp.ActivateDoc2(MyComp.GetPathName, False, dummy) End IfElse
You are correct, Josh. I overlooked this.
You're a genius,and thank you .
The problem was solved
Retrieving data ...