View Issue Details

IDProjectCategoryView StatusLast Update
0033185Open CASCADEPRODUCTS:IFC Importpublic2022-12-02 06:06
Reporteratychini Assigned Todpasukhi  
PrioritynormalSeverityminor 
Status assignedResolutionopen 
Product VersionUnscheduled 
Target VersionUnscheduled 
Summary0033185: IFC Import - Implement a reader from IFC file into TopoDS_Shape
DescriptionCreate IFCControl package inside TKXDEIFC and a class IFCControl_ShapeReader allowing to transfer IFC file into TopoDS_Shape;
Create a function IfcRead inside XSDRAWIFC.cxx allowing to read ifc file into the shape via the DRAW session.
TagsNo tags attached.
Test case number

Activities

atychini

2022-11-29 15:02

developer   ~0112394

IfcControl_ShapeReader algorithm implemented using IfcGeom::Iterator. It should be initialized with valid Ifc file. Iterator iterates over IfcFile and converts geometric entities into IfcGeom::Element. Element type can be IfcGeom::BRepElement or IfcGeom::TriangulationElement. Element type is based on IteratorSettings::DISABLE_TRIANGULATION.
IfcGeom::Iterator supports parallel processing. You can enable it in the ctor.
You may disable boolean operations if you set BOOLEAN_ATTEMPT_2D = 0, DISABLE_OPENING_SUBTRACTIONS = 1
IfcOpeningElement was skipped inside iteration (do while loop from IFCControl_Reader::transferHelper) because IfcOpenShell converts IfcOpeningElement into independent entity and as a result transferred TopoDS_Shape will have imposed shape in the place where should be a hole. You won't get IfcWindow and IfcDoor contours if IfcOpeningElement skipping wasn't applied



IteratorSettings description:
* CONVERT_BACK_UNITS (default = 0); Enables scaling according to IfcFile internal unit. It is applying inside IfcGeom::Representation::BRep::as_compound
* DISABLE_TRIANGULATION (default = 0); Transfer result will be a TopoDS_Shape. BRepElement can be converted to TriangulationElement with TriangulationElement ctor. If this setting was disabled and you're trying to get BRepElement - exception will be thrown, https://github.com/IfcOpenShell/IfcOpenShell/issues/2080
* USE_WORLD_COORDS (default = 0); Applies placement on the entity



Single element reader can be implemented with:
1. Read IfcFile with lazy_load option
2. Create IfcGeom::Kernel
3. Call IfcFile::instance_by_id(${ENTITY_ID_FROM_IFC_FILE})
4. call IfcGeom::convert(${INSTANCE}) inside try catch construcion



Performance problems:
There are 3 different performance problems on parsing IfcFile using IfcGeom::Iterator:
1. Problem on IfcTriangulatedFaceSet.
IfcOpenShell internal algorithm produces compound of triangular faces. IFCCAFControl_Reader.cxx::convertMeshHelper implements algorithm which produces OCCT triangulation.
2. IfcConnectedFaceSet.
In IFCCAF_ControlReader if IfcConnectedFaceSet has holes - we call internal method from IfcOpenShell convert(IfcConnectedFaceSet). After we are applying sew operation. If entity doesn't have any holes - we use IFCCAFControl_Reader::transferConnectedFaceSet algorithm. (loook at IFCCAFControl_Reader::transferFacetedBrep)
Method convert(IfcConnectedFaceSet) works much slower than transferConnectedFaceSet. (the hottest places are BRepCheck_Analyzer and ShapeFix usages inside IfcGeom::Kernel::create_solid_from_faces)
But when we use IfcGeom::Iterator to transfer IfcFile - internal IfcOpenShell is always called. Thus, to improve performance we should find out if IfcConnectedFaceSet has holes. Where is no efficient solution to do it inside convert(const IfcSchema::IfcConnectedFaceSet) because to find it out you should iterate over the file to find openings and you will lose this information because there's nothing to do with it inside convert method. But there's an easy way to do it without overhead: you should call find_openings(product) from create_brep_for_representation_and_product (this method isn't recursive) and pass the opening existance as a paremeter to convert_shapes(representation, shape). The disadvantage is that this parameter used only one time - inside convert (IfcFacetedBrep)
3. boolean_operation. IfcOpenShell boolean operation algorithm works really slow. Replacing it with IFCCAFControl_Reader algorithm solves the problem. convert (IfcBooleanResult) was also edited.



Detected problems (every file you can find inside occt-tests-data-private):
1. Chanteloup.ifc - slight checkshape differences:
ifcread Chanteloup.ifc:
  Check Count
------------------------------------------------
  Invalid Curve on Surface ................. 208
  Self Intersecting Wire ................... 1
  No Surface ............................... 13148
  Intersecting Wires ....................... 1
  Unorientable Shape ....................... 49
  Not Closed ............................... 2
  Not Connected ............................ 1869
------------------------------------------------
ReadIfc Chanteloup.ifc:
  Check Count
------------------------------------------------
  No Surface ............................... 13420
  Not Connected ............................ 1941
------------------------------------------------
2. MUNICH.ifc, LTURedesign - Some walls containing windows have disappeared. It can be related to IfcConnectedFaceSet problem
ifcread MUNICH.ifc:
  Check Count
------------------------------------------------
  No Surface ............................... 13208
  Not Connected ............................ 2347
------------------------------------------------
ReadIfc MUNICH.ifc:
  Check Count
------------------------------------------------
  No Surface ............................... 27393
  Not Connected ............................ 2367
------------------------------------------------
3. HostPlumb.ifc, HostSprinkle.ifc and LTU* files (every file containing plumbs) - plumbs has invalid corner connections. In case of HostPlumb.ifc HostSprinkle.ifc plumbs view is ill-formed. In case of LTU* files many plumbs are not displaying. It can be tolerance problem.
4. Problem with option CONVERT_BACK_UNITS. If option is enabled and you're reading the file bug32693.ifc - everything looks ok. But if you're reading file LTUAir.ifc, some shape disappears on zoom. If the option is disabled - some elements becomes too slow to be displayed around another elements, but LTUAir.ifc got the contrary result



Resources:
1. Free repository with a lot of simple ifc files: https://gitlab.com/osarch/FreeMVD_WorkFlow
2. Another Ifc file resource is IfcOpenShell/test/data directory. These files were attached to bugs as usual and corresponding bugs were fixed
3. https://github.com/IfcOpenShell/IfcOpenShell/issues
4. https://academy.ifcopenshell.org - collection of IfcOpenShell articles

5. https://openifcviewer.com/

Issue History

Date Modified Username Field Change
2022-10-27 15:03 atychini New Issue
2022-10-27 15:03 atychini Assigned To => atychini
2022-10-27 15:03 atychini Summary IFC Import - Implement a reader from the IFC file into TopoDS_Shape => IFC Import - Implement a reader from IFC file into TopoDS_Shape
2022-10-27 15:03 atychini Status new => assigned
2022-10-31 14:41 atychini Description Updated
2022-11-29 15:02 atychini Note Added: 0112394
2022-12-02 06:06 dpasukhi Assigned To atychini => dpasukhi