I have searched the forum. I have not found an answer, so I apologise in advance if I duplicate.
I have an assembly, when automatically exporting to DXF files for some thicknesses it gives the result x.xxxxxxxxxxxxx instead of x.xx. The same part from the IPT file when exported with iLogic shows the correct value of x.xx .
We did not have problems with inventor 2024.
I have included the code I use below.
Thanks in advance for all sugestions.
Private Sub Main()
Dim oDoc As AssemblyDocument = ThisApplication.ActiveDocument
Dim oDef As AssemblyComponentDefinition = oDoc.ComponentDefinition
Dim oBOMView As BOMView = GetBOMpartsOnly(oDef.BOM)
For Each oRow As BOMRow In oBOMView.BOMRows
Dim oRowDef As ComponentDefinition = oRow.ComponentDefinitions.Item(1)
Dim partDoc As PartDocument = oRowDef.Document
If partDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
Dim oCompDef As SheetMetalComponentDefinition = oRow.ComponentDefinitions.Item(1)
Dim oDataIO As DataIO = oDoc.ComponentDefinition.DataIO
If oCompDef.HasFlatPattern=False Then
oCompDef.Unfold
Else
' oCompDef.FlatPattern.Edit
End If
Dim sOut As String = "FLAT PATTERN DWG?AcadVersion=2000" _
+"&InvisibleLayers=IV_TANGENT;IV_BEND;IV_BEND_DOWN;IV_TOOL_CENTER;IV_TOOL_CENTER_DOWN;IV_ARC_CENTERS;IV_FEATURE_PROFILES;IV_UNCONSUMED_SKETCHES;IV_ROLL_TANGENT;IV_ROLL;IV_FEATURE_PROFILES_DOWN" _
+"&SimplifySplines=True" _
+"&LINEAR TOLERANCE=0.010" _
+"&MergeProfilesIntoPolyline=True" _
+"&RebaseGeometry=False" _
+"&TrimCenterlines=True"
Dim invPropSets As PropertySets = partDoc.PropertySets
Dim invPropSet As PropertySet = invPropSets.Item("Design Tracking Properties")
Dim invPartNumiProp As Inventor.Property = invPropSet.Item("Part Number")
Dim dThick As Double = oCompDef.Thickness.Value
Dim iQ As Integer = oRow.TotalQuantity
Dim sName As String = partDoc.DisplayName
Dim sMaterial As String = partDoc.ActiveMaterial.DisplayName
Dim FlatExtentsLength As String = oCompDef.FlatPattern.Length.ToString("0.00") * 10
Dim FlatExtensWidth As String = oCompDef.FlatPattern.Width.ToString("0.00") * 10
Dim sFname As String = ThisDoc.Path & "\" & dThick * 10 & "mm" & "-" & iQ & "stk" & "- -" & sName & " - " & FlatExtentsLength &"x" & FlatExtensWidth & "mm" & " - " & sMaterial &".dxf"
oCompDef.DataIO.WriteDataToFile(sOut,sFname)
oCompDef.FlatPattern.ExitEdit
If partDoc.ComponentDefinition.IsiPartFactory Or
partDoc.ComponentDefinition.IsiPartMember Then
partDoc.Save()
End If
End If
Next
End Sub
Private Function GetBOMpartsOnly(ByVal oBOM As BOM) As BOMView
Dim oLanguageBOM As String
Select Case ThisApplication.LanguageCode
Case "en-US"
oLanguageBOM = "Parts Only"
Case Else
Exit Function
End Select
If oBOM.PartsOnlyViewEnabled = False Then
oBOM.PartsOnlyViewEnabled = True
End If
Return oBOM.BOMViews.Item(oLanguageBOM)
End Function
Solved! Go to Solution.
Solved by nstevelmans. Go to Solution.
Can't find what you're looking for? Ask the community or share your knowledge.