Message 1 of 5
DXF Export with ilogic and save as location.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Can someone help me modify this code?
I am looking to use the standard behavior where it asks you where to save the DXF rather then a specified folder.
The code slightly changed to suit some of my needs but is near identical to this thread:
oDoc = ThisDoc.Document
If oDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
oDoc = ThisApplication.ActiveDocument
Dim oCompDef As SheetMetalComponentDefinition
oCompDef = oDoc.ComponentDefinition
If oCompDef.HasFlatPattern = False Then
oCompDef.Unfold
Else
oCompDef.FlatPattern.Edit
End If
Dim sOut As String
Dim oPath As String
oPath = ThisDoc.Path & "\DXF Flat"
If Not System.IO.Directory.Exists(oPath) Then
System.IO.Directory.CreateDirectory(oPath)
End If
Dim sFname As String
sOut = "FLAT PATTERN DXF?OuterProfileLayer=0&OuterProfileLayerColor=0;0;0&InteriorProfilesLayer=0&InteriorProfilesLayerColor=0;0;0&BendDownLayerLineType=37633&BendDownLayerColor=0;0;255&BendUpLayerLineType=37633&BendUpLayerColor=0;0;255IV_BEND;IV_BEND_DOWN;IV_OUTER_PROFILE;IV_INTERIOR_PROFILES;IV_FEATURE_PROFILES;IV_FEATURE_PROFILES_DOWN;IV_ALTREP_FRONT;IV_ALTREP_BACK;IV_ROLL_TANGENT;IV_ROLL&InvisibleLayers=IV_TANGENT;IV_TOOL_CENTER;IV_TOOL_CENTER_DOWN;IV_ARC_CENTERS;IV_UNCONSUMED_SKETCHES" _
+ "&RebaseGeometry=True" _
+ "&SimplifySplines=True" _
+ "&SplineTolerance=0.01" _
sFname = oPath & "\"& "myFile.dxf"
oCompDef.DataIO.WriteDataToFile(sOut, sFname)
Dim oSMDef As SheetMetalComponentDefinition
oSMDef = oDoc.ComponentDefinition
oSMDef.FlatPattern.ExitEdit
MessageBox.Show("Your file was saved in the following dirctory: " + sFname)
Else
MessageBox.Show("Only sheet metal parts can be exported as DXF.")
End If
I like to pick from my preset folders to select the save location. I also manually type in revision suffix's in the name of the file sometimes.
Is this possible?