Skip to content

CreateIfcWallAndWriteFile example produces warnings when validating the IFC Schema #301

@yacsha

Description

@yacsha

The CreateIfcWallAndWriteFile example was created using geometry_type=1 and the IFC4 schema an IfcPlusPlus 2.5.

IFC file from the CreateIfcWallAndWriteFile example, after changes were made to remove warnings 1 and 2: example2.5_1_2.zip

int main()
{
	shared_ptr<BuildingModel> ifc_model = shared_ptr<BuildingModel>(new BuildingModel());	
	ifc_model->getIfcSchemaVersionEnumCurrent() = BuildingModel::IFC4;
	LoadWallExample(ifc_model, true, true, 1);
	...
}

When using the IFC Schema validator at https://validate.buildingsmart.org/, for the IFC produced with the previous example, some warnings are obtained, some of which I have corrected and others I have not yet found a solution for, so I would appreciate your suggestions to correct them:

Warning 1:
Image

The above warning was fixed by modifying the following part of the code:

shared_ptr<IfcCartesianPoint> createIfcCartesianPoint(double x, double y, std::vector<shared_ptr<BuildingEntity> >& vec_new_entities)
{
	shared_ptr<IfcCartesianPoint> pt(new IfcCartesianPoint());
	pt->m_Coordinates[0] = x;
	pt->m_Coordinates[1] = y;
	pt->m_Coordinates[2] = std::numeric_limits<double>::quiet_NaN(); // The z coordinate must be set to null so that IFCCARTESIANPOINT is reported with 2 coordinates instead of 3 coordinates (#17=IFCCARTESIANPOINT((5.,0.25,0.) )
	vec_new_entities.push_back(pt);
	return pt;
}

In the code above, the z coordinate must be set to null so that IFCCARTESIANPOINT is reported with 2 coordinates instead of 3. Example of an IfcCartesianPoint with 2 coordinates: #17=IFCCARTESIANPOINT((5.,0.25,0.). Another way would be to implement the default constructor for IfcCartesianPoint so that all coordinates are quiet_NaN by default, but I don't know if this option is viable. This eliminates Warning 1.

Warning 2:

Image

The above warning was fixed by modifying the following part of the code:

// swept area as closed profile:
shared_ptr<IfcArbitraryClosedProfileDef> swept_area(new IfcArbitraryClosedProfileDef());
vec_new_entities.push_back(swept_area);
       
// The IfcProfileTypeEnum of type AREA is assigned, since it is mandatory to always define an IfcProfileTypeEnum for an IfcArbitraryClosedProfileDef
swept_area->m_ProfileType = shared_ptr<IfcProfileTypeEnum>(new IfcProfileTypeEnum());
swept_area->m_ProfileType->m_enum = IfcProfileTypeEnum::IfcProfileTypeEnumEnum::ENUM_AREA;

extruded_solid->m_SweptArea = swept_area;

Warnings I haven't been able to resolve yet:

Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions