xBimTeam / XbimGeometry

XbimGeometry contains the CLR interop libraries and the c++ engine used to compute the 3D geometry of models.
https://xbimteam.github.io/
Other
260 stars 132 forks source link

The rotation of somes elements are not applied #304

Open Sim3d opened 3 years ago

Sim3d commented 3 years ago

Hi!

When I load a IFC file (RotatedRoofElements.zip) in the xbim Xplorer (built from source) two roof elements are not rotated as supposed to be. You can see the roof element below:

RotatedRoof

Do you have an idea of what can cause the problem?

Thanks!

Simon

Note:

  1. The IFC file is attached.
  2. The "xbim Xplorer" tool Assemblies are:

Xbim.Common 5.1.0.0 5.1.323.0 Xbim.Geometry.Engine.Interop 5.1.0.0 5.1.403.0 Xbim.Ifc 5.1.0.0 5.1.323.0 Xbim.Ifc2x3 5.1.0.0 5.1.323.0 Xbim.Ifc4 5.1.0.0 5.1.323.0 Xbim.IO.Esent 5.1.0.0 5.1.0.322 Xbim.IO.MemoryModel 5.1.0.0 5.1.323.0 Xbim.ModelGeometry.Scene 5.1.0.1 5.1.403.0 Xbim.Presentation 5.1.0.0 5.1.0.0 Xbim.Tessellator 5.1.0.0 5.1.323.0

martin1cerny commented 3 years ago

Confirmed this is an issue, but it is caused by invalid IFC. This definition is invalid: #79=IFCAXIS2PLACEMENT3D(#80,$,#81);.

IFC documentation states:

Either both, Axis and RefDirection are not given and therefore defaulted, or both shall be given.

But #79 only defines RefDirection without Axis direction (second attribute). This is incomplete definition of placement. We could assume that Axis is simply [0,0,1], but that might be wrong in many cases.

Here is the minimal file: roof_and_wall.zip Here is the file fixed: roof_and_wall_fixed.zip

image

image

Sim3d commented 3 years ago

Thanks for the quick answer Martin!

When I look the definition of the IfcAxis2Placement3D, the RefDirection parameter is optional and the "Attribute definitions" documentation says:

If Axis and/or RefDirection is omitted, these directions are taken from the geometric coordinate system.

So in that case, you can probably fallback on the IfcDirection of the WorldCoordinateSystem (IfcAxis2Placement) given by the IfcGeometricRepresentationContext

#18 = IFCGEOMETRICREPRESENTATIONCONTEXT($, 'Model', 3, 1.E-5, #19, #23);
#19 = IFCAXIS2PLACEMENT3D(#20, #21, #22);
#21 = IFCDIRECTION((0., 0., 1.)); <====

https://standards.buildingsmart.org/IFC/RELEASE/IFC2x2/FINAL/HTML/ifcrepresentationresource/lexical/ifcgeometricrepresentationcontext.html

But maybe i'm wrong?

martin1cerny commented 3 years ago

There is a WHERE rule AxisAndRefDirProvision which says:

Either both, Axis and RefDirection are not given and therefore defaulted, or both shall be given.

And your file is breaking this rule. Therefore it would fail in IFC schema validation.

Sim3d commented 3 years ago

Oh! I see! The IFC documentation is tricky sometimes, sorry.

I tried to load the file into Solibri, Navisworks 2019 and SimpleBIM and all softwares displays the roof element correctly, a rotation is applied as expected... So, would you have any idea of ​​a workaround to apply a rotation on the element like other BIM software?

Thanks!

martin1cerny commented 3 years ago

Yes, this is a simple fallback. We will address it when we get to do some work on geometry engine.

Sim3d commented 3 years ago

Did you have the time to add the simple fallback?