Export DXF API Solidworks

I wrote a macro to clean up our drawings to keep only the outline of the part in order to create a DXF for the laser machine.

When I export the DXF manually, I have a proposal from SolidWorks to know if I should export on all the layers or on the visible layers.

(see attachment)

How can this be translated into the macro? It must be a parameter on the SaveAs3 or an option but I can't find it....

 

Attached is the macro part concerned....  
 
    Set Part = swApp.ActiveDoc
    PathName = UCase(Part.GetPathName)
    txt = Right(PathName, Len(PathName) - 10)
    txt1 = Left(txt, 8)
    txt2 = txt1 & "-" & Left(activesheetname, Len(activesheetname) - 3) & ".dxf"

    swApp.SetUserPreferenceToggle swUserPreferenceToggle_e.swDxfExportSplinesAsSplines, False
    boolstatus = swApp.SetUserPreferenceIntegerValue(swUserPreferenceIntegerValue_e.swDxfMultiSheetOption, swDxfMultisheet_e.swDxfActiveSheetOnly)
    Part.ClearSelection2 True

    longstatus = Part.SaveAs3("S:\SWX\Preparation\" & txt2, 0, 0)

 

 


api_dxf1.jpg

Hello

We made a macro that launches from the part to have the clean file for our machines.


macro_dxf.swp
2 Likes

Hello

You have info in the Hidden Layers Enumerators paragraph near the bottom of the page http://help.solidworks.com/2016/english/api/swconst/filesaveasdxfoptions.htm

Kind regards

Hello

 

I think this can guide you :) http://help.solidworks.com/2016/english/api/swconst/filesaveasdxfoptions.htm#HiddenLayers

Hello, like ac cobra 427, I would rather start from the 3d than from the drawing (just to be sure to have it at the 1 store!!)

2 Likes