Export DXF of an assembly

Hello

I have a macro that exports DXF from a sheet metal assembly, can I make a modification to group the outgoing files by thickness (in the D folder).(thickness) ...

Thanks in advance

Hello

Yes, this is possible by reading the thickness property of the cut list

Here is an example of code to retrieve this property on an open part:

Option Explicit
Sub main()
    Dim swApp As SldWorks.SldWorks
    Dim swModel As SldWorks.ModelDoc2
    Dim swFeat As SldWorks.Feature
    Dim custPrpMgr As SldWorks.CustomPropertyManager
    Dim myThickness As String
    Set swApp = Application.SldWorks
    Set swModel = swApp.ActiveDoc
    If swModel Is Nothing Then Exit Sub
    Set swFeat = swModel.FirstFeature
    While Not swFeat Is Nothing
        If swFeat.GetTypeName2 = "CutListFolder" Then
            Set custPrpMgr = swFeat.CustomPropertyManager
            custPrpMgr.Get2 "Epaisseur de tôlerie", "", myThickness
            Debug.Print "Epaisseur: " & myThickness
        End If
        Set swFeat = swFeat.GetNextFeature
    Wend
End Sub

 

2 Likes

Hello

Thanks for your reponce and please how to add in the macro code??

Attached is the file that I have

 

 


got-flaten-dxf-from-assembly.swp

Replaces the line:

Const OUT_NAME_TEMPLATE As String = "DXFs\<_FileName_>_<_FeatureName_>_<_ConfName_>_<Description>.dxf"

By:

Const OUT_NAME_TEMPLATE As String = "DXFs\Epaisseur_<Epaisseur de tôlerie>\<_FileName_>_<_FeatureName_>_<_ConfName_>_<Description>.dxf"

Note: Check the spelling of the "Sheet Metal Thickness" property in your parts. And modifies the above line accordingly.

If you want a rounded thickness value, add:

If Val(resVal) > 0 Then resVal = Round(resVal, 0)

Just after the line:

swCustPrpMgr.Get2 token, "", resVal

 

1 Like
I do what you said but the macro doesn't create folders by thickness of parts...
Otherwise if you could make the modification on the macro and send me the full version

 

I want something like this: YOUTUBE link

It should put the DXFs in "\<Part Folder>\DXFs\Epaisseur_XX\

The problem may come from the room. Can you attach a test part.

1 Like

Attached is an example


Part1.SLDPRT

Yeap. Following the instruction in my first post,

>Check the spelling of the "Sheet Metal Thickness" property in your parts. And modifies the above line accordingly.

The line should be:

Const OUT_NAME_TEMPLATE As String = "DXFs\Epaisseur_<Sheet Metal Thickness>\<_FileName_>_<_FeatureName_>_<_ConfName_>_<Description>.dxf"

 

1 Like

Hello

On the youtube link there is a download link of the Marco to test

May the Force be with you

 

1 Like
Hello
no the macro in the Youtube link is coded and is missing some instructions...
1 Like
Hello
Thank you very much "JeromeP" the problem and solved;
Is please how added in the registered part name the quantity (of the assembly) of each...
thank you in advance