I want to get a component path by component name.
The component that I want to get the path is already opened. But I just know component name.
Which method should I use to get component path?
Just to clarify, Components are members of Assembly Documents.
Components are just instances of Assembly Documents or Part Documents in an assembly.
Part Documents, Assembly Documents, and Drawing Documents are all Model Documents. Model documents implement the method that you are looking for: GetPathName.
To get the path of a Model Document from a component in an assembly:
modelDoc = component.GetModelDoc2()
full_path = modelDoc.GetPathName()
Thank you for quick reply!
It helps me a lot!
2012 SOLIDWORKS API Help - Get Component by Name (VBA)
2016 SOLIDWORKS API Help - GetPathName Method (IComponent2)
Retrieving data ...