2 Replies Latest reply on Nov 26, 2016 10:39 PM by Paine Zeng

    PackAndGo not Open file

    Paine Zeng

      Hello everyone: Can we use the pack and go function to copy the solidworks files with not open the file?



      the code of api like this:

      ' Open assembly
              openFile = "C:\Program Files\SOLIDWORKS Corp\SOLIDWORKS\samples\tutorial\advdrawings\handle.sldasm"
              swModelDoc = swApp.OpenDoc6(openFile, swDocumentTypes_e.swDocASSEMBLY, swOpenDocOptions_e.swOpenDocOptions_Silent, "", errors, warnings)
              swModelDocExt = swModelDoc.Extension



      can we get the extension for unopend file?


      if we use      depends = swApp.GetDocumentDependencies(sourcefile, 1, 1) the copy the file ,then use the ReplaceReferencedDocument function ,we can't get the drawing.


      is there have a other way to do it?

        • Re: PackAndGo not Open file
          Peter Brinkhuis

          Pack and go typically opens all of the files and changes the references, so I assume creating a pack and go without opening the file would be impossible.


          I would suggest you use GetDocumentDependencies2 instead of GetDocumentDependencies, since it has been superseded for a long time.

            • Re: PackAndGo not Open file
              Paine Zeng

              maybe you are right.  if there have a other way to do it. because use the GUI windows (right click for the file),show the window for Pack and go. not need open solidworks can do the copy and rename the files.

              thanks for you suggest. i will update my code.

              but use GetDocumentDependencies2 can't find the drawing for all parts.