[Bug] IFC Export not working properly

This forum section is only for IFC-related issues
paullee
Veteran
Posts: 5097
Joined: Wed May 04, 2016 3:58 pm

[Bug] IFC Export not working properly

Post by paullee »

Just test IFC Export, seems something not working properly (again) ? :D

Test_ Ifc_ 01_ ArchWall-Sketch.FCStd
(13.21 KiB) Downloaded 68 times
Test_ Ifc_ 01a_ ArchWall-Sketch.FCStd
(22.55 KiB) Downloaded 67 times
Test_ Ifc_ 01_ ArchWall-Sketch-Wall.ifc
(3.14 KiB) Downloaded 68 times
Test_ Ifc_ 01a_ ArchWall-Sketch-Wall.ifc
(3.53 KiB) Downloaded 67 times
Screenshot from 2022-05-24 08-05-22.png
Screenshot from 2022-05-24 08-05-22.png (314 KiB) Viewed 2331 times
(re-import IFC into FreeCAD)
Screenshot from 2022-05-24 08-06-53.png
Screenshot from 2022-05-24 08-06-53.png (297.86 KiB) Viewed 2331 times
Screenshot from 2022-05-24 08-09-15.png
Screenshot from 2022-05-24 08-09-15.png (104.75 KiB) Viewed 2331 times
Screenshot from 2022-05-24 08-03-20.png
Screenshot from 2022-05-24 08-03-20.png (119.35 KiB) Viewed 2331 times
Screenshot from 2022-05-24 08-03-39.png
Screenshot from 2022-05-24 08-03-39.png (123.21 KiB) Viewed 2331 times

Code: Select all

OS: Fedora 34 (Workstation Edition) (GNOME/gnome)
Word size of FreeCAD: 64-bit
Version: 0.20.28765 (Git)
Build type: Release
Branch: (HEAD detached at 795f86c)
Hash: 795f86c18c22260cfc3627bdd5b71504b9dca4ef
Python 3.9.12, Qt 5.12.9, Coin 4.0.0, OCC 7.5.3
Locale: English/United States (en_US)
Installed mods: 
  * Curves 0.4.3
  * DynamicData 2.46.0
  * Assembly4 0.11.12
  * ArchTextures
Same result in below version -

Code: Select all

OS: Fedora 34 (Workstation Edition) (GNOME/gnome)
Word size of FreeCAD: 64-bit
Version: 0.20.28810 (Git) AppImage
Build type: Release
Branch: (HEAD detached at 6f5a5a2)
Hash: 6f5a5a2019c586db63650713de860d3e810739d4
Python 3.9.12, Qt 5.12.9, Coin 4.0.0, OCC 7.5.3
Locale: English/United States (en_US)
Installed mods: 
  * Curves 0.4.3
  * DynamicData 2.46.0
  * Assembly4 0.11.12
  * ArchTextures
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: [Bug] IFC Export not working properly

Post by yorik »

Seeing the problem too. getExtrusionData() looks OK:
Screenshot from 2022-05-24 11-09-32.png
Screenshot from 2022-05-24 11-09-32.png (68.61 KiB) Viewed 2273 times
The problem is in the code that detects rectangles from faces:
Screenshot from 2022-05-24 11-09-43.png
Screenshot from 2022-05-24 11-09-43.png (159.38 KiB) Viewed 2273 times
https://github.com/FreeCAD/FreeCAD/blob ... C.py#L1942 The rectangles are not properly positioned. Their rotation, however, seem correct. I think the problem is the position (0,0,0) at L1947, actually each subwall should get an offset...
paullee
Veteran
Posts: 5097
Joined: Wed May 04, 2016 3:58 pm

Re: [Bug] IFC Export not working properly

Post by paullee »

Thanks checking.

getExtrusionData() should be fine as ArchWall works without problem. The ExportIFC.py and IFC are just too difficult for me to understand what they work currently. :oops:
User avatar
thomas-neemann
Veteran
Posts: 11801
Joined: Wed Jan 22, 2020 6:03 pm
Location: Osnabrück DE 🇩🇪
Contact:

Re: [Bug] IFC Export not working properly

