Sub Main DefaultChoice = True CADline() End Sub Public Sub CADline() 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 Dim sOut As String sOut = "FLAT PATTERN DWG?AcadVersion=2000&OuterProfileLayer=Burn&InteriorProfilesLayer=Burn&InvisibleLayers=IV_UNCONSUMEND_SKETCHES;IV_ALTREP_BACK;IV_ALTREP_FRONT;IV_ARC_CENTERS;IV_TOOL_CENTER_DOWN;IV_TOOL_CENTER;IV_ARC_CENTERS;IV_TANGENT;IV_BEND;IV_BEND_DOWN&SplineTolerance Double 0.01" Dim sFname As String 'oFolder = "DXF" oFolder = ThisDoc.Path sFname = oFolder & "\" & iProperties.Value("Custom","Číslo výkresu") & " rev" & iProperties.Value("Project","Revision Number") & " " & iProperties.Value("Project","Part Number") & ".dxf" oCompDef.DataIO.WriteDataToFile( sOut, sFname) oDoc = ThisApplication.ActiveDocument Dim oSMDef As SheetMetalComponentDefinition oSMDef = oDoc.ComponentDefinition oSMDef.FlatPattern.ExitEdit 'This code has been adapted from Rob Cohee's blog post that can be found here: http://ellipsis-autodesk.typepad.com/blog/2011/01/sheet-metal-ilogic-nugget.html 'This version of Code by Clint Brown of CADline. This version of Code Automatically changes the 'model back to a folded state after exporting the flat pattern, interior/exterior dialogu box'An End Sub