1:在teamcenter中创建零组件对象:直接上方法
TCSession session = (TCSession) AIFUtility.getDefaultSession(); //获取tcsession
public TCComponentItem createItem(TCSession session, String type,String itemID, String itemName, String itemRev) throws TCException {
//type是"Item",itemID是零组件id,itemName是零组件名字,itemRev是零组件版本
TCComponentItemType itemType = (TCComponentItemType) session.getTypeComponent(type);
/根据零组件信息创建零组件对象
TCComponentItem item = itemType.create(itemID,intmRev, type, itemName, "", null);
//item = itemType.find(itemID); //可以根据零组件id查询tc中有没有这个零组件对象
版权声明:本文为CSDN博主「叮当LIU」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/qq_36880602/article/details/78259443
2:在teamcenter中创建BOMLine对象:
public TCComponentBOMLine addBOMLine(TCSession session,
TCComponentItem parentItem, TCComponentItem childrenItem) throws TCException {
//prantItem是父零组件对象,childrenItem是子零组件对象
TCComponentBOMLine bomline = null;
TCComponentBOMWindowType winType = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow");
TCComponentBOMWindow window = winType.create(null);
window.lock();
TCComponentBOMLine topLine = window.setWindowTopLine(parentItem,parentItem.getLatestItemRevision(), null, null);
bomline = topLine.add(childrenItem,childrenItem.getLatestItemRevision(), null, false, "");
topLine.save();
window.save();
window.unlock();
window.close();
return bomline;
}
————————————————
版权声明:本文为CSDN博主「叮当LIU」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_36880602/article/details/78259443