I figured it out most of the code already, nice to see i was close. Where i was wrong is that i used GetSelectedObject6 instead of GetSelectedObjectsComponent. This works, thanks.
But i dont get the part name yet. now i get the name of the assembly(s) and then the part name,seperated by "/". and also the count number is added to the partname. like this: SUBxxxx-1/Subxxx-1/DRWxxxx-1
Is there a way i get only the part name (DRWxxxx in the example above)?
Excuse me, already figured it out:
strName = swDrawComp.component.GetPathName
i still got an issue. What i want to do is to open the selected part. when opening a part from assembly drawing no problem, but when opening a part from a part drawing i get an error. code i have now:
For i = 1 To SelMgr.GetSelectedObjectCount2(-1)
Set swDrawComp = SelMgr.GetSelectedObjectsComponent4(i, 0)
If Not swDrawComp Is Nothing Then
Set swComp= swDrawComp.component
it gives an error op the component. There is a drawingComponent, but it looks like there is no component(2). How can i solve this?