5 Replies Latest reply on Sep 24, 2013 11:55 PM by Andrey Pronyashin

    Change reference

    Andrey Pronyashin

      How to replace the incorrect reference of components in an open document?

        • Re: Change reference
          Keith Rice

          Andrey,

           

          If you must have SolidWorks open, check out these options:

           

          1. IAssemblyDoc::ReplaceComponents (see the API Help Example "Replace Component Example (VBA)"

          2. ISldWorks::ReplaceReferencedDocument (see the API Help Example "Replace Referenced Document Example (VBA)")

           

          If you have lots of references you need to replace, it would be wiser to accomplish this with the DocumentManager. This will require you to use a VB.NET or C# addin. Check out these API Help Articles:

           

          1. Replace Component (VB.NET)

          2. Replace Component (C#)

           

          I hope this helps.

           

          Keith

          SolidWorks API Video Tutorials

            • Re: Change reference
              Andrey Pronyashin

              Thank you. In my case, the use of ISldWorks::ReplaceReferencedDocument before opening the document helped.

              Change the links needed to fix a bug - watch the Attach video. As I understand it should not be.

              Unfortunately SldWorks::ReplaceReferencedDocument not everywhere corrects this beetle, I was told in SolidWorks 2009 SP0 it didn't work.

              Could you suggest how to get the path of the folder created when you run SolidWorks, for each session, such that folder- "C:\\DOCUME~1\\user\\LOCALS~1\\Temp\\swx4416 through the API?

                • Re: Change reference
                  Keith Rice

                  Andrey Pronyashin wrote:

                  Could you suggest how to get the path of the folder created when you run SolidWorks, for each session, such that folder- "C:\\DOCUME~1\\user\\LOCALS~1\\Temp\\swx4416 through the API?

                   

                  No I am not aware of a way to get this folder. I am sure there are other ways, using the File System Object (VBA) or the .NET framework to find the most recently created folder.

                   

                  Why can't you upgrade a later service pack? Is it fixed in the later service packs?

                   

                  Keith

                  SolidWorks API Video Tutorials