- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All,
I've been working on a script that finds all the sheet metal in an assembly and generates DXF's from the flat patten. At this almost everything is working correctly. I'm just struggling to get the layers to generate correctly. See the subroutine below I'm using to make the DXF, I've also been through the API Inventor 2022 Help | Translate - Sheet Metal to DXF | Autodesk, and the other forum posts on this subject.
The principle questions I have are;
1. Generally, not sure if the script is working correctly, when I open up a DXF I've made the IV_ARC_CENTERs & IV_TANGENT layers exist, which I thought should have been on the "invisible layer", and not a visible part of the DXF. How do I control which layers are created and which ones aren't
2. Could I have a brief explanation of how lines below sOut = (FLAT PATTERN DXF?)&Acad_Version=2000 _. What's exporting in the flat pattern doesn't seem to match the lines of code, I'm almost wondering if there's an error in what I've done and its ignoring this and creating the dxf from a default template instead?
And assistance would be much appreciated
Kind Regards
Roydon Mackay
Private Sub ExportDXF(CompDef As ComponentDefinition, Directory As String) 'Check if the component is a SheetMetalComponentDefinition If TypeOf CompDef Is SheetMetalComponentDefinition Then Dim SheetMetalCompDef As SheetMetalComponentDefinition = CType(CompDef, SheetMetalComponentDefinition) If SheetMetalCompDef.HasFlatPattern = False Then SheetMetalCompDef.Unfold() Else SheetMetalCompDef.FlatPattern.Edit() End If Dim oDataIO As DataIO oDataIO = SheetMetalCompDef.FlatPattern.DataIO Dim sOut As String Dim PNo As String = SheetMetalCompDef.Document.PropertySets.Item("Design Tracking Properties").Item("Part Number").Value sOut = "FLAT PATTERN DXF?&AcadVersion=2000" _ + "&InvisibleLayers = IV_ARC_CENTERS;IV_FEATURE_PROFILES_DOWN;IV_TANGENT;IV_BEND;IV_BEND_DOWN;IV_FEATURE_PROFILE;IV_ALTREP_FRONT;IV_ALTREP_BACK;IV_ROLL_TANGENT;IV_ROLL" _ + "&OuterProfileLayer=IV_OUTER_PROFILE;IV_INTERIOR_PROFILE&OuterProfileLayerLineType=37633&OuterProfileLayerLineWeight=0.2500&OuterProfileLayerColor=255;255;255" _ + "&BendUpLinesLayer=IV_BEND&BendUp&BendUpLinesLayerLineType=37633&BendUpLinesLayerLineWeight=0.2500&BendUpLinesLayerColor=255;255;0" _ + "&BendDownLinesLayer=IV_BEND_DOWN&BendDown&BendDownLinesLayerLineType=37633&BendDownLinesLayerLineWeight=0.2500&BendDownLinesLayerColor=255;165;0" _ + "&EtchDownLinesLayer=IV_MARKSURFACE;IV_MARK_SURFACE_BACK&EtchDownLinesLayerLineType=37633&EtchDownLinesLayerLineWeight=0.2500&EtchDownLinesLayerColor=255;255;0" oDataIO.WriteDataToFile(sOut, System.IO.Path.Combine(Directory, PNo & ".dxf")) Logger.Info("Generated DXF - " & PNo) Else Logger.Info("Sheet Part is not set as Sheet Metal - " & CompDef.Document.PropertySets.Item("Design Tracking Properties").Item("Part Number").Value) End If End Sub
Solved! Go to Solution.