New IFC importer/exporter

This forum section is only for IFC-related issues
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: New IFC importer/exporter

Post by bernd »

yorik wrote:One thing that still needs to be implmented in the git version of ifcopenshell is units handling. At he moment I think everything gets converted to meters, which introduces one more place for imprecision...
The IFCCARTESIANPOINT etc are asumed to be mm. IfcConvert does return a shape in mm as well. Since all my models are in meter they all are scaled by 1000 during import.

Ahh may be thats the problem. If IfcOpenShell asumes mm.

Code: Select all

1.645261174599404 mm - 1.644797474203855 mm = 0.0004637003955489938 mm
but in Meters:

Code: Select all

1.645261174599404 m - 1.644797474203855 m = 0.0004637003955489938 m =  0.4637003955489938 mm 
which only is half of a mm, not much in steel structures ...

But still stp is generated by IfcConvert of the same github IfcOpenShell perfectly well ...
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: New IFC importer/exporter

Post by bernd »

import of ifc does not work in ubuntu ppa and self compiled FreeCAD on Debian Jessie since some day in last week!

Code: Select all

opening /home/hugo/Desktop/zBIM-neu/wall-big.ifc...
Traceback (most recent call last):                                                                                                                                      
  File "<string>", line 1, in <module>
  File "/home/hugo/Documents/projekte--ifc/freecad/development/snapshot/free-cad-code/build/Mod/Arch/importIFC.py", line 111, in open
doc = insert(filename,doc.Name,skip)
  File "/home/hugo/Documents/projekte--ifc/freecad/development/snapshot/free-cad-code/build/Mod/Arch/importIFC.py", line 141, in insert
ifcfile = ifcopenshell.open(filename)
  File "/usr/lib/python2.7/dist-packages/ifcopenshell.py", line 100, in open 
return file(ifc_wrapper.open(fn)) if fn else file()<type 'exceptions.TypeError'>: in method 'open', argument 1 of type 'std::string const &'
If in importIFC.py line 141 filname is replaced by the string of the filename ist works for me.

Mhh, there was no commit in Arch over the last few days. Something else has been changed. None of my importIFC.py works anymore ...

OS: Debian GNU/Linux testing (jessie)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.15.4131 (Git)
Branch: [32mmaster[m
Hash: d98f883a7e5ec33265d6c55d63bc3634d6806554
Python version: 2.7.8
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.7.0
User avatar
shoogen
Veteran
Posts: 2823
Joined: Thu Dec 01, 2011 5:24 pm

Re: New IFC importer/exporter

Post by shoogen »

bernd wrote:If in importIFC.py line 141 filname is replaced by the string of the filename ist works for me.

Code: Select all

if isinstance(filename,unicode):
    import sys #workaround since ifcopenshell currently can't handle unicode filenames
    filename=filename.encode(sys.getfilesystemencoding())
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: New IFC importer/exporter

Post by bernd »

shoogen wrote:
bernd wrote:If in importIFC.py line 141 filname is replaced by the string of the filename ist works for me.

Code: Select all

if isinstance(filename,unicode):
    import sys #workaround since ifcopenshell currently can't handle unicode filenames
    filename=filename.encode(sys.getfilesystemencoding())
Ahh unicode filenames ... Thanks Sebastian for the fast workaround. Works very well for me.
User avatar
shoogen
Veteran
Posts: 2823
Joined: Thu Dec 01, 2011 5:24 pm

Re: New IFC importer/exporter

Post by shoogen »

But without ifcopenshell locally installed I'm not able to properly fix this. I don't even understand why there two modules handling IFC.
I created issue #1795, so we don't release 0.15 without having it fixed.
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: New IFC importer/exporter

Post by bernd »

Thanks again for the provided Workaraound. :)
shoogen wrote:But without ifcopenshell locally installed I'm not able to properly fix this. ...
On Linux it is quite straigth foreward to install IfcOpenShell. Since you are compiling FreeCAD yourself all librarys are installed on your machine. Just get the code (https://github.com/aothms/IfcOpenShell), run cmake, make and make install. I had no problems on Debian Jessie and Ubuntu. Just be sure Python 2.x is used if Python 3.x is installed on your machine. Ahh you will be able to view the targets for the mechanical enginieers weapons in FreeCAD then :o

shoogen wrote: I don't even understand why there two modules handling IFC.
I created issue #1795, so we don't release 0.15 without having it fixed.

See first post of this thread. The old importer is still available. viewtopic.php?f=23&t=7222#p58442

Don't know either what would be better, fix in FreeCAD or ask Thomas to fix it in IfcOpenShell but Yorik will for sure come up with something ...
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: New IFC importer/exporter

Post by bernd »

Encountered some new Exception during import of ifc files. I neither know where this comes from nor where to look inside FreeCAD. I don't know when it started to happen (which git commit). I assume in the last 4 weeks. I get lots of this exceptions on ifc files which had no problems earlierer.

Code: Select all

Exception (Tue Nov 25 17:36:42 2014): 'WallStandardCase' is not part of the enumeration 
Exception (Tue Nov 25 17:36:42 2014): 'Stair' is not part of the enumeration 
BTW: Thanks Yorik for adapting the fix of Sebastian regarding Unicode filenames.
Attachments
exception--enumeration.ifc
(54.59 KiB) Downloaded 116 times
User avatar
yorik
Founder
Posts: 13597
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: New IFC importer/exporter

Post by yorik »

Ah indeed. That is because of a change I did, which is that all Arch objects now have a "Role" property. But some of the IFC types don't exist in those properties, so it yields an error, but it doesn't give any trouble. Just a reminder that we need to fix this some day :)

Actually I sopped there becuase I thought, many IFC types have a "standard case" version, like IfcWall. This is so, in your IFC file, you can notify that a certain object meets the requirements they defined to be considered "standard case". In FreeCAD, I thought, since we are cool, we don't need this. Way too manual. FreeCAD should be able to determine if an objects meets certain criteria, and this shouldn't be the job of the user. So I think we should silently convert all WallStandardCase to Wall on import, and on export, if we see the Wall meets the requirement, export it as WallStandardCase, without the user having anything to do.

Well, that's the idea anyway :) Still hadn't much time to implement this...
User avatar
yorik
Founder
Posts: 13597
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: New IFC importer/exporter

Post by yorik »

The IFC importer is now able to import/export IFC properties!
They get stored into the "IfcAttributes" property of Arch objects.
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: New IFC importer/exporter

Post by bernd »

yorik wrote:The IFC importer is now able to import/export IFC properties...
Wow, cool to see this in master. Just some remarks.

- IFCRELDEFINESBYPROPERTIES could be IFCPROPERTYSET or IFCELEMENTQUANTITY. If it is a IFCELEMENTQUANTITY an excetiona is raised.
- For mulilayerwalls the IFCPROPERTYSET is splited in IFCCOMPLEXPROPERTY for each layer. An exception is raised as well.
- Attached an example export of Nemetschek Allplan. my-wall-properties.ifc


- In some cases there could be lots of IFCPROPERTYSET for one object.
- The attached Eckfenster---001.ifc


We need to find a data model inside FreeCADa to store all this properties and propertysets.
Attachments
my-wall-properties.ifc
(10.69 KiB) Downloaded 112 times
Eckfenster--001.ifc
(52.5 KiB) Downloaded 118 times
Post Reply