Community
Vault Customization
Share your knowledge, ask questions, and explore popular Vault API, Data Standard, and VBA topics related to programming, creating add-ins, or working with the Vault API.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

BOMComp[] access

0 REPLIES 0
Reply
Message 1 of 1
Jakub.Szymanik
106 Views, 0 Replies

BOMComp[] access

Hello,

 

One question regarding BOMComp[], what is the correct way to get to this? Please look at this function:

 

private void HandleBOMSelection(ISelection oneSelection, Connection oneConnection)
{
    Item selectedItem = oneConnection.WebServiceManager.ItemService.GetItemsByIds(new long[] { oneSelection.Id }).FirstOrDefault();

    ItemBOM itemBom = oneConnection.WebServiceManager.ItemService.GetItemBOMByItemIdAndDate(selectedItem.Id, selectedItem.LastModDate, BOMTyp.Historic, 
                        BOMViewEditOptions.Defaults | BOMViewEditOptions.ReturnOccurrences | BOMViewEditOptions.ReturnUnassignedComponents);

    var itemBomAssocArray = itemBom.ItemAssocArray;
    var itemBomRevArray = itemBom.ItemRevArray;
    var itemBomCompArray = itemBom.BOMCompArray;

    string string_itemBomAssocArray = string.Join("\n", itemBomAssocArray.Select(item => string.Join(", ", item.GetType().GetProperties().Select(prop => $"{prop.Name}: {prop.GetValue(item)}"))));
    string string_itemBomRevArray = string.Join("\n", itemBomRevArray.Select(item => string.Join(", ", item.GetType().GetProperties().Select(prop => $"{prop.Name}: {prop.GetValue(item)}"))));
    string string_itemBomRevArray = string.Join("\n", itemBomCompArray.Select(item => string.Join(", ", item.GetType().GetProperties().Select(prop => $"{prop.Name}: {prop.GetValue(item)}"))));
}
itemBomAssocArray and itemBomRevArray are ok, however itemBomCompArray is null. Why?
0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report