本文介绍了如何从几何组合中添加和删除元素。
FamilyGeomCombination 元素实现几何组合,并包含一组 GenSweep 派生元素(例如,拉伸、扫掠、放样)。
向组合添加元素
要向组合添加实体形式,请使用相应的 addSolidGeomToCombination() 方法:
OdResult addSolidGeomToCombination(const OdBmObjectId& id);
此处,id 是实体 GenSweep 元素的标识符。
要向组合添加空心形式,请使用 addVoidGeomToCombination() 方法:
OdResult addVoidGeomToCombination(const OdBmObjectId& id, const OdBmObjectId& solidId);
此处,id 是空心 GenSweep 元素的标识符,solidId 是组合中现有实体 GenSweep 元素的标识符。
从组合中删除元素
要从组合中移除实体形式,请使用相应的 removeSolidGeomFromCombination() 方法:
OdResult removeSolidGeomFromCombination(const OdBmObjectId& id);
此处,id 是实体 GenSweep 元素的标识符。
要从组合中移除空洞形式,请使用 removeVoidGeomFromCombination() 方法:
OdResult removeVoidGeomFromCombination(const OdBmObjectId& id, const OdBmObjectId& solidId);
此处,id 是空洞 GenSweep 元素的标识符,solidId 是组合中现有实体 GenSweep 元素的标识符。
示例以下示例可在 Examples/TB_Commands/BmFamilyBooleanCmd.cpp 文件中的 _BmFormsJoin_func() 函数中找到。
OdBmFamilyGeomCombinationPtr pFamilyGeomCombination = OdBmFamilyGeomCombination::createObject();
ODBM_TRANSACTION_BEGIN(t, pDb)
t.start();
OdBmObjectId idFGC = pDb->addElement(pFamilyGeomCombination);
pFamilyGeomCombination->addSolidGeomToCombination(genSweep1);
pFamilyGeomCombination->addSolidGeomToCombination(genSweep2);
t.commit();
ODBM_TRANSACTION_END()