- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all
I have over time compiled & tweaked the following code.
This code Exports Flat Pattern to DXF, gives the DXF file a name & stores it in a specific generated directory where the IPT file lives. The code is also part of a bigger picture & is linked to another piece of code that allows me to generate flat patterns for multiple IPT files I have open.
My problem is configuring the code to work to the Export options below.
This seems to tidy up any EMBOSSED text that in some cases in the course of our operation needs to be Laser Etched.
The code gives me this.
When I need this as created in the normal Inventor export function using a configured *.ini file
You will notice that the Letter "C" is not made up of long facets & is a lot tidier.
The code seems to work a treat and is easily tweaked from time to time when another idea is found for its use.
But I can't seem to replicate the DXF Export Options at the "sOut" section of within the code.
Any help or advice would be appreciated. Here is the code.
'Code to Export Fat Pattern to DXF by Clint Wilkinson 'Set your filepath here: SETFilePath = ThisDoc.Path SETFileName = iProperties.Value("Custom", "ProfileFileName") 'get DXF target folder path SETFileFolder = SETFilePath & "\" & "Dxf" 'Check for the DXF folder and create it if it does not exist If Not System.IO.Directory.Exists(SETFileFolder) Then System.IO.Directory.CreateDirectory(SETFileFolder) End If Dim partDoc As PartDocument If ThisApplication.ActiveDocument.DocumentType <> kPartDocumentObject Then MessageBox.Show ("Please open a part document", "iLogic") End If 'Check for flat pattern >> create one if needed 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 'DXF Settings Dim sOut As String Dim sPATH As String sOut = "FLAT PATTERN DXF?AcadVersion=2007" _ + "&OuterProfileLayer=0&InteriorProfilesLayer=0" _ + "&FeatureProfilesDownLayerColor=0;128;255" _ + "&FeatureProfilesUpLayerColor=255;0;0" _ + "&InvisibleLayers=IV_TANGENT;IV_ARC_CENTERS;IV_BEND;IV_BEND_DOWN" _ + "SimplifySplines=True" _ + "&SplineTolerance=0.01" _ + "&MergeProfilesIntoPolyline=True" _ + "&BendLayerColor=255;255;0" Dim sFname As String sFname = SETFileFolder & "\" & SETFileName & ".dxf" If System.IO.File.Exists(sFname) Then resp = MsgBox("Overwrite?" & vbLf & "Yes = Overwrite old file" & vbLf & "No = Create New Appended File", vbYesNo, "Dxf Rule") If resp = vbYes System.IO.File.Delete( sFname ) MessageBox.Show("Earlier Dxf deleted! ", "Inventor") Else sFname = SETFileFolder & "\" & SETFileName + " [New]" & ".dxf" ' PrintSheet(sheetPath As String, sheetName As String) ' 'Exit here to prevent it from being saved again ' Exit Function End If End If 'Export the DXF and fold the model back up oCompDef.DataIO.WriteDataToFile( sOut, sFname) Dim oSMDef As SheetMetalComponentDefinition oSMDef = oDoc.ComponentDefinition oSMDef.FlatPattern.ExitEdit 'ThisApplication.StatusBarText = "Clint Wilkinson: DXF saved to: " & sFname MessageBox.Show("DXF saved to: " & sFname, "Bazinga!!!! Success!")
Solved! Go to Solution.

