How to update the references of a virtual component using ISldWorks.ReplaceReferencedDocument? Please assume that the virtual component and the host assembly are not open in SolidWorks.
If a Virtual component Part has an external reference defined in the context of the host assembly, then renaming the host assembly leaves the external reference to refer the old host assembly. How to update the reference of the virtual component to refer the new host assembly using either ISldWorks.ReplaceReference or its equivalent Document Manager API call?
Here is a simplified scenario -
There is a host assembly, named A.sldasm.
It has two sub-components, one virtual and the other external file, named P1^A.sldprt and P2.sldprt.
P1^A.sldprt has an external reference to P2.sldprt, in the context of A.sldasm.
Now, rename the assembly to B.sldasm in OS. If you look at the virtual component of the renamed assembly, it still has the reference defined in the context of Assembly A.sldasm.
Updating the references of an external file references is easy, because there is a physical file. As the virtual components don’t happen to have physical file, it is not possible to update the references using API. In this scenario, what should be passed as the ReferencingFilePath parameter of ISldWorks.ReplaceReferencedDocument method?
I could see that SolidWorks Pack-n-go handles is correctly. But, I would like to do the same thing using API. Any help would be greatly appreciated.