Hosted Families in Teigha BIM

Evgeniy Tikhonov

December 12, 2017

A family can be created using a family template that corresponds to the type of element that the family will create.

The template contains the information required to place the family in projects.

Most of the family templates are named according to the type of element family created from them: wall-based, ceiling-based, floor-based, roof-based, line-based, face-based.

Family Template

     Description

Wall-based

Use to create components that will be inserted into walls.

Ceiling-based

Use to create components that will be inserted into ceilings. Examples of ceiling-based families include sprinklers and recessed lighting fixtures.

Floor-based

Use for components that will be inserted into floors.

Roof-based

Use for components that will be inserted into roofs. Examples of roof-based families include skylights and roof fans.

Standalone

Use for components that are not host-dependent. Examples of standalone families include furniture, appliances, ducts, and fittings.

Adaptive

Use to create components that need to flexibly adapt to many unique contextual conditions.

Line-based

The line-based templates can be used to create detail and model families that use 2-pick placement.

Face-based

Use to create work plane-based families that can modify their hosts. Families created from this type of template can make complex cuts in hosts. Instances of these families can be placed on any surface, regardless of their orientation.

Specialty

Use when the family requires unique interaction with the model. These family templates are specific to only one type of family. For example, the Structural Framing template can only be used for creating structural framing content.

Wall-based, ceiling-based, floor-based, and roof-based templates are known as host-based templates. A host-based family can be placed in a project only if an element of its host type is present.

Using the Teigha BIM API, you can determine if a family was created using a wall-, floor-, face-, ceiling- or roof-based template.

The solution for a family that hasn't been instantiated yet is to access the OdBm::BuiltInParameter::FAMILY_HOSTING_BEHAVIOR parameter to get this information. This parameter value is stored as an integer value, and the integer values imply the following about the templates (hosting behavior):

  • Wall-based: 1
  • Floor-based: 2
  • Ceiling-based: 3
  • Roof-based: 4
  • Face-based: 5

The families created using line- and pattern-based templates, however, return an integer value of 0 and cannot be determined using this method.

OdBm::FamilyHosting::Enum is defined to help understand a hosting behavior of a family, for example:

OdBmDatabasePtr pDb = app->readFile(L“some_family.rfa”);
OdBmElementPtr pElem = pDb->getOwnerFamilyId().safeOpenObject();
OdTfVariant vValue;
pElem->getParam(OdBm::BuiltInParameter::FAMILY_HOSTING_BEHAVIOR, vValue);
switch (vValue.getInt32())
{
case OdBm::FamilyHosting::Wall:
  // Wall hosted;
  break;
case OdBm::FamilyHosting::Floor:
  // Floor hosted;
  break;
case OdBm::FamilyHosting::Ceiling:
  // Ceiling hosted
  break;
case OdBm::FamilyHosting::Roof:
  // Roof hosted
  break;
case OdBm::FamilyHosting::Face:
  // Face hosted
  break;
case OdBm::FamilyHosting::NotHosted:
  // NotHosted family;
  break;
default:
  break;
}

The elements that a family contains and references can be accessed by the method OdBmFamily::getReferences(OdArray &).

For example, a face-based family can have the following:

VariantArray References . . . . . . . . . . . . Size: 1

  OdBmFamilyElemRefPtr Item[0]:

    Handle ElementId. . . . . . . . . . . . . . 1537

Where the element with id=1537 is an extrusion.