- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I already have an almost working code to automatically export sheet metal flat patterns to a DWG from the ipt. I'll be using this with other code in the future. The code does the correct file format, the correct autocad version, and the layer options correctly. but it won't take the selections for the other options typically found under the geometry tab of the export options.
SyntaxEditor Code Snippet
Dim oDoc As PartDocument oDoc = ThisApplication.ActiveDocument Dim oCompDef As SheetMetalComponentDefinition oCompDef = oDoc.ComponentDefinition Dim oDataIO As DataIO oDataIO=oDoc.ComponentDefinition.DataIO If oCompDef.HasFlatPattern = False Then oCompDef.Unfold Else oCompDef.FlatPattern.Edit End If Dim sOut As String sOut="FLAT PATTERN DWG?AcadVersion=2000" _ +"&USE CUSTOMISE=No" _ +"&CUSTOMIZE FILE=c:\program files\autodesk\inventor 2016\Design Data\DWG-DXF\FlatPattern.xml" _ +"&BendLines(Front)=IV_BEND;Visibility=On;LineTypeEnum=28100;LineWeight=0.0500;Color=0,0,0" _ +"&BendLines(Back)=IV_BEND_DOWN;&Visibility=On;&LineTypeEnum=28100;&LineWeight=0.0500;&Color=0,0,0" _ +"&OuterProfile=IV_OUTER_PROFILE;&Visibility=On;&LineTypeEnum=28100;&LineWeight=0.0500;&Color=0,0,0" _ +"&InnerProfile=IV_INTERIOR_PROFILES;&Visibility=On;&LineTypeEnum=28100;&LineWeight=0.0500;&Color=0,0,0" _ +"&FeatureProfile(Front)=IV_FEATURE_PROFILES;&Visibility=On;&LineTypeEnum=28100;&LineWeight=0.0500;&Color=0,0,0" _ +"&FeatureProfile(Back)=IV_FEATURE_PROFILES_DOWN;&Visibility=On;&LineTypeEnum=28100;&LineWeight=0.0500;&Color=0,0,0" _ +"&InvisibleLayers=IV_TANGENT;IV_TOOL_CENTER;IV_TOOL_CENTER_DOWN;IV_ARC_CENTERS;IV_ALTREP_FRONT;IV_ALTREP_BACK;IV_UNCONSUMED_SKETCHES;IV_ROLL_TANGENT;IV_ROLL" _ +"REBASE GEOMETRY=No" _ +"MERGE PROFILES=Yes" _ +"REPLACE SPLINE=Yes" _ +"SPLINE SIMPLIFICATION METHOD=Linear" _ +"LINEAR TOLERANCE=0.010" _ +"TRIM CENTERLINES=Yes" Dim sFname As String sFname = oDoc.FullFileName sFname = Left$(sFname, Len(sFname) - 3) & "dwg" oCompDef.DataIO.WriteDataToFile( sOut, sFname)
Like I said, everything else is working fine, it's just the options from REBASE GEOMETRY to TRIM CENTERLINES not being used in the exported file. Do I have these options named correctly? Or do I have to use something other than "=Yes" or "=No" statements?
Thanks so much in advance, I've been spending days to get this right, and this will be a huge time-saver in the future.
P.S. If you want to use this code for DXF export, all you have to do is replace the DWG/dwg references to DXF/dxf, and it will work fine for that too, once I get these option issues worked out.
Solved! Go to Solution.