Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python 2.7 and selfcompiled ifcopenshell #2

Open
berndhahnebach opened this issue Jun 1, 2016 · 4 comments
Open

python 2.7 and selfcompiled ifcopenshell #2

berndhahnebach opened this issue Jun 1, 2016 · 4 comments

Comments

@berndhahnebach
Copy link

berndhahnebach commented Jun 1, 2016

Does pyIfcExtract support python 2.7.x? I try to use pyIfcExtract with python 2.7.9 and self compiled IfcOpenShell on Debian Jessie on commit

commit 4afc568a41c35f59ffd453b51c041e14b2f8aea5
Author: Thomas Krijnen <[email protected]>
Date:   Mon May 30 14:14:45 2016 +0200

    Remove unsupported feature from IfcGeomServer

and got the following error

$ python
Python 2.7.9 (default, Mar  1 2015, 12:57:24) 
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 
>>> import sys
>>> path = '/home/hugo/Documents/dev/pyifcextract/pyIfcExtract-master/'
>>> sys.path.append(path)
>>> import ifc_query
>>> 
>>> 
>>> 
>>> TestFile = '/home/hugo/Documents/projekte--BIM--opendev/freecad--ifc/multilayered_walls/Allplan--mulitlayer_Wall--no_Window.ifc'
>>> f = ifc_query.open(TestFile)
>>> f.IfcProject
<Unbound query 'IfcProject'
  Entities:
  - #5=IfcProject('3nV2gapyiHuxxYT4QWihlb',#4,'zzzz--Ifc-Imports',$,$,$,$,(#11,#38),#42)
>
>>> f.IfcProject.Name
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/hugo/Documents/dev/pyifcextract/pyIfcExtract-master/ifc_query.py", line 162, in __getattr__
    return query(getattr(self.entities, k), "%s.%s"%(self.prefix,k))
  File "/home/hugo/Documents/dev/pyifcextract/pyIfcExtract-master/ifc_query.py", line 156, in __init__
    self.params = query.parameter_list([(self.prefix, v) for v in instances])
  File "/home/hugo/Documents/dev/pyifcextract/pyIfcExtract-master/ifc_query.py", line 62, in __init__
    vector_types = set(getattr(ifcopenshell.ifcopenshell_wrapper, nm) for nm in vector_names)
  File "/home/hugo/Documents/dev/pyifcextract/pyIfcExtract-master/ifc_query.py", line 62, in <genexpr>
    vector_types = set(getattr(ifcopenshell.ifcopenshell_wrapper, nm) for nm in vector_names)
AttributeError: 'module' object has no attribute 'int_vector'
>>> 
>>> 

see thread on FreeCAD forum too http://forum.freecadweb.org/viewtopic.php?f=23&t=15948

kind regards bernd

@aothms
Copy link
Member

aothms commented Jun 3, 2016

It's not the Python version that is the problem. Simply IfcOpenShell has been changed in the mean-time. Usually these changes under the hood are not affecting end-user code dramatically, but in this case, the datatypes for aggregates have changed, breaking the attribute value inspection code in this module. The only real solution is to stick to the IfcOpenShell that is provided in this repository, I don't think I will find the time soon to synchronize this module with contemporary IfcOpenShell.

In case you are curious to dig deeper:

The vector types (https://github.com/DURAARK/pyIfcExtract/blob/master/ifc_query.py#L61) are now all obsolete. So remove these two lines. Then here (https://github.com/DURAARK/pyIfcExtract/blob/master/ifc_query.py#L66) you might be able to simply check for isinstance(val, tuple). This may or may not work and you might run into problems elsewhere using this module with newer version of IfcOpenShell.

@berndhahnebach Bernd, out of curiosity, can I ask why you are interested in this module?

@berndhahnebach
Copy link
Author

berndhahnebach commented Jun 3, 2016

To be honest I'm not really interested in the module. There was a disscussion on FreeCAD forum about the module an some guy tested the module with the ifcopenshell included in FreeCAD and failed. I tried to help and gave it a try too.

Thank you Thomas for the detailed description. What dou you think? The issue should be left open in case someone else comes accross. If someone is really interested the most importand informations why it does not work with uptodate ifcopenshell are just here ...

Meet you at IfcOpenShell forum :-)

kind regards bernd

http://forum.freecadweb.org/viewtopic.php?f=23&t=15948

@aothms
Copy link
Member

aothms commented Jun 3, 2016

If chakkree is interested in making this work and send a PR to make it forward compatible with newer version of IfcOpenShell, I will happily help fix it. Otherwise the 'solution' is to use the bundled version of IfcOpenShell in this repository :)

@chakkreetiya
Copy link

@thomas
Thank you for your description. If ifc_query not using the latest version of ifcopenshell. I would stop testing for used ifc_query on FreeCAD. I will learn to manage ifc data file with ifcopenshell on FreeCAD instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants