4 Replies Latest reply on May 31, 2018 2:06 PM by Keaton Warn

    Specific SolidWorks API Command

    Keaton Warn

      I am modifying the Pack and Go macro code from 2015 SOLIDWORKS API Help - Pack and Go an Assembly (VBA)  so that instead of using a static file path assignment to the string variable "openFile", it uses a dynamic file path assignment that is designated by whatever file is currently open and selected in SolidWorks.

       

           Example: If I had an assembly file and its linked drawing file open, but then opened separate windows in SolidWorks of a separate      part assembly and its linked drawing file and selected either of them, I would want to hit the macro button so that the Pack and Go      operation is run on the file in the selected window (not the unrelated assembly and assembly drawing windows).

       

      Is there an API-specific command or block of code I can use to pull the file location of the selected window for the Pack and Go operation?

       

       

      (I know that the swModelDoc "swDocASSEMBLY" value will have to automatically be changed to "swDocDRAWING" when a drawing window is selected so that it matches the file type being Pack and Go'd. This is noted by the red underline.)