
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I now there are many version of this out there and that is where i got what I have so far. My knowldege of coding is very limited and I don't have time now to learn but i really need this to work.
This code will give the the dxf but will no file name. I would like it to have the same file name as the part # followed by -Revsion.
any help will be appreciated.
Thank you.
Frank
Sub FlatPatternDXF()
Dim oPartDoc As Document
Set oPartDoc = ThisApplication.ActiveDocument
' The Active document must be a part
If oPartDoc.DocumentType <> kPartDocumentObject Then
MsgBox "The Active document must be a 'Part'"
Exit Sub
End If
' The Active document must be a Sheet metal Part
If oPartDoc.SubType <> "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
MsgBox "The Active document must be a 'Sheet Metal Part'"
Exit Sub
End If
Dim oFlatPattern As FlatPattern
Set oFlatPattern = oPartDoc.ComponentDefinition.FlatPattern
' There must be a flat pattern
If oFlatPattern Is Nothing Then
MsgBox "Please create the flat pattern"
Exit Sub
End If
Dim oDataIO As DataIO
Set oDataIO = oPartDoc.ComponentDefinition.DataIO
Dim sOut As String
sOut = "FLAT PATTERN DXF?AcadVersion=2000" _
+ "&OuterProfileLayer=OUTER_PROF&OuterProfileLayerColor=0;0;0" _
+ "&InteriorProfilesLayer=INNER_PROFS&InteriorProfilesLayerColor=0;0;0" _
+ "&FeatureProfileLayer=FEATURE&FeatureProfileLayerColor=0;0;0" _
+ "&BendUpLayer=BEND_UP&BendUpLayerColor=0;255;0&BendUpLayerLineType=37634" _
+ "&BendDownLayer=BEND_DOWN&BendDownLayerColor=0;255;0&BendDownLayerLineType=37634" _
Dim strProject As String
strProject = oPartDoc.PropertySets("Design Tracking Properties").Item("Project").Value
Dim strPath As String
strPath = "D:\Dropbox\Concept DXF\"
Dim oDXFfileNAME As String
oDXFfileNAME = strPath & strProject & ".dxf"
oDataIO.WriteDataToFile sOut, oDXFfileNAME
End Sub
Solved! Go to Solution.