- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all.
It's been a while since I posted something. But now I need some help.
I recently found this iLogic code to export *.ipt flat patterns to dxf. It does almost everything I require. But I need to tweak it a little.
1. I need for the code to ask where the Save destination folder will be. (Rather than me going into the code to change the "SETFilePath".
2. I would like the "File Save As" name to be set to a specific value from within the part "Custom iProperties". In this case it would be the value associated with "ProfileFileName".
3. This code exports every line contained in the Flat Pattern. (Eg. Outer profile edge, Fold Lines & Fold extents lines).
I only need it to export the Outer Edge Profile & if possible that layer is to be exported as "Layer 0".
Any help would be appreciated.
The code is below.
'Code by @ClintBrown3D originally posted at https://clintbrown.co.uk/DXF
'Set your filepath here:
SETFilePath = "C:\Temp"
Dim partDoc As PartDocument
If ThisApplication.ActiveDocument.DocumentType <> kPartDocumentObject Then
MessageBox.Show ("Please open a part document", "iLogic")
End If
'Check for flat pattern >> create one if needed
Dim oDoc As PartDocument
oDoc = ThisApplication.ActiveDocument
Dim oCompDef As SheetMetalComponentDefinition
oCompDef = oDoc.ComponentDefinition
If oCompDef.HasFlatPattern = False Then
oCompDef.Unfold
Else
oCompDef.FlatPattern.Edit
End If
'DXF Settings
Dim sOut As String
Dim sPATH As String
sOut = "FLAT PATTERN DXF?AcadVersion=2000&OuterProfileLayer=IV_INTERIOR_PROFILES"
Dim sFname As String
sFname = SETFilePath & "\" & ThisDoc.FileName(False) & ".dxf"
'Export the DXF and fold the model back up
oCompDef.DataIO.WriteDataToFile( sOut, sFname)
Dim oSMDef As SheetMetalComponentDefinition
oSMDef = oDoc.ComponentDefinition
oSMDef.FlatPattern.ExitEdit
'ThisApplication.StatusBarText = "@ClintBrown3D: DXF saved to: " & sFname
MessageBox.Show("DXF saved to: " & sFname, "@ClintBrown3D: Success!")
Solved! Go to Solution.