When you have a valid instance of the OdIfcFile
class, you can manage the header section and model objects of the IFC database.
To get access to the IFC database header section:
OdDAI::RepositoryPtr pRepository = pDb->getRepository();
OdDAI::OdHeaderSectionPtr headerSection = pRepository->getHeaderSection();
if (headerSection.isNull())
{
ODA_ASSERT(0 && "Header is not valid.");
throw OdError(eNullEntityPointer);
}
headerSection->initialize();
OdDAI::OdFileDescriptionAuto* fileDescription = getHeaderFromSection<OdDAI::OdFileDescriptionAuto, OdDAI::kFileDescription>(headerSection);
OdArray<OdAnsiString> descriptionCollection;
descriptionCollection.push_back("ViewDefinition [CoordinationView]");
fileDescription->setDescriptionAggr(descriptionCollection);
fileDescription->setImplementationLevel("2;1");
OdDAI::OdFileNameAuto* fileName = getHeaderFromSection<OdDAI::OdFileNameAuto, OdDAI::kFileName>(headerSection);
fileName->setName("TestFile.ifc");
fileName->setTimeStamp("2019-02-23T12:17:26");
OdDAI::OdFileSchemaAuto* fileSchema = getHeaderFromSection<OdDAI::OdFileSchemaAuto, OdDAI::kFileSchema>(headerSection);
OdArray<OdAnsiString> schemCollection;
schemCollection.push_back("IFC2X3");
fileSchema->setSchemaIdentifiersAggr(schemCollection);
To proceed with any operation for an IFC model, you need a smart pointer to its object within an IFC database.
To get it, use a model provider object from the OdDAI
interface:
OdDAI::Utils::ModelProviderRO modelProvider(pDb->getRepository());
OdIfc::OdIfcModelPtr model = modelProvider.model<OdIfc::OdIfcModel>();
if (model.isNull() || model->underlyingSchemaName().find("IFC2X3") != 0)
{
ODA_ASSERT(0 && "Model is not valid.");
throw OdError(eNullEntityPointer);
}
Using the smart pointer returned by the model()
method of the repository object, you can work with the IFC model using the OdDAI
interface.
Initialization and Deinitialization.
Library Dependencies of IFC SDK
Basic Concepts of IFC SDK Usage
Copyright © 2002 – 2021. Open Design Alliance. All rights reserved.
|