03

Answers 3
AT
AT 2018-03-02 Best Answer

Hi,

Please take a look at this example: Code Stack: Show Selected Assembly Component In The Window Folder

It opens the folder and selects the file of the selected component in the assembly tree.

Thanks,
Artem

DG
DG 2018-03-02

Was about to post the similar codes i.e. getting the folder path of the selected component and opening that

祥Z
祥Z 2018-03-02

Dim swApp As SldWorks.SldWorks

Dim part  As SldWorks.ModelDoc2

Dim sMgr As SldWorks.SelectionMgr

Dim swComp As SldWorks.Component2

Dim A     As String

Sub main()

Set swApp = Application.SldWorks

Set part = swApp.ActiveDoc

Set sMgr = part.SelectionManager

Set swComp = sMgr.GetSelectedObjectsComponent2(1)

If swComp Is Nothing Then

          A = part.GetPathName

          MsgBox A, vbOKOnly, "position"

        Else

          A = swComp.GetPathName

          MsgBox A, vbOKOnly, "position"

        End If

End Sub