Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
mindaV3J2J
1044 Views, 13 Replies

turn off certain layers when exporting as dxf

Hello,

 

I'm trying to export as dxf from parts; however, my script includes the tangent lines when exported, which means there are 3 bend lines instead of one. I want to turn off the IV_TANGENT and IV_ROLL_TANGENT layers.

 

mindaV3J2J_0-1690982176203.png

 

 

 

My code is below.

 

```

Sub ExportFlatPatternToDXF2()

 

Dim SETFilePath As String
SETFilePath = "path"

 

If ThisApplication.ActiveDocument.DocumentType <> kAssemblyDocumentObject Then
MsgBox "Please open an assembly document.", vbExclamation, "iLogic"
Exit Sub
End If

 

Dim oAsmDoc As AssemblyDocument
Set oAsmDoc = ThisApplication.ActiveDocument

 

Dim oRefDocs As DocumentsEnumerator
Set oRefDocs = oAsmDoc.AllReferencedDocuments

 

Dim oRefDoc As Document
For Each oRefDoc In oRefDocs

 

If oRefDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
Dim oSheetMetDoc As PartDocument
Set oSheetMetDoc = ThisApplication.Documents.Open(oRefDoc.FullFileName, True)

 

Dim oCompDef As SheetMetalComponentDefinition
Set oCompDef = oSheetMetDoc.ComponentDefinition

 

Dim oDef As FlatPattern

 

' If oCompDef.HasFlatPattern = False Then
' oCompDef.Unfold
' End If
Set oDef = oCompDef.FlatPattern
If oDef Is Nothing Then GoTo NextOcc

 

Dim sOut As String
sOut = "FLAT PATTERN DXF?AcadVersion=2018&OuterProfileLayer=IV_INTERIOR_PROFILES"

 

Dim sFname As String
sFname = SETFilePath & "\" & oSheetMetDoc.DisplayName & ".dxf"

Dim oDataIO As DataIO
Set oDataIO = oCompDef.DataIO

 

oDataIO.WriteDataToFile sOut, sFname

 

oCompDef.FlatPattern.ExitEdit
End If
NextOcc:
Next oRefDoc

 

MsgBox "Flat patterns exported to " & SETFilePath, vbInformation, "iLogic"
End Sub

```