1 Reply Latest reply on Jan 19, 2017 6:38 AM by Langenberg Janik

    enumdocuments opens models but doesn´t hide them

    Langenberg Janik

      Hi there,


      I tried to use enumdocuments to iteratively save models of an assembly as STEP-file.

      But while doing this SW does not unload opened and finished models so that my RAM fills up.


      here is the procedure:



      Set swApp = Application.SldWorks

      Set swAllDocs = swApp.EnumDocuments2

      Set FirstDoc = swApp.ActiveDoc


      swAllDocs.Next 1, swDoc, NumDocsReturned

      While NumDocsReturned <> 0

                       STEP_erzeugen (swDoc.GetPathName)

                      swDoc.Visible = false

                      swAllDocs.Next 1, swDoc, NumDocsReturned




      Set swAllDocs = Nothing

      Set swDoc = Nothing




      Sub STEP_erzeugen(Modelpath As String)


      Set swApp = Application.SldWorks

      Set Model = swApp.ActivateDoc3(Modelpath, True, swRebuildOnActivation_e.swRebuildActiveDoc, Errors)

      Set DocExt = Model.Extension


      longstatus = Model.SaveAs3(Path & Dateiname & ".STEP", 0, 0)


      End Sub



      I can´t use the close-command because the part has still to be loaded in assembly. But how can I avoid filling the RAM?

      thanks a lot ;-)