2017-07-28 158 views
0

我是Teamcenter富客戶端編程的新手。我試圖弄清楚如何在Teamcenter中指定/提取「BOMView」項目的內容?我正在使用java來達到這個目的,直到現在,我可以使用「AIFComponentContext」和「TCComponent」來獲取Teamcenter中任何其他對象的父/子樹,但不是BOMView ...有沒有人知道如何我可以在子視圖中將項目包括在BOMView中嗎? (目前只能在「Teamcenter-Structure manager」中看到)。我會很感激任何提示,短代碼和幫助。如何提取teamcenter中「BOMView」的內容?

+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); 

希望有幫助。