Create BOM links with user BOM properties

Create BOM links with user BOM properties

marina.collet
Advocate Advocate
396 Views
1 Reply
Message 1 of 2

Create BOM links with user BOM properties

marina.collet
Advocate
Advocate

I want to create BOM links in a Vault where I have custom BOM properties.

I have 3 such BOM UDPs which need to be filled ion when creating a BOM link: two are booleans and one is numeric.

 

I managed to create the items, create the BOM links with the default properties filled in, but I can't get my custom properties to get values in. Neither upon link creation nor in updating it...

 

Any help would be highly appreciated!

 

Here's my code:

            ACW.ItemAssocParam[] assocParams = new ACW.ItemAssocParam[childItems.Count()];

            long[] childItemsIds = new long[childItems.Count()];

            long[] assocIDs = new long[childItems.Count()];
            int rowOrder = 0;
            foreach (ACW.Item childItem in childItems)
            {
                ACW.ItemAssocParam assocParam = new ACW.ItemAssocParam();
                assocParam.EditAct = ACW.BOMEditAction.Add;
                assocParam.CldItemID = childItem.Id;
                assocParam.Quant = 1;
                assocParam.IsStatic = true;
                assocParam.BOMOrder = rowOrder + 1;
                assocParam.UnitID = 1;

                assocParams[rowOrder] = assocParam;
                childItemsIds[rowOrder] = childItem.Id;
                rowOrder++;
            }

            try
            {
                ACW.ItemBOM itemBOM = m_itemSvc.UpdateItemBOMAssociations(parentItem.Id, assocParams, ACW.BOMViewEditOptions.ReturnBOMFragmentsOnEdits);
            }
            catch (Exception e)
            {
                ErrorHandler.HandleError(e);
                m_itemSvc.UndoEditItems(new long[] { parentItem.Id });
            }

            try
            {
                m_itemSvc.UpdateAndCommitItems(new ACW.Item[] { parentItem });
            }
            catch (Exception e2)
            {
                ErrorHandler.HandleError(e2);
                m_itemSvc.UndoEditItems(new long[] { parentItem.Id });
            }
0 Likes
397 Views
1 Reply
Reply (1)
Message 2 of 2

wayne.brill
Collaborator
Collaborator

Hi Marina,

 

The code example is not showing where parentItem is instantiated. Maybe the discussion about  EditItems() in this post will help:

 

http://adndevblog.typepad.com/manufacturing/2014/06/change-row-order-of-item-in-a-bom-vault-2015-exa...

 

If this does not help upload a small but complete example I can use to recreate the problem.  (let me know if you want to send it to me directly)

 

Thanks,

Wayne



Wayne Brill
Developer Technical Services
Autodesk Developer Network

0 Likes