2 Replies Latest reply on Apr 20, 2018 12:38 PM by Deepak Gupta

    Searching for 3 in 1 Macro: pack an go&parasolid&pdf

    Abe Teena


      I trying to make\combine a powerful macro for documentation

      the macro will make from the active drawing : parasolid&pdf&zip pack and go to the same folder. (predefined folder in the macro without any input from the user while Running the macro.)

      i have macros for pdf & parasolid separately  (don't have pack&go macro )

      the problem is the preconditions for the pdf macro is active drawing and for the parasolid is active part.. so having difficulties combing them.

      assuming the drawing and thee part are linked together in solidworks, is it possible to make the all in one macro?

      any help would be greatly appreciated:)


        • Re: Searching for 3 in 1 Macro: pack an go&parasolid&pdf
          Alex Burnett

          It is possible to link them together in one macro. I don't have experience with using the API for Pack & Go but the other two work well for me.


          I start with the drawing of the part/assembly open. I'm assuming you have a working version of this to export your PDF so that would be the first step. From there, you can get the default drawing view and then retrieve the referenced model from that view. The below code is written in c# but the process and commands should be the same. The only difference will be the syntax of VBA vs C#.


          Once you have the reference model, you can use that to save out your 3D formats of the file. I imagine the Pack & Go can be done with the drawing reference but I haven't tried it. Someone else may chime in with more help. Good luck!


          var modelView = (View)sheetView?.GetNextView(); // Gets first view on sheet
          if (swSheet.CustomPropertyView != "Default" && modelView != null) // Checks if the referenced view that the drawing uses to get custom properties is default
             while (modelView.Name != swSheet.CustomPropertyView)
                modelView = (View)modelView.GetNextView();  // sets modelView to the view that is referenced for custom properties
          var refModelDoc2 = modelView?.ReferencedDocument; // Gets referenced ModelDoc2 item from the view on the sheet
          refCfg = modelView?.ReferencedConfiguration; // Gets the referenced configuration of the model
          • Re: Searching for 3 in 1 Macro: pack an go&parasolid&pdf
            Deepak Gupta

            Use macro from this post Save IGES file from referenced Part in Drawing for PDF and Parasolid combined (replace IGES with Parasolid)


            For creating the zip, you can use the codes from one of these


            Default Using VBA to zip files

            Zip Files from Excel