Title: geom.create_shape return wrong shape when enabling opencasecade · Issue #6841 · IfcOpenShell/IfcOpenShell · GitHub
Open Graph Title: geom.create_shape return wrong shape when enabling opencasecade · Issue #6841 · IfcOpenShell/IfcOpenShell
X Title: geom.create_shape return wrong shape when enabling opencasecade · Issue #6841 · IfcOpenShell/IfcOpenShell
Description: Bug Description Problem Description When enabling use-python-opencascade=True, the shapes returned by geom.create_shape are not properly scaled according to the specified IFCCARTESIANTRANSFORMATIONOPERATOR3DNONUNIFORM parameters. Test Ca...
Open Graph Description: Bug Description Problem Description When enabling use-python-opencascade=True, the shapes returned by geom.create_shape are not properly scaled according to the specified IFCCARTESIANTRANSFORMATION...
X Description: Bug Description Problem Description When enabling use-python-opencascade=True, the shapes returned by geom.create_shape are not properly scaled according to the specified IFCCARTESIANTRANSFORMATION...
Opengraph URL: https://github.com/IfcOpenShell/IfcOpenShell/issues/6841
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"geom.create_shape return wrong shape when enabling opencasecade ","articleBody":"### Bug Description\n\n#### Problem Description\nWhen enabling `use-python-opencascade=True`, the shapes returned by `geom.create_shape` are not properly scaled according to the specified `IFCCARTESIANTRANSFORMATIONOPERATOR3DNONUNIFORM` parameters.\n\n#### Test Case\n- Two separate `ifcFurniture` elements, both using `MappedRepresentation`\n- Scaling controlled via `IFCCARTESIANTRANSFORMATIONOPERATOR3DNONUNIFORM` with different axis scales:\n ```lisp\n #43=IFCCARTESIANTRANSFORMATIONOPERATOR3DNONUNIFORM(#44,#45,#46,5.,#47,0.5,1.5);\n #371=IFCCARTESIANTRANSFORMATIONOPERATOR3DNONUNIFORM(#372,#373,#374,2.,#375,1.5,0.1);\n ```\n\n#### Observed Behavior\n**Bounding Box Comparison:**\n> ###### without occ ##########\n> 3LwMwfOAnDEAwH602bjqce\n> x:5.775, y:0.3915, z:0.672\n> 3DRbWjBs1CKANVQn0e_2F9\n> x:4.12, y:0.8250000000000001, z:0.0018000000000000004\n> ######### with occ #########\n> 3LwMwfOAnDEAwH602bjqce\n> x:1.794427082911604, y:1.2164818368041879, z:0.6960203920569151\n> 3DRbWjBs1CKANVQn0e_2F9\n> x:0.36818832307190896, y:0.01205006947489054, z:1.3790320776959828\n\nIt seems that when build occt shapes, the three different scales are not set properly\n\n#### Visual Comparison\n**OCCT Visualization:**\n\u003cimg src=\"https://github.com/user-attachments/assets/44a6acea-d176-4815-a3fe-f60ce666979d\" width=\"400\" />\n\u003cimg src=\"https://github.com/user-attachments/assets/4eead51e-4025-4374-b353-27aadce5af7b\" width=\"400\" />\n\n**Bonsai Visualization:**\n\u003cimg src=\"https://github.com/user-attachments/assets/a02878d6-5ba0-42f1-95f0-013d1f350f38\" width=\"400\" />\n\u003cimg src=\"https://github.com/user-attachments/assets/f26f1136-edee-4dda-bf03-2880352e8c74\" width=\"400\" />\n\n#### Expected Behavior\nThe scaling should be consistently applied across all axes regardless of the backend (OCCT or non-OCCT), matching the specified scaling parameters.\n\n\n\n\n### Attachments\n[ifc file](https://drive.google.com/file/d/1FOF0LONKJk96UTTaEeYNwJZxISYGSuig/view?usp=drive_link)\n```python\nimport ifcopenshell.api.root\nfrom ifcopenshell.util.shape import get_bbox, get_x, get_y, get_z\nfrom OCC.Core.Bnd import Bnd_Box\nfrom OCC.Core.BRepBndLib import brepbndlib\n\ndef build_shape(ifc_element, use_occ):\n # build shape with occt backend\n shape = None\n if ifc_element.Representation:\n settings = ifcopenshell.geom.settings()\n settings.set(\"use-python-opencascade\", use_occ)\n settings.set(\"keep-bounding-boxes\", True)\n try:\n shape = ifcopenshell.geom.create_shape(settings, ifc_element)\n except Exception as e:\n print(f'fail to build shape for elemnet: {ifc_element.GlobalId}, {ifc_element.Name}')\n return shape\n\n\ndef occ_get_bbox(occ_shape):\n bbox = Bnd_Box()\n brepbndlib.Add(occ_shape.geometry, bbox, False)\n xmin, ymin, zmin, xmax, ymax, zmax = bbox.Get()\n return xmax-xmin, ymax-ymin, zmax-zmin\n\n\nfile_path = 'data/test_case.ifc'\n\nifc_file = ifcopenshell.open(file_path)\nfurnitures = ifc_file.by_type('IfcFurniture')\n\nshapes = [build_shape(f, use_occ=False) for f in furnitures]\n\nprint('###### without occ ##########')\nfor shape in shapes:\n print(shape.guid)\n print(f'x:{get_x(shape.geometry)}, y:{get_y(shape.geometry)}, z:{get_z(shape.geometry)}')\n \n \n \nprint('######### with occ #########')\nocc_shapes = [build_shape(f, use_occ=True) for f in furnitures]\n\nfor shape in occ_shapes:\n print(shape.data.guid)\n x, y, z = occ_get_bbox(shape)\n print(f'x:{x}, y:{y}, z:{z}')\n \n \n# visualize occ shapes\nfrom ifcopenshell.geom.occ_utils import initialize_display, display_shape\nfrom OCC.Core.V3d import V3d_TypeOfOrientation \nhandle = initialize_display()\nfor shape in occ_shapes:\n display_shape(shape)\nhandle.FitAll()\nhandle.View.Dump(\"occ_shape_vis.png\")\nhandle.View.SetProj(V3d_TypeOfOrientation.V3d_TypeOfOrientation_Zup_Front)\nhandle.View.Dump(\"occ_shape_vis_front.png\")\n\n``` \n\u003cdetails>\u003csummary>version and environment\u003c/summary>\n\u003cp>\n\nname: /root/env/ifc\nchannels:\n - conda-forge\n - defaults\ndependencies:\n - _libgcc_mutex=0.1=main\n - _openmp_mutex=5.1=1_gnu\n - bzip2=1.0.8=h5eee18b_6\n - ca-certificates=2025.4.26=hbd8a1cb_0\n - font-ttf-dejavu-sans-mono=2.37=hab24e00_0\n - font-ttf-inconsolata=3.000=h77eed37_0\n - font-ttf-source-code-pro=2.038=h77eed37_0\n - font-ttf-ubuntu=0.83=h77eed37_3\n - fontconfig=2.15.0=h7e30c49_1\n - fonts-conda-ecosystem=1=0\n - fonts-conda-forge=1=0\n - freeimage=3.18.0=he1b5a44_0\n - freetype=2.13.3=ha770c72_1\n - ld_impl_linux-64=2.40=h12ee557_0\n - libblas=3.9.0=31_h59b9bed_openblas\n - libcblas=3.9.0=31_he106b2a_openblas\n - libexpat=2.7.0=h5888daf_0\n - libffi=3.4.4=h6a678d5_1\n - libfreetype=2.13.3=ha770c72_1\n - libfreetype6=2.13.3=h48d6fc4_1\n - libgcc=15.1.0=h767d61c_2\n - libgcc-ng=15.1.0=h69a702a_2\n - libgfortran=15.1.0=h69a702a_2\n - libgfortran5=15.1.0=hcea5267_2\n - libgl=1.7.0=ha4b6fd6_2\n - libglvnd=1.7.0=ha4b6fd6_2\n - libglx=1.7.0=ha4b6fd6_2\n - libgomp=15.1.0=h767d61c_2\n - liblapack=3.9.0=31_h7ac8fdf_openblas\n - liblzma=5.8.1=hb9d3cd8_0\n - libnsl=2.0.1=hd590300_0\n - libopenblas=0.3.29=pthreads_h94d23a6_0\n - libpng=1.6.47=h943b412_0\n - libsqlite=3.50.0=hee588c1_0\n - libstdcxx=15.1.0=h8f9b012_2\n - libstdcxx-ng=11.2.0=h1234567_1\n - libuuid=2.38.1=h0b41bf4_0\n - libxcb=1.17.0=h8a09558_0\n - libxcrypt=4.4.36=hd590300_1\n - libzlib=1.3.1=hb9d3cd8_2\n - ncurses=6.5=h2d0b736_3\n - occt=7.9.0=novtk_h09ba48e_103\n - openssl=3.5.0=h7b32b05_1\n - pip=25.0=py310h06a4308_0\n - pthread-stubs=0.4=hb9d3cd8_1002\n - python=3.10.18=hd6af730_0_cpython\n - python_abi=3.10=6_cp310\n - pythonocc-core=7.9.0=novtk_h2ec0fa6_100\n - rapidjson=1.1.0.post20240409=h3f2d84a_2\n - readline=8.2=h5eee18b_0\n - setuptools=75.8.0=py310h06a4308_0\n - svgwrite=1.4.3=pyhd8ed1ab_1\n - tk=8.6.13=noxft_hd72426e_102\n - wheel=0.45.1=py310h06a4308_0\n - xorg-libice=1.1.2=hb9d3cd8_0\n - xorg-libsm=1.2.6=he73a12e_0\n - xorg-libx11=1.8.12=h4f16b4b_0\n - xorg-libxau=1.0.12=hb9d3cd8_0\n - xorg-libxdmcp=1.1.5=hb9d3cd8_0\n - xorg-libxt=1.3.1=hb9d3cd8_0\n - pip:\n - anytree==2.12.1\n - attrs==25.1.0\n - contourpy==1.3.1\n - cycler==0.12.1\n - fonttools==4.55.8\n - ifcopenshell==0.8.2\n - isodate==0.7.2\n - jsonlines==4.0.0\n - kiwisolver==1.4.8\n - lark==1.2.2\n - mathutils==3.3.0\n - matplotlib==3.10.0\n - numpy==2.2.2\n - packaging==24.2\n - pandas==2.2.3\n - pillow==11.1.0\n - pymeshlab==2023.12.post2\n - pyparsing==3.2.1\n - python-dateutil==2.9.0.post0\n - pytz==2025.1\n - scipy==1.15.1\n - shapely==2.0.7\n - six==1.17.0\n - tqdm==4.67.1\n - typing-extensions==4.12.2\n - tzdata==2025.1\nprefix: /root/env/ifc\n\n\n\u003c/p>\n\u003c/details> \n\n### Debug and Error Output\n\n```true\n### output\n> ###### without occ ##########\n> 3LwMwfOAnDEAwH602bjqce\n> x:5.775, y:0.3915, z:0.672\n> 3DRbWjBs1CKANVQn0e_2F9\n> x:4.12, y:0.8250000000000001, z:0.0018000000000000004\n> ######### with occ #########\n> 3LwMwfOAnDEAwH602bjqce\n> x:1.794427082911604, y:1.2164818368041879, z:0.6960203920569151\n> 3DRbWjBs1CKANVQn0e_2F9\n> x:0.36818832307190896, y:0.01205006947489054, z:1.3790320776959828\n```","author":{"url":"https://github.com/duming","@type":"Person","name":"duming"},"datePublished":"2025-06-24T07:12:22Z","url":"https://github.com/IfcOpenShell/IfcOpenShell/issues/6841"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:35ebeb45-cf63-1619-6eba-8649690b262f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E080:340AD5:1C9FD:265BC:6B04C56E |
| html-safe-nonce | 2639760a7d975a930ca9ca0c1bd35ef74277a3145c84dab4d068b3d3b9beea92 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMDgwOjM0MEFENToxQzlGRDoyNjVCQzo2QjA0QzU2RSIsInZpc2l0b3JfaWQiOiI1NjY0MjM0NDEyOTc5NTAwNjIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | d1d023b9ffcb0bd14add49930561a0c575cb554cc6192b3bd956041fc48ff668 |
| hovercard-subject-tag | issue:3170674105 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/IfcOpenShell/IfcOpenShell/6841/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3c7e643b2b57ed08cae0317aa236764b1868aa88020887227c74ac452d917259/IfcOpenShell/IfcOpenShell/issues/6841 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3c7e643b2b57ed08cae0317aa236764b1868aa88020887227c74ac452d917259/IfcOpenShell/IfcOpenShell/issues/6841 |
| og:image:alt | Bug Description Problem Description When enabling use-python-opencascade=True, the shapes returned by geom.create_shape are not properly scaled according to the specified IFCCARTESIANTRANSFORMATION... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | duming |
| hostname | github.com |
| expected-hostname | github.com |
| None | 85dd75377eb77313206b8fc108bcee6a3a029286d94bf32bf9b4426e4d92e0c4 |
| turbo-cache-control | no-preview |
| go-import | github.com/IfcOpenShell/IfcOpenShell git https://github.com/IfcOpenShell/IfcOpenShell.git |
| octolytics-dimension-user_id | 13692563 |
| octolytics-dimension-user_login | IfcOpenShell |
| octolytics-dimension-repository_id | 40473201 |
| octolytics-dimension-repository_nwo | IfcOpenShell/IfcOpenShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 40473201 |
| octolytics-dimension-repository_network_root_nwo | IfcOpenShell/IfcOpenShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 0d64fa748a2bab9a5b587a967ac4da1cfa8da6dd |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width