4 Replies Latest reply on Mar 16, 2016 8:57 AM by Michael Vick

    help with export dwg & iges together

    Michael Vick

      Good afternoon everyone.

      This is my first posting so if I do something taboo please let me know.

      I have been looking thru lots of messages and I have found a few macros that are doing sort of what I need. I combined two into one to get the attached macro. The iges out section does exactly what I want. The dwg section is close but I would like to send the files to the same directory as the iges file but with only the front view output. If someone has the ability and time I would like to also have a similar macro that will put the files in a subfolder within the same folder as the part model file. I saw one macro that put all configurations into a subfolder called "toolpath" within the model folder but I only use one configuration for my parts and I couldn't get it to name the files the same as the model file name. I apologize for trying to bum code time from you guys. If anyone can help me out I appreciate it.  Thanks.

        • Re: help with export dwg & iges together
          Michael Vick

          Also, is it possible use a similar macro to output a file to MasterCam Direct. Thanks

          • Re: help with export dwg & iges together
            Sanya Shmidt


            you need to have a variable for the model path:

            ModelPath = Left(swModel.GetPathName, InStrRev(swModel.GetPathName, "\") - 1)

            Then you need to make a dir:

            On Error Resume Next

                  MkDir (ModelPath & "\FOLDER123")

            On Error GoTo 0


            Above is not a perfect example, you can also check if the folder exists before creating and eliminate On error statements.

            If DIR(ModelPath & "\FOLDER123", vbDirectory) = "" Then

                 MkDir (ModelPath & "\FOLDER123")

            End If



            FileName = swModel.GetTitle & ".dwg"


            and finally you change the Export and saveas calls to:

            'Export each annotation view to a separate drawing file

                 swPart.ExportToDWG2 ModelPath & "\FOLDER123\" & FileName, sModelName, swExportToDWG_ExportAnnotationViews, False, varAlignment, False, False, 0, varViews


              swModel.SaveAs4 ModelPath & "\FOLDER123\" & fn(0) & ".igs", 0, 0, 0, 0


            Where FOLDER123 - can be any appropriate name for the folder.


            Hope this helps.