Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have this Flat pattern rule. The problem comes with naming. When part does not have a Custom parameter (iQTY), rule does not export DXF.
Can this line be tweaked, so that when iQTY does not exist, it would just insert nothing and export anyway?
Dim oDoc As Document = ThisDoc.Document
'Dim ovnt As String = InputBox("Detalių kiekis", "VNT", "1")
If oDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
Dim oCompDef As SheetMetalComponentDefinition = oDoc.ComponentDefinition
If oCompDef.HasFlatPattern = False Then
oCompDef.Unfold
Else
oCompDef.FlatPattern.Edit
End If
Try
oMaterial = oDoc.ComponentDefinition.Material.Name
oThickness = Round(oDoc.ComponentDefinition.Thickness.Value*10, 2)'Convert cm to inch
oStockNumber = oDoc.PropertySets.Item("Design Tracking Properties").Item("Stock Number").Value
oDescription = oDoc.PropertySets.Item("Design Tracking Properties").Item("Description").Value
oPartNumber = oDoc.PropertySets.Item("Design Tracking Properties").Item("Part Number").Value
iQTY = oDoc.PropertySets.Item("Inventor User Defined Properties").Item("iQTY").Value
Dim oFilename As String = ThisDoc.Path & "\" & oPartNumber & " " & oMaterial & " " & oStockNumber & " " & iQTY & "vnt.dxf"
MessageBox.Show(oFilename)
Dim oDataIO As DataIO = oDoc.ComponentDefinition.DataIO
oDataIO.WriteDataToFile("FLAT PATTERN DXF?AcadVersion=2004&OuterProfileLayer=0&OuterProfileLayerColor=0;0;0&InteriorProfilesLayer=0&InteriorProfilesLayerColor=0;0;0&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;IV_BEND;IV_BEND_DOWN", oFilename)
oCompDef.FlatPattern.ExitEdit
Catch
End Try
End If
Solved! Go to Solution.