IFC import

This forum section is only for IFC-related issues
User avatar
yorik
Site Admin
Posts: 11585
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: IFC import

Postby yorik » Fri Feb 22, 2019 9:23 pm

marzof wrote:
Wed Feb 20, 2019 8:33 am
File "/usr/lib/freecad-daily/Mod/Arch/importIFC.py", line 848, in insert a["IfcUID"] = str(guid) UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-10: ordinal not in range(128)
This is a really strange error... the GUID of IFC elements is not supposed to contain non-ASCII characters...

I would be curious, if you could edit /usr/lib/freecad-daily/Mod/Arch/importIFC.py, and, just before the problematic line ( line 848, insert a["IfcUID"] = str(guid)), add a line like this:

Code: Select all

print(guid)
and run the import procedure again. So right before the error, we'll see what that guid contains...
marzof
Posts: 17
Joined: Sun Apr 23, 2017 5:22 pm

Re: IFC import

Postby marzof » Sat Feb 23, 2019 8:17 am

This is what I got:

Code: Select all

>>> importIFC.open("wall.ifc")
Importing IFC objects......
����������������򀁇􀁷􀁳񀁵��������򠁇󙖠翈񭋐翈��������
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/freecad-daily/Mod/Arch/importIFC.py", line 373, in open
    doc = insert(filename,doc.Name,skip,only,root)
  File "/usr/lib/freecad-daily/Mod/Arch/importIFC.py", line 849, in insert
    a["IfcUID"] = str(guid)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-10: ordinal not in range(128)
I don't think it's normal...
What was it supposed to be?
User avatar
yorik
Site Admin
Posts: 11585
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: IFC import

Postby yorik » Tue Feb 26, 2019 2:32 pm

Thanks for testing. Indeed this is not normal at all...
Each IFC object has a guid which is a unique text that identifies the object and looks like: 2Hm9JvZjohDNSD2kdxZI3b
It should only contain latin letters or numbers.

If you open the ifc file with a text editor, you'll see that some entities have one, for ex:

Code: Select all

#94= IFCRELDEFINESBYPROPERTIES('2Hm9JvZjohDNSD2kdxZI3b',#25,$,$,(#74),#89);
Apparently your file is okay, and doing it via python only in the console seems to work too... I don't know what could be causing this problem :(

Just as an afterthought, is your FreeCAD in english? If not, can you try by setting it in english, to see if it makes any difference?
marzof
Posts: 17
Joined: Sun Apr 23, 2017 5:22 pm

Re: IFC import

Postby marzof » Tue Feb 26, 2019 3:46 pm

Yes, thanks: my FreeCad is in English as well as the operating system (Ubuntu Gnome) it runs on.

I also installed IFC++ and its viewer works without problems.

I'm going to test it in a windows machine (a virtual one) to check if there is some difference. I'll let you know about it.

I'm so perplexed :?
marzof
Posts: 17
Joined: Sun Apr 23, 2017 5:22 pm

Re: IFC import

Postby marzof » Thu Feb 28, 2019 5:25 pm

HI,
some updates about the issue:

I tried to import an IFC file in a Windows 7 machine. Actually I tried on two machine, a physical one and a virtual one (the last is hosted on Virtual box by one of the two Ubuntu machine I unsuccessfully used until now).

The FreeCAD version I used is the same (0.18.15969) but the result is very different:
  • on the physical machine I had no problem at all: the IFC file has been perfectly imported
  • on the virtual one the object seems correctly imported but as soon as the software load the data the GUI freezes (see the screenshot attached) and force me to kill the application. The console return this message:

Code: Select all

Unhandled Base::Exception caught in GUIApplication::notify.
The error message is: Access violation
Finished importing.
This are the specs for both machines (on the virtual machine I installed the image of the same Windows version):

Code: Select all

OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.15969 (Git)
Build type: Release
Branch: master
Hash: 4765b7e2fe6d3609e9fbf3e3eb6648d7af1dd526
Python version: 2.7.14
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: English/UnitedStates (en_US)
Some suggestion about what to try next?
Attachments
Screenshot from 2019-02-28 17-46-16.png
The loading windows is freezed as well as the working area. Menus, toolbars and other panels seems to work correctly
Screenshot from 2019-02-28 17-46-16.png (101.64 KiB) Viewed 255 times
User avatar
yorik
Site Admin
Posts: 11585
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: IFC import

Postby yorik » Thu Feb 28, 2019 10:18 pm

The last issue is because of bad OpenGL support on virtualbox... IIRC there is an experimental option somewhere to enable 3D inside the VM, but I have never tested...

Still don't know what might be causing your first issue. It's really weird
marzof
Posts: 17
Joined: Sun Apr 23, 2017 5:22 pm

Re: IFC import

Postby marzof » Sun Mar 03, 2019 5:50 pm

Solved!
I needed to recompile ifcopenshell but this time I followed the tutorial published on https://forum.freecadweb.org/viewtopic.php?f=39&t=17536
It's important to note that in step 9 I had to use the version of python 2.7.12u rather than the 2.7.12 (the latter didn't work).

Surely I did something wrong before (now I don't remember exactly but I think I followed the instruction on the ifcopenshell github page), anyway I think that this procedure is not so easy for many people and it would be better if ifcopenshell was bundled somehow in the linux freecad version (for instance I had no problem at all with the windows version where ifcopenshell was immediately working).

Thanks again for your excellent job with freecad!
paullee
Posts: 1842
Joined: Wed May 04, 2016 3:58 pm

Re: IFC import

Postby paullee » Mon Mar 04, 2019 1:16 pm

Just happen I need to recompile and find out exactky the 2.7.12 u forgot in my previous ost :D

Thay u should stand for utf.


Glad you solve it !
User avatar
yorik
Site Admin
Posts: 11585
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: IFC import

Postby yorik » Wed Mar 06, 2019 3:56 pm

Hurray! Glad you had it working.
Indeed ifcopenshell should be more easily usable. But bundling it with FreeCAD is a complex affair, specially on linux..
The best path would be that linux distributions would adopt it. @kkremitzki is working on packaging ifcopenshell for debian I think.. That would be an excellent thing.