An .ifc file may contain several application instances of one type. For such cases, SDAI provides an interface that allows you to:
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:
sdaiCreateIterator()
— Create an iterator object
(represented with the SdaiIterator
datatype).
sdaiBeginning()
— Move to the first element of the set.
sdaiNext()
— Get access to the next element of the set.
sdaiGetAggrByIterator()
— Get access to the current element of the set.
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;
}
Standard Data Access Interface Error Handling
Copyright © 2002 – 2021. Open Design Alliance. All rights reserved.
|