【问题标题】:How can I extract the contents of the "BOMView" in teamcenter?如何提取 teamcenter 中“BOMView”的内容?
【发布时间】:2017-07-28 09:57:15
【问题描述】:
我是 Teamcenter 富客户端编程的新手。我想弄清楚如何在 Teamcenter 中指示/提取 BOMView 项目的内容。
我正在使用 Java,例如,到目前为止,我可以使用 AIFComponentContext 和 TCComponent 来获取 Teamcenter 中任何其他对象的父/子树,但不能获取 BOMView...
有谁知道我如何获得 BOMView 的子项? (目前只能在富客户端的“Teamcenter-Structure manager”视图中看到)。
【问题讨论】:
标签:
java
plugins
teamcenter
teamcenter-rac
【解决方案1】:
我想你想用StructureManagementService.CreateBomWindows:
/// <summary>
/// Opens a structure Management BOM Window
/// </summary>
/// <typeparam name="T">BOM window</typeparam>
/// <param name="action">action to do in the BOM window</param>
/// <param name="bomWindowOwner">root node for the BOM window</param>
/// <returns></returns>
public static T OpenBomWindow<T>(Func<CreateBOMWindowsResponse, T> action, ModelObject bomWindowOwner)
{
CreateBOMWindowsResponse windowResponse = TCProgram.StructureManageServiceCad.CreateBOMWindows(new CreateBOMWindowsInfo[]
{
new CreateBOMWindowsInfo()
{
ItemRev = bomWindowOwner as Mstrong.ItemRevision,
Item = bomWindowOwner as Mstrong.Item
}
});
try
{
return action.Invoke(windowResponse);
}
finally
{
TCProgram.StructureManageServiceCad.CloseBOMWindows(windowResponse.Output.Select(x => x.BomWindow).ToArray());
}
}
一旦你有了那个方法,你的声明就会像这样。
OpenBomWindow(
(CreateBOMWindowsResponse bomResponse) =>
{
Mstrong.BOMLine bomLine = bomResponse.Output[0].BomLine;
},
parentItemRev);