Message 1 of 3
Need to Assign BOM Structure data for Children in Assembly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a rule where I use to edit part numbers in assembly.
I also need to assign the BOM structure data: but this part (to assign BOM structure) is not right.
I request some one help me get this rule fixed.
Sub main
Dim oAsmDoc As AssemblyDocument
oAsmDoc = ThisApplication.ActiveDocument
Dim oDoc As Document
Dim oRefFile As FileDescriptor
Dim xx As Integer = 1
For Each oDoc In oAsmDoc.AllReferencedDocuments
' Dim oDoc As Document = ThisApplication.ActiveDocument
oDoc.DisplayName = ""
oDT_PropSet = oDoc.PropertySets.Item("Design Tracking Properties")
'oSI_PropSet = docFile.PropertySets.Item("Inventor Summary Information")
'oDSI_PropSet = docFile.PropertySets.Item("Inventor Document Summary Information")
'oUD_PropSet = docFile.PropertySets.Item("Inventor User Defined Properties")
oPN_Doc = oDT_PropSet.Item("Part Number").Value
Dim oPN_List As New ArrayList
oPN_List.Add(oPN_Doc) 'oDT_PropSet.Item("Part Number").Value)
oLFN = oDoc.DisplayName '(False)
'oFFN = oDoc.FullfileName(True) '(False)
'specify word splitting characters "space" and "dash"
Dim Separators() As Char = {" "c, "-"c, "."c}
Sentence = oLFN
Words = Sentence.Split(Separators)
i = 0
For Each wrd In Words
If Words(i) = "ipt" Then
Else If Words(i) = "iam" Then
Else
oPN_List.Add(Words(i))
End If
'MessageBox.Show("Word Index #" & i & " = " & Words(i))
i += 1
Next
'oPN_List.Add("Other")
oPN_List.Add("Exit")
L_oPN_X:
oPN_X = InputListBox("Prompt", oPN_List, oPN_Doc, Title := "PART NUMBER", ListName := "Select - Part Number")
If oPN_X = "" Then GoTo L_oPN_X
If oPN_X = "Exit" Then Exit Sub
oPN_X_Edit = InputBox("Edit/Accept", "PART NUMBER", oPN_X)
iProperties.Value(oLFN, "Project", "Part Number") = oPN_X_Edit
Dim oList_BOM_Structure As New ArrayList
oReference = "kReference"
oPhantom = "kPhantom"
oNormal = "kNormal"
oPurchased = "kPurchased"
If oDoc.Document.ComponentDefinition.BOMStructure = BOMStructureEnum.kPurchasedBOMStructure Then oCurrBOM = oPurchased
If oLFN.ComponentDefinition.BOMStructure = BOMStructureEnum.kReferenceBOMStructure Then oCurrBOM = oReference
If oLFN.ComponentDefinition.BOMStructure = BOMStructureEnum.kNormalBOMStructure Then oCurrBOM = oNormal
If oLFN.ComponentDefinition.BOMStructure = BOMStructureEnum.kPhantomBOMStructure Then oCurrBOM = oPhantom
oList_BOM_Structure.Add(oCurrBOM)
oList_BOM_Structure.Add(oReference)
oList_BOM_Structure.Add(oPhantom)
oList_BOM_Structure.Add(oNormal)
oList_BOM_Structure.Add(oPurchased)
oBOM_Structure_Selected = InputListBox("Prompt", oList_BOM_Structure, oList_BOM_Structure(0), Title := "SELECT BOM STRUCTURE", ListName := "BOM STRUCTURE")
If oBOM_Structure_Selected = oReference Then oDoc.Document.ComponentDefinition.BOMStructure = BOMStructureEnum.kReferenceBOMStructure
If oBOM_Structure_Selected = oPhantom Then oDoc.Document.ComponentDefinition.BOMStructure = BOMStructureEnum.kPhantomBOMStructure
If oBOM_Structure_Selected = oNormal Then oDoc.Document.ComponentDefinition.BOMStructure = BOMStructureEnum.kNormalBOMStructure
If oBOM_Structure_Selected = oPurchased Then oDoc.Document.ComponentDefinition.BOMStructure = BOMStructureEnum.kPurchasedBOMStructure
xx += 1
Next oDoc
InventorVb.DocumentUpdate()
iLogicVb.UpdateWhenDone = True
End Sub