Message 1 of 16
Modify layers before exporting DXF file using iLogic rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I'm currently trying to automate the process of exporting a DXF in Inventor using iLogic. Luckily I was able to find this article which contains the code for the exporting process, this code does almost what I was looking for except that I would like to modify some layers before doing the export.
How can I modify the following code to be able to modify layers before exporting the DXF?
FYI- I looked at the APIs for the but I'm not sure how what I need.
http://help.autodesk.com/view/INVNTOR/2018/ENU/?query=FlatPattern&userType=Developer
SyntaxEditor Code Snippet
Sub Main DefaultChoice = True CadlinePathProperty() Cadline() End Sub Sub CadlinePathProperty() Dim FilePATH As String = "FilePATH" customPropertySet = ThisDoc.Document.PropertySets.Item _ ("Inventor User Defined Properties") Try prop = customPropertySet.Item(FilePATH) Catch customPropertySet.Add("", FilePATH) End Try If iProperties.Value("Custom", "FilePATH") = "" Then iProperties.Value("Custom", "FilePATH") = "C:\Testing Folder" End If Dim partDoc As PartDocument If ThisApplication.ActiveDocument.DocumentType <> kPartDocumentObject Then MessageBox.Show ("Please open a part document", "iLogic") End If FilePATH = InputBox("Enter a FilePATH for part file", "iLogic", iProperties.Value("Custom", "FilePATH")) iProperties.Value("Custom", "FilePATH") = FilePATH 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 Dim sPATH As String sPATH = iProperties.Value("Custom", "FilePATH") sOut = "FLAT PATTERN DXF?AcadVersion=2004&OuterProfileLayer=IV_INTERIOR_PROFILES" Dim sFname As String sFname = sPATH & "\" & ThisDoc.FileName(False) & ".dxf" MessageBox.Show("DXF SAVED TO: " & sFname ,"DXF Saved", MessageBoxButtons.OK) oCompDef.DataIO.WriteDataToFile( sOut, sFname) oDoc = ThisApplication.ActiveDocument Dim oSMDef As SheetMetalComponentDefinition oSMDef = oDoc.ComponentDefinition oSMDef.FlatPattern.ExitEdit End Sub
This is how the layers should be modified to...