AnsweredAssumed Answered

get actual path of component (applying swx search)

Question asked by Jana Stahn on Jan 15, 2020
Latest reply on Jan 16, 2020 by Danniel Sims

There is this method IComponent2.GetPathName() which gives the path of the component file.

It works well for unsuppressed components. But I have trouble using it (successfully) for suppressed components, because it will only return the path that was saved in the document, not the ACTUAL path:


Assume I have an assembly A with path C:\Users\me\example\A.SLDASM which has a component B with path C:\Users\me\example\B.SLDPRT. I suppress B inside A. Then I give the folder "example" to a colleague who puts it to the following location: D:\foo\. So he has A with ACTUAL path D:\foo\example\A.SLDASM and B with ACTUAL path D:\foo\example\B.SLDPRT. But if he opens A in SolidWorks and calls IComponent2.GetPathName() on component B, he will still get C:\Users\me\example\B.SLDPRT. But I need him to get D:\foo\example\B.SLDPRT instead. How do I do this via API?


The API help for IComponent2.GetPathName() states

This method does not apply search criteria or look in the current working directory for the component file reference if the component is lightweight or suppressed.

So how do I apply this Swx search via API?