IFC import

This forum section is only for IFC-related issues
cadgiru
Posts: 82
Joined: Thu Oct 27, 2016 9:53 am
Location: Norway
Contact:

IFC import

Postby cadgiru » Mon Jan 28, 2019 9:09 am

Hi all
Not sure if this should be posted here, but here goes:

All my Linux machines are based on Ubuntu, they all give this error while importing:
utfFC.png
utfFC.png (16.14 KiB) Viewed 454 times
Currently I am setting up a new machine, a Dell Precision 3250.

It has windows 10 pro as installed OS.

I am in the process of installing Linux as my second OS. Linux is my preferred.

My testing of freecad is mainly centered around IFC workflow.

Can any of You please guide me to which:
  • LINUX and freecad version should I install to avoid the above issues?
  • Freecad version for testing IFC on Windows
The IFC import issue has bothered me for a long time, so any advice would be much appreciated

Best regards
User avatar
yorik
Site Admin
Posts: 11263
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: IFC import

Postby yorik » Mon Jan 28, 2019 2:39 pm

This is strange... Can you share the problematic IFC file?
cadgiru
Posts: 82
Joined: Thu Oct 27, 2016 9:53 am
Location: Norway
Contact:

Re: IFC import

Postby cadgiru » Mon Jan 28, 2019 5:28 pm

This is an old problem... Works on windows,
On Ubuntu based machines all ifc files cause the system to hang on import, this goes for both files exported from freecad and from others..
Looks very similar to https://forum.freecadweb.org/viewtopic.php?f=39&t=32158

regards
paullee
Posts: 1539
Joined: Wed May 04, 2016 3:58 pm

Re: IFC import

Postby paullee » Mon Jan 28, 2019 6:30 pm

I think I had reported something similar but can't find it at the moment....

...memory is not good, seems something related to python 2 / 3 and was fixed earlier...


Post your FC details.
paullee
Posts: 1539
Joined: Wed May 04, 2016 3:58 pm

Re: IFC import

Postby paullee » Mon Jan 28, 2019 6:31 pm

Ah yes, UTF related...
User avatar
hhassey
Posts: 133
Joined: Thu Jun 04, 2015 8:01 pm
Location: Ensenada, Mexico

Re: IFC import

Postby hhassey » Tue Feb 12, 2019 11:06 pm

It seems I have the exact same issue. Did you find the solution to this problem?
marzof
Posts: 17
Joined: Sun Apr 23, 2017 5:22 pm

Re: IFC import

Postby marzof » Wed Feb 20, 2019 8:33 am

Hi,

same problem here.
It seems the same reported in:

https://forum.freecadweb.org/viewtopic.php?f=39&t=30451
https://forum.freecadweb.org/viewtopic.php?f=39&t=32158
https://forum.freecadweb.org/viewtopic.php?f=39&t=31163

When I try to import an IFC file (whatever IFC file) FC freeze and I need to kill the application.
If I try without the GUI the issue is located at the importIFC.py mod:

Code: Select all

$ freecadcmd-daily -l
FreeCAD 0.18, Libs: 0.18R15860 (Git)
(c) Juergen Riegel, Werner Mayer, Yorik van Havre 2001-2019
  #####                 ####  ###   #### 
  #                    #      # #   #   #
  #     ##  #### ####  #     #   #  #   #
  ####  # # #  # #  #  #     #####  #   #
  #     #   #### ####  #    #     # #   #
  #     #   #    #     #    #     # #   #  ##  ##  ##
  #     #   #### ####   ### #     # ####   ##  ##  ##

[FreeCAD Console mode <Use Ctrl-D (i.e. EOF) to exit.>]
>>> import importIFC
>>> importIFC.open("test.ifc")
Importing IFC objects......
Traceback (most recent call last):        (25.0 %)   
  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 848, in insert
    a["IfcUID"] = str(guid)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-10: ordinal not in range(128)
>>>
I've just compiled IfcOpenShell using the nix script (https://github.com/IfcOpenShell/IfcOpen ... ild-all.py) and I didn't notice any error during the procedure.

These are my specs:

Code: Select all

OS: Ubuntu 18.04.2 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.15860 (Git)
Build type: Release
Branch: master
Hash: 3b708c7f84b0425076b520e1d95627b20fd75fe0
Python version: 2.7.15rc1
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
I hope someone could help: FC it's an amazing software and I'd like to use it for BIM but it's a pity not to be able to work with IFC
User avatar
bernd
Posts: 7904
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: IFC import

Postby bernd » Wed Feb 20, 2019 9:29 am

two hints from my side ...

- make sure you gone use the same Python (Py2 or Py3) for FreeCAD and IfcOpenShell
- does work ifcopenshell without FreeCAD- there are some ifcfiles in ifcopenshell sources included?

start python or python3

Code: Select all

import ifcopenshell
f = ifcopenshell.open('ifcopenshellsources/test/input/acad2010_objects.ifc')
f.by_type('IfcPerson')
f.by_type('IfcWall')
User avatar
bernd
Posts: 7904
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: IFC import

Postby bernd » Wed Feb 20, 2019 9:32 am

For me on Debian Buster ifc import works on Python 2 and Python 3 with this file https://github.com/aothms/IfcOpenHouse
marzof
Posts: 17
Joined: Sun Apr 23, 2017 5:22 pm

Re: IFC import

Postby marzof » Wed Feb 20, 2019 10:06 am

bernd wrote:
Wed Feb 20, 2019 9:29 am
two hints from my side ...

- make sure you gone use the same Python (Py2 or Py3) for FreeCAD and IfcOpenShell
- does work ifcopenshell without FreeCAD- there are some ifcfiles in ifcopenshell sources included?

start python or python3

Code: Select all

import ifcopenshell
f = ifcopenshell.open('ifcopenshellsources/test/input/acad2010_objects.ifc')
f.by_type('IfcPerson')
f.by_type('IfcWall')
Yes, ifcopenshell works both on python2 and python3

Code: Select all

$:~/Documents$ python
Python 2.7.15rc1 (default, Nov 12 2018, 14:31:15) 
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ifcopenshell
>>> f = ifcopenshell.open('lamp.ifc')
>>> f.by_type('IfcPerson')
[#4=IfcPerson($,'Maros','János',$,$,$,$,$)]
>>> g = ifcopenshell.open('wall.ifc')
>>> g.by_type('IfcWall')
[#36=IfcWall('3Y30_eCwGHwPsPuDLUGSGJ',#5,'Wall','',$,#33,#35,$)]
>>> 
$:~/Documents$ python3
Python 3.6.7 (default, Oct 22 2018, 11:32:17) 
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ifcopenshell
>>> f = ifcopenshell.open('lamp.ifc')
>>> f.by_type('IfcPerson')
[#4=IfcPerson($,'Maros','János',$,$,$,$,$)]
>>> g = ifcopenshell.open('wall.ifc')
>>> g.by_type('IfcWall')
[#36=IfcWall('3Y30_eCwGHwPsPuDLUGSGJ',#5,'Wall','',$,#33,#35,$)]
>>> 
The lamp.ifc file is a lamp I downloaded from https://www.bimobject.com
The wall.ifc file (attached) is just a wall I modeled in freecad.
Both the files are imported without problem on Blender with the ifcblender addon
Attachments
wall.ifc
(2.54 KiB) Downloaded 7 times