-
Notifications
You must be signed in to change notification settings - Fork 139
Description
Description:
I encountered an issue when trying to calculate the geometry of an IFC file using the xBimGeometry libraries Xbim3DModelContext.
The calculation fails on a IFCEXTRUDEDAREASOLID using a IFCRECTANGLEPROFILEDEF because the IFCAXIS2PLACEMENT2D uses a 3D coordinate and a 3D direction.
The buildingSMART IFC Validation Service reports an error on IFCAXIS2PLACEMENT2D, so technically its not a bug, but I've got IFC files containig this error from a customer, who created them using speedikon M 08.11.12 and I need to process them.
Steps to Reproduce
Import the attached ErrorExample.zip with your CreateWexBIM sample (Master branch).
The file was created with xbim and then edited manually to contain the 3D corrdinate and direction.
Expected Behavior:
The IFCAXIS2PLACEMENT2D element should be processed as it was in version 5.x of xBimGeometry
Library Version i.e. Github Tag Name
XbimGeometry_netcore_6.1.801
Additional Information
I patched my fork of xBimGeometry library to accept 3D coordinates and directions when 2D coordinates and directions are expected.
In file Xbim.Geometry.Engine/Factories/GeometryFactory.cpp I changed the functions GeometryFactory::BuildPoint2d and GeometryFactory::BuildDirection2d
before
bool GeometryFactory::BuildPoint2d(IIfcCartesianPoint^ ifcPoint, gp_Pnt2d& pnt2d)
{
if ((int)ifcPoint->Dim == 2)
{
pnt2d.SetXY(gp_XY(ifcPoint->Coordinates[0], ifcPoint->Coordinates[1]));
return true;
}
else
return false;
}
...
bool GeometryFactory::BuildDirection2d(IIfcDirection^ ifcDir, gp_Vec2d& dir2d)
{
if ((int)ifcDir->Dim != 2) return false;
return EXEC_NATIVE->BuildDirection2d(ifcDir->DirectionRatios[0], ifcDir->DirectionRatios[1], dir2d);
}after
bool GeometryFactory::BuildPoint2d(IIfcCartesianPoint^ ifcPoint, gp_Pnt2d& pnt2d)
{
if ((int)ifcPoint->Dim > 1) // fix: "== 2" => "> 1"
{
pnt2d.SetXY(gp_XY(ifcPoint->Coordinates[0], ifcPoint->Coordinates[1]));
return true;
}
else
return false;
}
...
bool GeometryFactory::BuildDirection2d(IIfcDirection^ ifcDir, gp_Vec2d& dir2d)
{
if ((int)ifcDir->Dim < 2) return false; // fix: "!= 2" => "< 2"
return EXEC_NATIVE->BuildDirection2d(ifcDir->DirectionRatios[0], ifcDir->DirectionRatios[1], dir2d);
}