Title: regenerate_wall_representation silently turns a curved wall into a short straight wall · Issue #10062 · IfcOpenShell/IfcOpenShell · GitHub
Open Graph Title: regenerate_wall_representation silently turns a curved wall into a short straight wall · Issue #10062 · IfcOpenShell/IfcOpenShell
X Title: regenerate_wall_representation silently turns a curved wall into a short straight wall · Issue #10062 · IfcOpenShell/IfcOpenShell
Description: Bug Description Versions: IfcOpenShell 0.9.0.post1. util.representation.get_reference_line and api/geometry/regenerate_wall_representation.py are unchanged on master (e58d252). Summary regenerate_wall_representation reads the reference l...
Open Graph Description: Bug Description Versions: IfcOpenShell 0.9.0.post1. util.representation.get_reference_line and api/geometry/regenerate_wall_representation.py are unchanged on master (e58d252). Summary regenerate_w...
X Description: Bug Description Versions: IfcOpenShell 0.9.0.post1. util.representation.get_reference_line and api/geometry/regenerate_wall_representation.py are unchanged on master (e58d252). Summary regenerate_w...
Opengraph URL: https://github.com/IfcOpenShell/IfcOpenShell/issues/10062
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"regenerate_wall_representation silently turns a curved wall into a short straight wall","articleBody":"### Bug Description\n\n**Versions:** IfcOpenShell 0.9.0.post1. `util.representation.get_reference_line` and `api/geometry/regenerate_wall_representation.py` are unchanged on master (e58d252).\n\n### Summary\n`regenerate_wall_representation` reads the reference line through `util.representation.get_reference_line()`. That function only understands an `IfcPolyline` or `IfcIndexedPolyCurve` axis, and it always uses the first two points:\n- With an `IfcTrimmedCurve` (arc) axis, nothing matches, so it falls back to `[(0, 0), (1, 0)]`. The wall becomes a **1 m straight stub**.\n- With an `IfcIndexedPolyCurve` that has an `IfcArcIndex` segment, it uses the arc's start point and mid point as a straight line. The wall becomes **that chord**.\n\nIn both cases the body and the axis are replaced and no warning is given. The function already returns `None` when it does not apply (no layer set), so returning `None` here would fit the existing contract. Bonsai's `tool.Model.recreate_wall()` comments on this flattening and works around it only for its own fillet-corner walls.\n\n### Steps to reproduce\nEach script below builds one `IfcWall` with a 200 mm layer set, a quarter-circle Plan/Axis (R = 3 m) and a matching curved body 3 m high, then calls `regenerate_wall_representation`.\n\n\u003cdetails>\u003csummary>r_arc_wall.py (IfcTrimmedCurve axis)\u003c/summary>\n\n```python\n# Self-contained repro, IfcOpenShell 0.9.0.post1\nimport ifcopenshell, ifcopenshell.api as api, ifcopenshell.util.representation as ur\ndef new_model():\n f = api.run(\"project.create_file\", version=\"IFC4\")\n p = api.run(\"root.create_entity\", f, ifc_class=\"IfcProject\", name=\"P\")\n api.run(\"unit.assign_unit\", f, length={\"is_metric\": True, \"raw\": \"METERS\"})\n m = api.run(\"context.add_context\", f, context_type=\"Model\")\n body = api.run(\"context.add_context\", f, context_type=\"Model\", context_identifier=\"Body\", target_view=\"MODEL_VIEW\", parent=m)\n pl = api.run(\"context.add_context\", f, context_type=\"Plan\")\n axis = api.run(\"context.add_context\", f, context_type=\"Plan\", context_identifier=\"Axis\", target_view=\"GRAPH_VIEW\", parent=pl)\n site = api.run(\"root.create_entity\", f, ifc_class=\"IfcSite\", name=\"S\")\n st = api.run(\"root.create_entity\", f, ifc_class=\"IfcBuildingStorey\", name=\"L0\")\n api.run(\"aggregate.assign_object\", f, products=[site], relating_object=p)\n api.run(\"aggregate.assign_object\", f, products=[st], relating_object=site)\n return f, body, axis, st\ndef layer_type(f, cls, name, t=0.2):\n wt = api.run(\"root.create_entity\", f, ifc_class=cls, name=name)\n ls = api.run(\"material.add_material_set\", f, name=name, set_type=\"IfcMaterialLayerSet\")\n mat = api.run(\"material.add_material\", f, name=\"M\")\n l = api.run(\"material.add_layer\", f, layer_set=ls, material=mat); l.LayerThickness = t\n api.run(\"material.assign_material\", f, products=[wt], material=ls)\n return wt\ndef volume(f, el):\n import ifcopenshell.geom, ifcopenshell.util.shape as us\n s = ifcopenshell.geom.settings()\n sh = ifcopenshell.geom.create_shape(s, el)\n v=us.get_vertices(sh.geometry); import numpy as np; m=np.array(sh.transformation.matrix).reshape(4,4); v=(np.c_[v,np.ones(len(v))]@m.T)[:,:3]\n return us.get_volume(sh.geometry), (v.min(0).tolist(), v.max(0).tolist())\n\n# Curved wall: Plan/Axis = arc (IfcTrimmedCurve on IfcCircle) + layer set usage AXIS2 + body = arc profile extrusion.\nimport sys, math, ifcopenshell, ifcopenshell.api as api\nprint(\"ifcopenshell\", ifcopenshell.version)\nf, body, axis, st = new_model()\nwt = layer_type(f, \"IfcWallType\", \"W200\")\nw = api.run(\"root.create_entity\", f, ifc_class=\"IfcWall\", name=\"curved\")\napi.run(\"type.assign_type\", f, related_objects=[w], relating_type=wt)\napi.run(\"spatial.assign_container\", f, products=[w], relating_structure=st)\napi.run(\"geometry.edit_object_placement\", f, product=w)\n# Arc axis: radius 3, from 0 to 90 deg, centre (0,0)\nR=3.0\ncirc = f.createIfcCircle(f.createIfcAxis2Placement2D(f.createIfcCartesianPoint((0.,0.))), R)\narc = f.createIfcTrimmedCurve(circ, [f.createIfcParameterValue(0.)], [f.createIfcParameterValue(90.)], True, \"PARAMETER\")\napi.run(\"geometry.assign_representation\", f, product=w, representation=f.createIfcShapeRepresentation(axis, \"Axis\", \"Curve2D\", [arc]))\n# body: annulus sector extruded 3 m (made with shapebuilder as a closed composite curve)\nimport ifcopenshell.util.shape_builder as sb\nb = sb.ShapeBuilder(f)\nn=24\nouter=[((R+0.1)*math.cos(math.radians(90*i/n)),(R+0.1)*math.sin(math.radians(90*i/n))) for i in range(n+1)]\ninner=[((R-0.1)*math.cos(math.radians(90*i/n)),(R-0.1)*math.sin(math.radians(90*i/n))) for i in range(n,-1,-1)]\nprof = f.createIfcArbitraryClosedProfileDef(\"AREA\", None, b.polyline(outer+inner, closed=True))\nsolid = b.extrude(prof, 3.0)\napi.run(\"geometry.assign_representation\", f, product=w, representation=b.get_representation(body, [solid]))\nv0, bb0 = volume(f, w)\nprint(\"before regen: volume %.3f m3 bbox %s\" % (v0, [round(x,3) for x in bb0[0]]+[round(x,3) for x in bb0[1]]))\nr = api.run(\"geometry.regenerate_wall_representation\", f, wall=w)\nv1, bb1 = volume(f, w)\nprint(\"after regen : volume %.3f m3 bbox %s\" % (v1, [round(x,3) for x in bb1[0]]+[round(x,3) for x in bb1[1]]))\nax = [r for r in w.Representation.Representations if r.RepresentationIdentifier==\"Axis\"][0]\nprint(\"axis after regen:\", ax.Items[0].is_a(), ax.Items[0])\n```\n\n\u003c/details>\n\n\u003cdetails>\u003csummary>r_arc_wall_indexed.py (IfcIndexedPolyCurve + IfcArcIndex axis)\u003c/summary>\n\n```python\n# Self-contained repro, IfcOpenShell 0.9.0.post1\nimport ifcopenshell, ifcopenshell.api as api, ifcopenshell.util.representation as ur\ndef new_model():\n f = api.run(\"project.create_file\", version=\"IFC4\")\n p = api.run(\"root.create_entity\", f, ifc_class=\"IfcProject\", name=\"P\")\n api.run(\"unit.assign_unit\", f, length={\"is_metric\": True, \"raw\": \"METERS\"})\n m = api.run(\"context.add_context\", f, context_type=\"Model\")\n body = api.run(\"context.add_context\", f, context_type=\"Model\", context_identifier=\"Body\", target_view=\"MODEL_VIEW\", parent=m)\n pl = api.run(\"context.add_context\", f, context_type=\"Plan\")\n axis = api.run(\"context.add_context\", f, context_type=\"Plan\", context_identifier=\"Axis\", target_view=\"GRAPH_VIEW\", parent=pl)\n site = api.run(\"root.create_entity\", f, ifc_class=\"IfcSite\", name=\"S\")\n st = api.run(\"root.create_entity\", f, ifc_class=\"IfcBuildingStorey\", name=\"L0\")\n api.run(\"aggregate.assign_object\", f, products=[site], relating_object=p)\n api.run(\"aggregate.assign_object\", f, products=[st], relating_object=site)\n return f, body, axis, st\ndef layer_type(f, cls, name, t=0.2):\n wt = api.run(\"root.create_entity\", f, ifc_class=cls, name=name)\n ls = api.run(\"material.add_material_set\", f, name=name, set_type=\"IfcMaterialLayerSet\")\n mat = api.run(\"material.add_material\", f, name=\"M\")\n l = api.run(\"material.add_layer\", f, layer_set=ls, material=mat); l.LayerThickness = t\n api.run(\"material.assign_material\", f, products=[wt], material=ls)\n return wt\ndef volume(f, el):\n import ifcopenshell.geom, ifcopenshell.util.shape as us\n s = ifcopenshell.geom.settings()\n sh = ifcopenshell.geom.create_shape(s, el)\n v=us.get_vertices(sh.geometry); import numpy as np; m=np.array(sh.transformation.matrix).reshape(4,4); v=(np.c_[v,np.ones(len(v))]@m.T)[:,:3]\n return us.get_volume(sh.geometry), (v.min(0).tolist(), v.max(0).tolist())\n\n# Curved wall: Plan/Axis = arc (IfcIndexedPolyCurve with one IfcArcIndex segment) + layer set usage AXIS2 + body = arc profile extrusion.\nimport sys, math, ifcopenshell, ifcopenshell.api as api\nprint(\"ifcopenshell\", ifcopenshell.version)\nf, body, axis, st = new_model()\nwt = layer_type(f, \"IfcWallType\", \"W200\")\nw = api.run(\"root.create_entity\", f, ifc_class=\"IfcWall\", name=\"curved\")\napi.run(\"type.assign_type\", f, related_objects=[w], relating_type=wt)\napi.run(\"spatial.assign_container\", f, products=[w], relating_structure=st)\napi.run(\"geometry.edit_object_placement\", f, product=w)\n# Arc axis: radius 3, from 0 to 90 deg, centre (0,0)\nR=3.0\npts = f.createIfcCartesianPointList2D([(R,0.),(R*0.7071067811865476,R*0.7071067811865476),(0.,R)])\narc = f.createIfcIndexedPolyCurve(pts, [f.createIfcArcIndex((1,2,3))], False)\napi.run(\"geometry.assign_representation\", f, product=w, representation=f.createIfcShapeRepresentation(axis, \"Axis\", \"Curve2D\", [arc]))\n# body: annulus sector extruded 3 m (made with shapebuilder as a closed composite curve)\nimport ifcopenshell.util.shape_builder as sb\nb = sb.ShapeBuilder(f)\nn=24\nouter=[((R+0.1)*math.cos(math.radians(90*i/n)),(R+0.1)*math.sin(math.radians(90*i/n))) for i in range(n+1)]\ninner=[((R-0.1)*math.cos(math.radians(90*i/n)),(R-0.1)*math.sin(math.radians(90*i/n))) for i in range(n,-1,-1)]\nprof = f.createIfcArbitraryClosedProfileDef(\"AREA\", None, b.polyline(outer+inner, closed=True))\nsolid = b.extrude(prof, 3.0)\napi.run(\"geometry.assign_representation\", f, product=w, representation=b.get_representation(body, [solid]))\nv0, bb0 = volume(f, w)\nprint(\"before regen: volume %.3f m3 bbox %s\" % (v0, [round(x,3) for x in bb0[0]]+[round(x,3) for x in bb0[1]]))\nr = api.run(\"geometry.regenerate_wall_representation\", f, wall=w)\nv1, bb1 = volume(f, w)\nprint(\"after regen : volume %.3f m3 bbox %s\" % (v1, [round(x,3) for x in bb1[0]]+[round(x,3) for x in bb1[1]]))\nax = [r for r in w.Representation.Representations if r.RepresentationIdentifier==\"Axis\"][0]\nprint(\"axis after regen:\", ax.Items[0].is_a(), ax.Items[0])\n```\n\n\u003c/details>\n\n### Expected\nEither the wall is regenerated along its arc, or the function returns `None` and leaves the representation untouched.\n\n### Actual\n| axis | volume before | volume after | bbox after |\n|---|---|---|---|\n| IfcTrimmedCurve | 2.825 m³ | 0.600 m³ | 1.0 × 0.2 × 3.0 m |\n| IfcIndexedPolyCurve + IfcArcIndex | 2.825 m³ | 0.527 m³ | 0.879 × 0.2 × 3.0 m |\n\n### Suggested fix\nBefore regenerating, check the Plan/Axis item. Unless it is a 2-point `IfcPolyline` or a 2-point `IfcIndexedPolyCurve` without `Segments`, return `None` and log a warning.\n\n### Related, lower priority\nExtra body items are also dropped without a warning. A straight wall whose body has 2 items (the wall plus a pier) loses the pier: 2.880 → 2.400 m³. The docstring mentions this for unregistered clippings, but not for extra items.\n\n\u003cdetails>\u003csummary>r_multi_item.py\u003c/summary>\n\n```python\n# Self-contained repro, IfcOpenShell 0.9.0.post1\nimport ifcopenshell, ifcopenshell.api as api, ifcopenshell.util.representation as ur\ndef new_model():\n f = api.run(\"project.create_file\", version=\"IFC4\")\n p = api.run(\"root.create_entity\", f, ifc_class=\"IfcProject\", name=\"P\")\n api.run(\"unit.assign_unit\", f, length={\"is_metric\": True, \"raw\": \"METERS\"})\n m = api.run(\"context.add_context\", f, context_type=\"Model\")\n body = api.run(\"context.add_context\", f, context_type=\"Model\", context_identifier=\"Body\", target_view=\"MODEL_VIEW\", parent=m)\n pl = api.run(\"context.add_context\", f, context_type=\"Plan\")\n axis = api.run(\"context.add_context\", f, context_type=\"Plan\", context_identifier=\"Axis\", target_view=\"GRAPH_VIEW\", parent=pl)\n site = api.run(\"root.create_entity\", f, ifc_class=\"IfcSite\", name=\"S\")\n st = api.run(\"root.create_entity\", f, ifc_class=\"IfcBuildingStorey\", name=\"L0\")\n api.run(\"aggregate.assign_object\", f, products=[site], relating_object=p)\n api.run(\"aggregate.assign_object\", f, products=[st], relating_object=site)\n return f, body, axis, st\ndef layer_type(f, cls, name, t=0.2):\n wt = api.run(\"root.create_entity\", f, ifc_class=cls, name=name)\n ls = api.run(\"material.add_material_set\", f, name=name, set_type=\"IfcMaterialLayerSet\")\n mat = api.run(\"material.add_material\", f, name=\"M\")\n l = api.run(\"material.add_layer\", f, layer_set=ls, material=mat); l.LayerThickness = t\n api.run(\"material.assign_material\", f, products=[wt], material=ls)\n return wt\ndef volume(f, el):\n import ifcopenshell.geom, ifcopenshell.util.shape as us\n s = ifcopenshell.geom.settings()\n sh = ifcopenshell.geom.create_shape(s, el)\n v=us.get_vertices(sh.geometry); import numpy as np; m=np.array(sh.transformation.matrix).reshape(4,4); v=(np.c_[v,np.ones(len(v))]@m.T)[:,:3]\n return us.get_volume(sh.geometry), (v.min(0).tolist(), v.max(0).tolist())\n\n# Straight layered wall whose Body has 2 items (main extrusion + a separate pier extrusion),\n# Run regenerate_wall_representation.\nimport ifcopenshell, ifcopenshell.api as api, ifcopenshell.util.shape_builder as sb\nprint(\"ifcopenshell\", ifcopenshell.version)\nf, body, axis, st = new_model()\nwt = layer_type(f, \"IfcWallType\", \"W200\")\nw = api.run(\"root.create_entity\", f, ifc_class=\"IfcWall\", name=\"w\")\napi.run(\"type.assign_type\", f, related_objects=[w], relating_type=wt)\napi.run(\"spatial.assign_container\", f, products=[w], relating_structure=st)\napi.run(\"geometry.edit_object_placement\", f, product=w)\nrep = api.run(\"geometry.add_wall_representation\", f, context=body, thickness=0.2, length=4.0, height=3.0)\napi.run(\"geometry.assign_representation\", f, product=w, representation=rep)\napi.run(\"geometry.assign_representation\", f, product=w, representation=api.run(\"geometry.add_axis_representation\", f, context=axis, axis=[(0.,0.),(4.,0.)]))\nb = sb.ShapeBuilder(f)\npier = b.extrude(b.rectangle(size=(0.4,0.4)), 3.0, position=(1.0,0.2,0.))\nrep.Items = list(rep.Items) + [pier]\nprint(\"before: items\", len(rep.Items), \"volume %.3f\" % volume(f, w)[0])\nnew = api.run(\"geometry.regenerate_wall_representation\", f, wall=w)\nprint(\"after regen: items\", len(new.Items), [i.is_a() for i in new.Items], \"volume %.3f\" % volume(f, w)[0])\n```\n\n\u003c/details>\n\nRelated: #487, #5254, #6896 (curved walls in general), PR #8435 (touches `get_reference_line`).\n\n---\n_Generated by [Claude Code](https://claude.ai/code)_\n\n\n### Attachments\n\n_No response_\n\n### Debug and Error Output\n\n```true\n\n```","author":{"url":"https://github.com/h-v-b","@type":"Person","name":"h-v-b"},"datePublished":"2026-10-25T13:34:58Z","url":"https://github.com/IfcOpenShell/IfcOpenShell/issues/10062"}
| 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:0146a44e-5f1f-a57b-b533-2d61684415c0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 96F0:1739C:4B0105:63EF38:6B04BE61 |
| html-safe-nonce | 13961a94fc19869ed7d8d490124da597f769fd55076c069475f824ad57bec451 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NkYwOjE3MzlDOjRCMDEwNTo2M0VGMzg6NkIwNEJFNjEiLCJ2aXNpdG9yX2lkIjoiODUzNjY5MDA2MTk3ODc4NzMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 51e457d2b4c6d7f1bd88be6633d52cb661e3413a1bd0a298c89e514b994fe463 |
| hovercard-subject-tag | issue:6025016494 |
| 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/10062/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5214a78965272d823ac6a8e6321dd6688106cd94a5070bd39c6cf259fd5cfd2a/IfcOpenShell/IfcOpenShell/issues/10062 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5214a78965272d823ac6a8e6321dd6688106cd94a5070bd39c6cf259fd5cfd2a/IfcOpenShell/IfcOpenShell/issues/10062 |
| og:image:alt | Bug Description Versions: IfcOpenShell 0.9.0.post1. util.representation.get_reference_line and api/geometry/regenerate_wall_representation.py are unchanged on master (e58d252). Summary regenerate_w... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | h-v-b |
| 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