Close

Relief for ODA Team in Ukraine

Learn more
ODA BimRv SDK
Work with the FamilyGeomCombination Interface

This article describes how to add and remove elements from a geometric combination.

The OdBmFamilyGeomCombination class has an initialization function that adds a set of elements to a combination:

OdResult set(const OdBmElementPtrArray& aElements);

Objects of classes derived from GenSweep and GeomCombination can be used as combinations. The initialization also checks that the total amount of elements in the collection is at least two and that the elements are combinable.

Add Elements to a Combination

To add a solid form to a combination, use the appropriate addSolidGeomToCombination() method:

OdResult addSolidGeomToCombination(const OdBmObjectId& id);

Here, id is an identifier of a solid GenSweep element.

To add a void form to a combination, use the addVoidGeomToCombination() method:

OdResult addVoidGeomToCombination(const OdBmObjectId& id, const OdBmObjectId& solidId);

Here, id is an identifier of a void GenSweep element, and solidId is an identifier of an existing solid GenSweep element in a combination.

Remove Elements from a Combination

To remove a solid form from a combination, use the appropriate removeSolidGeomFromCombination() method:

OdResult removeSolidGeomFromCombination(const OdBmObjectId& id);

Here, id is an identifier of a solid GenSweep element.

To remove a void form from a combination, use the removeVoidGeomFromCombination() method:

OdResult removeVoidGeomFromCombination(const OdBmObjectId& id, const OdBmObjectId& solidId);

Here, id is an identifier of a void GenSweep element, and solidId is an identifier of an existing solid GenSweep element in a combination.

Example

The following example can be found in the _BmFormsJoin_func() function, located in the Examples/TB_Commands/BmFamilyBooleanCmd.cpp file.

ODBM_TRANSACTION_BEGIN(t, pDb)
  t.start();
  OdBmElementPtr pElem1 = genSweep1.safeOpenObject();
  OdBmElementPtr pElem2 = genSweep2.safeOpenObject();
  OdBmElementPtrArray aElements;
  aElements.push_back(pElem1);
  aElements.push_back(pElem2);
  OdBmFamilyGeomCombinationPtr pFamilyGeomCombination = OdBmFamilyGeomCombination::createObject();
  pDb->addElement(pFamilyGeomCombination);
  pFamilyGeomCombination->set(aElements);
  t.commit();
ODBM_TRANSACTION_END()

See Also

Work with Simple Geometric Elements

Copyright © 2002 – 2022. Open Design Alliance. All rights reserved.