1 Reply Latest reply on Oct 12, 2017 8:52 PM by Zhang Zhongfeng

    Update References

    Zhang Zhongfeng

      We can have there way to Update References for a .sldasm file when use API if cannot want to open file in SolidWorks.

      1.SwDMDocument18.ReplaceReference(OriginalReference, ReplacementReference) in SwDMClassFactory class;

      2.IEdmRawReferenceMgr.UpdateReferences(refs) in  EPDM.Interop.epdm class

      3.ISldWorks.ReplaceReferencedDocument(ReferencingDocument, ReferencedDocument, NewReference)in sldworks class


      And then,I Have tried all.

      1.the code  do smart,but there are not effect to change the reference,the referencr is old.

      2.then code when running  UpdateReferences(refs) cannot do and tip the Paramter error.

      3.the code is do and we can see the most reference is update,but,same toolbox part is not updated.


      so,what can i do and have a perfect outcome?

        • Re: Update References
          Zhang Zhongfeng

          Yes,i found something to do that.

          frist.used ISldWorks.ReplaceReferencedDocument(ReferencingDocument, ReferencedDocument, NewReference)is fine.

          and then,i see the method what GetReferenceTree and GetFirstChildPosition4 have a point must pick.


          that is


          IEdmReference10 have two method can get the path that is FoundPath and ReferencedAs .

          in same time ,the FoundPath and ReferencedAs have different path.


          so,we must give some logic judgment to decision which value can used

          in SldWorks.ReplaceReferencedDocument(ReferencingDocument, ReferencedDocument, NewReference).