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
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
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
It should put the DXFs in "\<Part Folder>\DXFs\Epaisseur_XX\
The problem may come from the room. Can you attach a test part.
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"
Hello
On the youtube link there is a download link of the Marco to test
May the Force be with you