Cancel
Showing results for 
Search instead for 
Did you mean: 

C# SOA code to create a BOM

Legend
Legend

Hi

 

I have a service that reads incoming xml files and creates item based upon these files.

 

I now need to create a BOM based upon parent child information in these xml files.

I'm struggeling with understanding how to create the SOA BOM calls so I can create a BOM view on the parent and then add the child items I have.

I want to create a precise BOM and if it's possible to assign so the BOM is packed by the code would be great.

 

Can someone guide me with some sample so I at least get the BOM build?

 

Jörgen Mähler, PLM Lead Hydro
TC11.5 | TcIC11.5 | Swim 11.4 | Supplier Collaboration
NX 11,12 | Catia V5 | Solidworks 2018 | AutoCad2018
1 REPLY 1

Re: C# SOA code to create a BOM

Solution Partner Legend Solution Partner Legend
Solution Partner Legend
Hi,

following sample should help you. It's a straightforward call which takes parent and child items as input and creates assembly.

CreateOrUpdateRelativeStructureResponse createRelativeStructure(CreateItemsOutput[] items)
{

CreateOrUpdateRelativeStructureInfo2[] strInfos = new CreateOrUpdateRelativeStructureInfo2[1];
strInfos[0] = new CreateOrUpdateRelativeStructureInfo2();
strInfos[0].Parent = items[0].ItemRev;
strInfos[0].Precise = true;
strInfos[0].ChildInfo = new RelativeStructureChildInfo[items.Length - 1];

System.Collections.Generic.List<RelativeStructureChildInfo> aChildList = new System.Collections.Generic.List<RelativeStructureChildInfo>();

int ii = 0;
foreach (CreateItemsOutput itemOp in items)
{
if (ii == 0)
{
Console.WriteLine("Parent item: " + itemOp.Item.Item_id);
ii++;
continue;
}

strInfos[0].ChildInfo[ii - 1] = new RelativeStructureChildInfo();

strInfos[0].ChildInfo[ii - 1].Child = itemOp.ItemRev;
strInfos[0].ChildInfo[ii - 1].ClientId = itemOp.Item.Item_id + "_" + itemOp.ItemRev.Item_revision_id;
//strInfos[0].ChildInfo[ii - 1].OccInfo = new RelOccInfo();
//strInfos[0].ChildInfo[ii - 1].OccInfo.

ii++;
}

Teamcenter.Services.Strong.Cad.StructureManagementService cadSMS = new Teamcenter.Services.Strong.Cad.StructureManagementRestBindingStub(Teamcenter.ClientX.Session.getConnection());
CreateOrUpdateRelativeStructurePref2 strPref = new CreateOrUpdateRelativeStructurePref2();
//strPref.CadOccIdAttrName = "SD2cax_com";

CreateOrUpdateRelativeStructureResponse aResp = cadSMS.CreateOrUpdateRelativeStructure(strInfos, "view", false, strPref);

return aResp;
}