[返回博客](/cn/blog) # BimRv SDK：使用 FamilyGeomCombination 接口

Artur Vakhramov 五月 07, 2021 [\#rvt](/cn/blog/tag/rvt) [\#rfa](/cn/blog/tag/rfa) [\#getting started](/cn/blog/tag/getting-started)

<a class="a2a_button_facebook"></a><a class="a2a_button_twitter"></a><a class="a2a_button_linkedin"></a>

本文介绍了如何从几何组合中添加和删除元素。

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()
```

## 今天就开始行动

**免费试用 ODA 软件 60 天。  
无风险，无需信用卡。**

[免费试用](https://www.opendesign.com/cn/free-trial)