Post by thomas-neemann »

if someone wants a workaround immediately: create a simple copy in part and export it as an ifc

Test_ Ifc_ 01_ ArchWall-Sketch.ifc
(11.2 KiB) Downloaded 62 times
Bildschirmfoto_2022-05-25_13-06-34.png
Bildschirmfoto_2022-05-25_13-06-34.png (15.53 KiB) Viewed 2183 times
Gruß Dipl.-Ing. (FH) Thomas Neemann

https://www.youtube.com/@thomasneemann5 ... ry=freecad
paullee
Veteran
Posts: 5097
Joined: Wed May 04, 2016 3:58 pm

Re: [Bug] IFC Export not working properly

Post by paullee »

Alternatively, export as Brep also works
paullee
Veteran
Posts: 5097
Joined: Wed May 04, 2016 3:58 pm

Re: [Bug] IFC Export not working properly

Post by paullee »

yorik wrote: Tue May 24, 2022 9:18 am https://github.com/FreeCAD/FreeCAD/blob ... C.py#L1942 The rectangles are not properly positioned. Their rotation, however, seem correct. I think the problem is the position (0,0,0) at L1947, actually each subwall should get an offset...
I dig into some history and find below change -
https://github.com/FreeCAD/FreeCAD/comm ... 9274c70bd1

Code: Select all

+        povc = ifcbin.createIfcCartesianPoint(tuple(p.CenterOfMass[:2]))
-        povc = ifcbin.createIfcCartesianPoint((0.0,0.0))
+        # profile must be located at (0,0) because placement gets added later
+        #povc = ifcbin.createIfcCartesianPoint(tuple(p.CenterOfMass[:2]))
I have no idea the meaning of the previous code, but seems the previous line works ? :)

exportIFC.py
(104.47 KiB) Downloaded 63 times


The new ifc reimported into FreeCAD
Screenshot from 2022-05-27 08-14-57.png
Screenshot from 2022-05-27 08-14-57.png (217.88 KiB) Viewed 2075 times
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: [Bug] IFC Export not working properly

Post by yorik »

The whole thing was -If I remember correctly- to try to make these IfcRectangleProfileDef understood by Revit, which never succeeded. Therefore, in the IFC preferences, there is an option to disable the use of IfcRectangleProfieDef entirely. I think the (0,0) location was needed somewhere... But couldn't remember. In any case, we should test your file with some more apps to make sure.

I just tested it with IFc++, IfcOpenShell viewer and BlenderBIM and all display it correctly... I think we can consider it OK :) Would you mind doing a pull request?
paullee
Veteran
Posts: 5097
Joined: Wed May 04, 2016 3:58 pm

Re: [Bug] IFC Export not working properly

Post by paullee »

OK, I can do the PR ( sort of reverting previous commit ), just I haven't understood how the whole thing works :lol:

And indeed tested that disabling IFCRectangleProfileDef works also - maybe it was why I had my impression it 'used to' work at some point.

Another thing is 'native' IFC support and Sharing Code between Freecad and Blenderbim, there is nothing common in this ExportIFC.py with BlenderBIM right? (I never have time to really install it and test )


Screenshot from 2022-05-28 05-41-15.png
Screenshot from 2022-05-28 05-41-15.png (228.8 KiB) Viewed 1995 times
paullee
Veteran
Posts: 5097
Joined: Wed May 04, 2016 3:58 pm

Re: [Bug] IFC Export not working properly

Post by paullee »

Revisited again [Regression ?] - Villa Savoye Model export problems and noted it had been IFCRectangleProfileDef .

Should we support this, or make it default to Disable IFCRectangleProfileDef to make the FC exported IFC 'universally compatible' ? :roll:


Screenshot from 2022-05-28 07-01-34.png
Screenshot from 2022-05-28 07-01-34.png (242.04 KiB) Viewed 1974 times
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: [Bug] IFC Export not working properly

Post by yorik »

The thing is, IfcRectangleProfileDef is standard IFC. It's Revit's fault to not support it. We shouldn't remove it just to satisfy a bad implementation somewhere. Ok I did it :) git commit 47125d8fda
Post Reply