2 Replies Latest reply on Apr 10, 2013 1:06 PM by Mike Sveda

    Automated DXF conversion from Solidworks Part

    Mike Sveda

      In EPDM 2012, you can use the Convert task to make a DXF from a Solidworks drawing file but not  the part file. I am looking for an automated way of creating a DXF of the flatt pattern on sheet metal parts when we release them to the shop. Our MFG depart would LOVE to have DXF's of flat patterns automatically ready for them when we release the drawings.

        • Re: Automated DXF conversion from Solidworks Part
          Michael Dekoning

          Without having done this myself, can't you write a macro to do this and create a new Task using the SolidWorks Task AddIn?

            • Re: Automated DXF conversion from Solidworks Part
              Mike Sveda

              Ok, I have a base maco.  How do I massage it to work?

               

              ' ******************************************************************************
              ' C:\Users\mikes\AppData\Local\Temp\swx6912\Macro1.swb - macro recorded on 04/10/13 by Mikes
              ' ******************************************************************************
              Dim swApp As Object

              Dim Part As Object
              Dim boolstatus As Boolean
              Dim longstatus As Long, longwarnings As Long

              Sub main()

              Set swApp = _
              Application.SldWorks

              Set Part = swApp.ActiveDoc
              boolstatus = Part.Extension.SelectByID2("Flat-Pattern1", "BODYFEATURE", 0, 0, 0, True, 0, Nothing, 0)
              longstatus = Part.SaveAs3("C:\ABCO_Vault\Projects\ABCO In-House\DXF Flat Patterns\Flat pattern - 2DEE3221.DXF", 0, 0)
              Set Part = swApp.ActiveDoc
              Dim myModelView As Object
              Set myModelView = Part.ActiveView
              myModelView.FrameLeft = 0
              myModelView.FrameTop = 21
              Set myModelView = Part.ActiveView
              myModelView.FrameState = swWindowState_e.swWindowMaximized
              Set Part = swApp.NewDocument("C:\ProgramData\SolidWorks\SolidWorks 2012\templates\drawing.drwdot", 0, 0, 0)
              swApp.ActivateDoc2 "Draw2 - Sheet1", False, longstatus
              Set Part = swApp.ActiveDoc
              Set Part = swApp.ActiveDoc
              Set myModelView = Part.ActiveView
              myModelView.FrameLeft = 0
              myModelView.FrameTop = 0
              Set myModelView = Part.ActiveView
              myModelView.FrameState = swWindowState_e.swWindowMaximized
              swApp.ActivateDoc2 "2DEE3221.sldprt", False, longstatus
              Set Part = swApp.ActiveDoc
              Part.EditUnsuppress2
              Part.ClearSelection2 True
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Dim myView As Object
              Set myView = Part.CreateDrawViewFromModelView3("C:\ABCO_Vault\Projects\2012\PJ1122 - CONVATEC\Mechanical Dwgs\2DEE3221.sldprt", "DxfOutputModelView", 0, 0, 0)
              boolstatus = Part.DeleteNamedView(DxfOutputModelView)
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.UnblankSketch
              Part.UnblankSketch
              Part.EditSuppress2
              Part.ClearSelection2 True
              Part.EditUnsuppress2
              Part.ClearSelection2 True
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.ClearSelection2 True
              Part.BlankSketch
              Part.BlankSketch
              Part.UnblankSketch
              Part.BlankSketch
              Set myView = Part.CreateDrawViewFromModelView3("C:\ABCO_Vault\Projects\2012\PJ1122 - CONVATEC\Mechanical Dwgs\2DEE3221.sldprt", "DxfOutputModelView", 0, 0, 0)
              Part.ClearSelection2 True
              boolstatus = Part.DeleteNamedView(DxfOutputModelView)
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.UnblankSketch
              Part.UnblankSketch
              Part.ClearSelection2 True
              Part.EditSuppress2
              Part.ClearSelection2 True
              Part.EditUnsuppress2
              Part.ClearSelection2 True
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.ClearSelection2 True
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.UnblankSketch
              Set myView = Part.CreateDrawViewFromModelView3("C:\ABCO_Vault\Projects\2012\PJ1122 - CONVATEC\Mechanical Dwgs\2DEE3221.sldprt", "DxfOutputModelView", 0, 0, 0)
              Part.ClearSelection2 True
              boolstatus = Part.DeleteNamedView(DxfOutputModelView)
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.BlankSketch
              Part.UnblankSketch
              Part.UnblankSketch
              Part.ClearSelection2 True
              Part.EditSuppress2
              Part.ClearSelection2 True
              Part.ClearSelection2 True
              End Sub