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

ifcclash fcl dependency not available for python 3.8 #919

Closed
CyrilWaechter opened this issue Jul 19, 2020 · 9 comments
Closed

ifcclash fcl dependency not available for python 3.8 #919

CyrilWaechter opened this issue Jul 19, 2020 · 9 comments
Labels

Comments

@CyrilWaechter
Copy link
Contributor

I am very much interested in ifcclash but I am a little worried about python-fcl dependency :

On the good side there is 2 PR to port it to fcl 0.6 but they were made in march and april but non have been merged at the moment :

@Moult
Copy link
Contributor

Moult commented Jul 19, 2020

FCL is also not distributed for Mac :(

I wish I had a solution :(

@Moult Moult added the Bonsai label Jul 19, 2020
@CyrilWaechter
Copy link
Contributor Author

For mac you might try to use : https://anaconda.org/jf/python-fcl/files
A build is available for python 3.8 : https://anaconda.org/jf/python-fcl/0.6.0/download/osx-64/python-fcl-0.6.0-py38h39e3cac_1.tar.bz2
I assume it was made by @jf--- whom I saw also around pythonocc, pyOCCT etc…

@Moult
Copy link
Contributor

Moult commented Jul 19, 2020

@CyrilWaechter I'm looking for Python 3.7, since the Python version must match the version used by Blender. But thanks for the link :)

@CyrilWaechter
Copy link
Contributor Author

I have been able to compile python-fcl thanks to DmitryNeverov fork with a small fix DmitryNeverov/python-fcl#1.
It depends on fcl 0.6.1. I used fcl AUR package but fcl is really easy to compile it should be simple to reproduce on any platform.

Can you explain briefly how ifcclash works in blender so I can test if it works without issue ?
I created 2 cubes of class IfcAirTerminal and tried this config :
image
I see a .json file but it apparently without any clash inside.

@Moult
Copy link
Contributor

Moult commented Jul 23, 2020

What you've done looks correct. I have just tested with two files of the default cube and I do indeed get a clash result. The resulting JSON file created by executing IFC clash should look something like the following below. Note that even if there are no clashes, the metadata about name/tolerance/a/b should still be in the JSON file, except that clashes would be a blank dictionary or not exist. If you get a totally empty JSON file, that suggests something else has gone wrong and perhaps investigating the console would help.

[
    {
        "name": "New Clash Set",
        "tolerance": 0.009999999776482582,
        "a": [
            {
                "file": "/home/dion/drive/bim/a.ifc",
                "selector": ".IfcBuildingElementProxy",
                "mode": "i"
            }
        ],
        "b": [
            {
                "file": "/home/dion/drive/bim/b.ifc",
                "selector": ".IfcBuildingElementProxy",
                "mode": "i"
            }
        ],
        "clashes": {
            "0x4qYS0_DAPuPscMo8tRsN-2I1UDajiL3IfFIlUGmbYYK": {
                "a_global_id": "0x4qYS0_DAPuPscMo8tRsN",
                "b_global_id": "2I1UDajiL3IfFIlUGmbYYK",
                "a_ifc_class": "IfcBuildingElementProxy",
                "b_ifc_class": "IfcBuildingElementProxy",
                "a_name": "Cube",
                "b_name": "Cube",
                "normal": [
                    -1.0,
                    0.0,
                    0.0
                ],
                "position": [
                    -1.0,
                    -1.0,
                    1.0
                ],
                "penetration_depth": 2.0
            }
        }
    }
]

@CyrilWaechter
Copy link
Contributor Author

I get result like yours running it from full packaged blender bim addon on windows without issue. Issue apparently comes from a type input change inside fcl.Transform :

python ifcclash.py "/home/cyril/Documents/Blender/clash_test.json" --output="/home/cyril/Documents/Blender/clash_test.json"
Creating collision manager a ...
Loading files a ...
Purging unnecessary elements a ...
Creating collision data for a ...
[#########################                         ]Creating object #84=IfcAirTerminal('1pW0h7YWP4O8PXtP5Xbd1x',$,'Cube',$,$,#75,#83,$,.DIFFUSER.)
ValueError: Buffer dtype mismatch, expected 'double' but got 'float'
Exception ignored in: 'fcl.fcl.numpy_to_mat3d'
Traceback (most recent call last):
  File "/home/cyril/.config/blender/2.83/scripts/addons/blenderbim/libs/site/packages/collision.py", line 195, in add_object
    t = fcl.Transform(transform[:3, :3], transform[:3, 3])
ValueError: Buffer dtype mismatch, expected 'double' but got 'float'
ValueError: Buffer dtype mismatch, expected 'double' but got 'float'
Exception ignored in: 'fcl.fcl.numpy_to_vec3d'
Traceback (most recent call last):
  File "/home/cyril/.config/blender/2.83/scripts/addons/blenderbim/libs/site/packages/collision.py", line 195, in add_object
    t = fcl.Transform(transform[:3, :3], transform[:3, 3])
ValueError: Buffer dtype mismatch, expected 'double' but got 'float'
Creating collision manager b ...
Loading files b ...
Purging unnecessary elements b ...
Creating collision data for b ...
[#########################                         ]Creating object #84=IfcAirTerminal('0_sCMOjkr8hfXc12UIa2AS',$,'Cube',$,$,#75,#83,$,.DIFFUSER.)
ValueError: Buffer dtype mismatch, expected 'double' but got 'float'
Exception ignored in: 'fcl.fcl.numpy_to_mat3d'
Traceback (most recent call last):
  File "/home/cyril/.config/blender/2.83/scripts/addons/blenderbim/libs/site/packages/collision.py", line 195, in add_object
    t = fcl.Transform(transform[:3, :3], transform[:3, 3])
ValueError: Buffer dtype mismatch, expected 'double' but got 'float'
ValueError: Buffer dtype mismatch, expected 'double' but got 'float'
Exception ignored in: 'fcl.fcl.numpy_to_vec3d'
Traceback (most recent call last):
  File "/home/cyril/.config/blender/2.83/scripts/addons/blenderbim/libs/site/packages/collision.py", line 195, in add_object
    t = fcl.Transform(transform[:3, :3], transform[:3, 3])
ValueError: Buffer dtype mismatch, expected 'double' but got 'float'

I don't know numpy a lot. I'll investigate more later.

@aothms
Copy link
Member

aothms commented Jul 25, 2020 via email

CyrilWaechter added a commit to CyrilWaechter/IfcOpenShell that referenced this issue Jul 25, 2020
Credit to @aothms IfcOpenShell#919 
Need testing with python-fc 0.0.12l / fcl 0.5 to make sure it breaks nothing
@CyrilWaechter
Copy link
Contributor Author

From the looks of it, wrapping transform in a numpy.float64() might fix that

@aothms you were absolutely right. Thanks.

Moult pushed a commit that referenced this issue Jul 26, 2020
Credit to @aothms #919 
Need testing with python-fc 0.0.12l / fcl 0.5 to make sure it breaks nothing
@Moult
Copy link
Contributor

Moult commented Aug 15, 2020

Closing bug, as the BlenderBIM Add-on is Python 3.7 based, and so getting fcl distributed for Python 3.8 should be an upstream issue.

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

No branches or pull requests

3 participants