如何提取" BOMView"的内容?在teamcenter?

时间:2017-07-28 09:57:15

标签: java plugins javadoc

我是Teamcenter富客户端编程的新手。我试图找出如何指示/提取物品的内容?#BOM;" Teamcenter中的项目?我正在使用java这个意图,直到现在我可以使用" AIFComponentContext"和" TCComponent"获取Teamcenter中任何其他对象的父/子树但不是BOMView ...有没有人知道如何将这些项目作为子项包含在BOMView中? (目前只能在" Teamcenter-Structure manager"中看到)。我会很感激任何提示,简短的代码和帮助。

1 个答案:

答案 0 :(得分:0)

我也是TC soa编程的新手。但是你想要做的是使用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);

希望有所帮助。