Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a code that find all custom properties (Raw Material) . in an assembly and it parts. but I only want to have each properties one time for each unik vaule/ string
I want to create a list of all type of material that are use in the assembly
any go way to do this ?
Class BOMEXport
Shared oMaterial As String
Shared oMaterialName As String
Sub main()
oMaterial = ""
oMaterialName = ""
PossibleIssueReport()
End Sub
Sub PossibleIssueReport()
Row2 = 3
Dim oDoc As AssemblyDocument
oDoc = ThisApplication.ActiveDocument
Dim oBOM As BOM
oBOM = oDoc.ComponentDefinition.BOM
oBOM.StructuredViewEnabled = True
oBOM.StructuredViewFirstLevelOnly = False
oBOM.StructuredViewDelimiter = "."
oBOM.PartsOnlyViewEnabled = True
Dim oBOMView As BOMView
oBOMView = oBOM.BOMViews.Item("Structured")
Call ExportToExcel(oBOMView.BOMRows)
End Sub
Public Function ExportToExcel(brows As BOMRowsEnumerator)
Dim brow As BOMRow
For Each brow In brows
Dim rDoc As Document
rDoc = brow.ComponentDefinitions.Item(1).Document
Dim docPropertySet1 As PropertySet
docPropertySet1 = rDoc.PropertySets.Item("User Defined Properties")
Try
oMaterialName = ""
If docPropertySet1.Item("Raw Material").Value = "3916030054" Then
oMaterialName = "RHP 50x30x4"
End If
If docPropertySet1.Item("Raw Material").Value = "3916050106" Then
oMaterialName = "RHP 100x50x6"
End If
oMaterial = (oMaterial + vbLf + docPropertySet1.Item("Raw Material").Value) + " " + oMaterialName
Catch
End Try
Next
msgbox (oMaterial)
End Function
End Class
Solved! Go to Solution.