1 Reply Latest reply on Nov 2, 2014 5:06 PM by Daniel Andersson

    macro that looks through its folder for certain file names and saves as dxf.

    Christopher Golphin

      Can someone help me get a macro to look through the folder its placed for all files containing "_blank" for example in its name and export it to .dxf format? I'm relatively new to SW api.

        • Re: macro that looks through its folder for certain file names and saves as dxf.
          Daniel Andersson

          Hello Christoper,


          There is plenty of macros around that exports to DXF. I have never made one myself, so I thought I would give it a try this evening.

          If you have not found any macro out there yet, you are welcome to try this one.


          What you need to change is following variables.

          SourceFolder = "C:\sourcefolder\" 'Folder from where the export will be done. SUB folders will BE included.

          DestinationFolder = "C:\destinationfolder\" 'Do not forget that the string must end with \ (backslash)

          sFilter = "_blank" 'Macro will only export the drawings with a match to this string


          I would also recommend that you carefully compare the exported files so that you are confident and absolutely sure that the export was successful.

          The macro will also create a log file in the destination folder. I would recommend that you read the log file in order to find out if it there was any errors or warnings seen from a SolidWorks API perspective.

          Links to the enumeration of export (save) Errors and Warnings for the log file.

          Please provide feedback if you used the macro.

          The add-in Batchprocess can also batch convert files, if you feel have a further look at the site. I just had a brief look at it and it feels like it has very good functions and settings.

          There is a 50 days trial that you can use to evaluate the product. You could quite easy filter away the unwanted files by doing a manual search and just copy the ones with _blank in the file name before or after the batch run.


          Best regards