1 Reply Latest reply on Nov 8, 2018 9:50 PM by Danniel Sims

    Opening IGES files with a macro

    Toby Webbley

      Hello,  I have recorded a macro that includes opening an IGES file with no issue during the recording. When I rerun the macro I get the error message "unable to read IGES file. File was truncated or contains invalid data" and doesn't get past the open command.


      Has anyone had the same problem or know how to fix it?


      Also, does anyone know where to start with writing a program that would open Solidworks and run a macro just by running the program? I've read that batch files can only open the program but not run any commands in the program.


      Thanks in advance,




        • Re: Opening IGES files with a macro
          Danniel Sims

          I had a similar problem a long while back.  I think it has to do with how the file is saved.  If you aren't generating the IGES files youself, it may be bad data.  In my case, I was checking CADCAM data reassemabled after making IGES, STL, STEP, and Parasolids from a solidworks file.  Until I fixed the preferences, all the IGES files opened empty.


          swApp.SetUserPreferenceToggle swIGESComponentsIntoOneFile, True

          swApp.SetUserPreferenceToggle swIGESExportSolidAndSurface, True

          swApp.SetUserPreferenceToggle swIGESFlattenAssemHierarchy, True

          swApp.SetUserPreferenceToggle swIGESHighTrimCurveAccuracy, True

          swApp.SetUserPreferenceToggle swIGESComponentsIntoOneFile, True