Export dxf flat pattern only on Sheet Metal pattern
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everybody,
looking for this forum I found a good iLogic rule to export DXF flat pattern from part; I customized it change something to export in dxf with layers and colors that I want; It's working very well;
-------------------------------------------------------
'Set your filepath here:
SETFilePath = "C:\VaultLocale"
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&RebaseGeometry=True&OuterProfileLayer=0&OuterProfileLayerColor=0;0;0&InteriorProfilesLayer=0&InteriorProfilesLayerColor=0;0;0&BendProfileLayer=0&BendLayerColor=0;100;0&BendLayerLineType=37634&BendDownProfileLayer=0&BendDownLayerColor=0;255;0&BendDownLayerLineType=37634&BendUpProfileLayer=0&BendUpLayerColor=255;255;0&BendUpLayerLineType=37634&InvisibleLayers=IV_ARC_CENTERS;IV_TANGENT;IV_ROLL;IV_ROLL_TANGENT;IV_ALTREP_BACK;IV_ALTREP_FRONT;IV_FEATURE_PROFILES_DOWN;IV_FEATURE_PROFILES;IV_TOOL_CENTER_DOWN;DIGI_MARKER_TOOL_1;DIGI_MARKER_TOOL_2;IV_INNER_PROFILES;"
Dim sFname As String
sFname = SETFilePath & "\" & ThisDoc.FileName(False) & ".dxf"
'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 = "@ClintBrown3D: DXF saved to: " & sFname
MessageBox.Show("DXF saved to: " & sFname, "@ClintBrown3D: Success!")
--------------------------------------------------
I would like to put this rule like an external iLogic rule (I don't want set it inside the sheet metal template) and set a trigger that "before save it" launches this rule so automatically when we save an dxf export is done;
My problem is that on trigger setting I can't make difference from solid and sheet metal part; so when I save solid part without a flat pattern a pop up errore will be display;
Is there a way to put on iLogic rule to activate that rule just when I working in a sheet metal part???
thanks