ODA IFC SDK Developer's Guide > Standard Data Access Interface in IFC SDK > Work with Sets of Instances
Work with Sets of Instances

An .ifc file may contain several application instances of one type. For such cases, SDAI provides an interface that allows you to:

  • Search all instances of a specified type.
  • Manipulate a set of instances of one type, including sequential access to the elements of the set via an iterator object.

To get a set of instances of a specific type, use the sdaiGetEntityExtentBN() function.

To check whether any instance of the specified type is found, call the sdaiGetMemberCount() function. This function returns the quantity of elements in a set.

When you have a non-empty set of instances, you can create an iterator object and then walk through the elements of the set using the following functions:

The following code fragment illustrates how to find all IFCBSPLINECURVEWITHKNOTS instances in a model and iterate through the set of found instances.


SdaiString entityName = "IFCBSPLINECURVEWITHKNOTS";
SdaiSet bsplineInstanceSet = sdaiGetEntityExtentBN(model, entityName);

if (!sdaiGetMemberCount(bsplineInstanceSet))
  return;

SdaiIterator bsplineIterator = sdaiCreateIterator(bsplineInstanceSet);
if (sdaiErrorQuery() != sdaiNO_ERR)
  return;

for (sdaiBeginning(bsplineIterator); sdaiNext(bsplineIterator);)
{
  SdaiInstance instance = NULL;
  sdaiGetAggrByIterator(bsplineIterator, sdaiINSTANCE, &instance);

  SdaiInteger instanceId = _sdaiGetEntityId(instance);

  if (sdaiErrorQuery() != sdaiNO_ERR)
    return;
}
    

See Also

Standard Data Access Interface Error Handling

Work with Attributes

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