Title: 0.9.0 regression: create_shape(settings, product) takes the 'Axis' representation when it is listed before 'Body', and fails (GEO324) · Issue #9771 · IfcOpenShell/IfcOpenShell · GitHub
Open Graph Title: 0.9.0 regression: create_shape(settings, product) takes the 'Axis' representation when it is listed before 'Body', and fails (GEO324) · Issue #9771 · IfcOpenShell/IfcOpenShell
X Title: 0.9.0 regression: create_shape(settings, product) takes the 'Axis' representation when it is listed before 'Body', and fails (GEO324) · Issue #9771 · IfcOpenShell/IfcOpenShell
Description: Bug Description In 0.9.0, when ifcopenshell.geom.create_shape(settings, product) is called without a representation on a product whose Representations list an Axis representation before its Body, create_shape takes the Axis. In the scrip...
Open Graph Description: Bug Description In 0.9.0, when ifcopenshell.geom.create_shape(settings, product) is called without a representation on a product whose Representations list an Axis representation before its Body, c...
X Description: Bug Description In 0.9.0, when ifcopenshell.geom.create_shape(settings, product) is called without a representation on a product whose Representations list an Axis representation before its Body, c...
Opengraph URL: https://github.com/IfcOpenShell/IfcOpenShell/issues/9771
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"0.9.0 regression: create_shape(settings, product) takes the 'Axis' representation when it is listed before 'Body', and fails (GEO324)","articleBody":"### Bug Description\n\nIn 0.9.0, when `ifcopenshell.geom.create_shape(settings, product)` is called without a representation on a product whose `Representations` list an `Axis` representation before its `Body`, `create_shape` takes the Axis. In the script the Axis is a `Curve3D` in an `Axis` subcontext, and the Body a `SweptSolid` in a `Body` subcontext. In that case `create_shape`:\n\n- logs \"[GEO324] Multiple applicable representations found for element, selecting arbitrary\";\n- takes the Axis curve;\n- raises \"Failed to process shape ... representation: ...'Axis','Curve3D'...\".\n\nWith the Body listed first it works, still with the GEO324 warning. 0.8.5 returns the Body in both orders and logs nothing, and the 0.9.0 iterator also takes the Body. Exporters often write several representations per element. In a public sample, the buildingSMART \"Medical-Dental Clinic\" structural model (IFC2X3, a Revit 2011 export post-processed with Solibri IFC Optimizer; BSI (2020) \"Medical-Dental Test Files\", buildingSMART International, CC BY 4.0, https://github.com/buildingsmart-community/Community-Sample-Test-Files/tree/main/IFC%202.3.0.1%20(IFC%202x3)/Medical-Dental%20Clinic), 766 of the 1 078 elements fail this way with 0.9.0 until the Body is passed explicitly: 764 take the Axis, and a stair flight and a ramp flight take their walking line.\n\n**Likely cause** (from the source, not checked with a debugger):\n\n- In 0.8.5, `helper_fn_create_shape` first looked for a representation whose identifier is `Body` or `Facetation` (https://github.com/IfcOpenShell/IfcOpenShell/blob/1c5b825d8ef05ab9d14a15dac12e9eae2f5a37c2/src/ifcwrap/IfcGeomWrapper.i#L906-L917).\n- In 0.9.0 it calls `mapping::representation_of` (https://github.com/IfcOpenShell/IfcOpenShell/blob/8c614fa298c4cba0163762f18ccfe117f45ad730/src/ifcwrap/IfcGeomWrapper.i#L1008). That function collects the representations of the `Model` context and of all its subcontexts, and returns the first one in the product's list (https://github.com/IfcOpenShell/IfcOpenShell/blob/8c614fa298c4cba0163762f18ccfe117f45ad730/src/ifcgeom/mapping/mapping.cpp#L1557-L1616).\n\nTo reproduce, run the script below. It needs only ifcopenshell and builds its own IFC4 and IFC2X3 models in memory. Exit code 1 means the problem reproduces, 0 that it does not, 2 that a control case failed.\n\n\u003cdetails>\n\u003csummary>Script\u003c/summary>\n\n```python\n\"\"\"create_shape(settings, product) without a representation: when a product has an 'Axis' representation\nlisted before its 'Body', the library logs GEO324 \"Multiple applicable representations found for\nelement, selecting arbitrary\", takes the Axis curve and raises \"Failed to process shape\". The geometry\niterator, with the same default settings, selects the Body of the same product.\n\nSelf-contained: builds synthetic IFC4 and IFC2X3 models in memory, needs only `pip install ifcopenshell`.\nExit code: 1 if the defect reproduces, 0 if not, 2 if a control case fails.\n\"\"\"\n\nimport platform\nimport re\nimport sys\nimport uuid\n\nimport ifcopenshell\nimport ifcopenshell.geom\nimport ifcopenshell.guid\n\nVOLUME = 0.3 * 0.5 * 6.0\n_ids = iter(range(1, 10**6))\n\n\ndef guid():\n return ifcopenshell.guid.compress(uuid.UUID(int=next(_ids)).hex)\n\n\ndef build(schema, axis_first):\n f = ifcopenshell.file(schema=schema)\n c = f.create_entity\n\n def pt(*v):\n return c(\"IfcCartesianPoint\", Coordinates=[float(x) for x in v])\n\n origin = c(\"IfcAxis2Placement3D\", Location=pt(0, 0, 0))\n ctx = c(\n \"IfcGeometricRepresentationContext\",\n ContextType=\"Model\",\n CoordinateSpaceDimension=3,\n Precision=1e-5,\n WorldCoordinateSystem=origin,\n )\n body_ctx = c(\n \"IfcGeometricRepresentationSubContext\",\n ContextIdentifier=\"Body\",\n ContextType=\"Model\",\n ParentContext=ctx,\n TargetView=\"MODEL_VIEW\",\n )\n axis_ctx = c(\n \"IfcGeometricRepresentationSubContext\",\n ContextIdentifier=\"Axis\",\n ContextType=\"Model\",\n ParentContext=ctx,\n TargetView=\"GRAPH_VIEW\",\n )\n units = c(\n \"IfcUnitAssignment\",\n Units=[\n c(\"IfcSIUnit\", UnitType=\"LENGTHUNIT\", Name=\"METRE\"),\n c(\"IfcSIUnit\", UnitType=\"PLANEANGLEUNIT\", Name=\"RADIAN\"),\n ],\n )\n c(\"IfcProject\", GlobalId=guid(), Name=\"synthetic\", RepresentationContexts=[ctx], UnitsInContext=units)\n profile = c(\n \"IfcRectangleProfileDef\",\n ProfileType=\"AREA\",\n Position=c(\"IfcAxis2Placement2D\", Location=pt(0, 0)),\n XDim=0.3,\n YDim=0.5,\n )\n solid = c(\n \"IfcExtrudedAreaSolid\",\n SweptArea=profile,\n Position=origin,\n ExtrudedDirection=c(\"IfcDirection\", DirectionRatios=[0.0, 0.0, 1.0]),\n Depth=6.0,\n )\n body = c(\n \"IfcShapeRepresentation\",\n ContextOfItems=body_ctx,\n RepresentationIdentifier=\"Body\",\n RepresentationType=\"SweptSolid\",\n Items=[solid],\n )\n axis = c(\n \"IfcShapeRepresentation\",\n ContextOfItems=axis_ctx,\n RepresentationIdentifier=\"Axis\",\n RepresentationType=\"Curve3D\",\n Items=[c(\"IfcPolyline\", Points=[pt(0, 0, 0), pt(0, 0, 6)])],\n )\n representations = [axis, body] if axis_first else [body, axis]\n column = c(\n \"IfcColumn\",\n GlobalId=guid(),\n Name=\"C1\",\n ObjectPlacement=c(\"IfcLocalPlacement\", RelativePlacement=origin),\n Representation=c(\"IfcProductDefinitionShape\", Representations=representations),\n )\n return f, column, body\n\n\ndef mesh_volume(geometry):\n \"\"\"Divergence-theorem volume of a triangulation, about its first vertex (standard library only).\"\"\"\n v, fc = list(geometry.verts), list(geometry.faces)\n if not fc:\n return None\n ox, oy, oz = v[0], v[1], v[2]\n total = 0.0\n for i in range(0, len(fc), 3):\n (ax, ay, az), (bx, by, bz), (cx, cy, cz) = (\n (v[3 * j] - ox, v[3 * j + 1] - oy, v[3 * j + 2] - oz) for j in fc[i : i + 3]\n )\n total += ax * (by * cz - bz * cy) - ay * (bx * cz - bz * cx) + az * (bx * cy - by * cx)\n return total / 6.0\n\n\ndef log_warnings():\n out = []\n for line in ifcopenshell.get_log().splitlines():\n if line.startswith((\"[warning]\", \"[error]\")) and \"[GEO031]\" not in line:\n parts = [p for p in line.replace(\"] \", \"]\\t\").split(\"\\t\") if not p[1:5].isdigit()]\n out.append(\" \".join(parts).strip())\n return out or \"no warning or error\"\n\n\ndef attempt(call):\n ifcopenshell.get_log() # clear the log\n try:\n shape = call()\n v = mesh_volume(shape.geometry) # keep `shape` alive while its geometry is read\n ok = v is not None and abs(v - VOLUME) \u003c= 1e-9\n return ok, f\"volume {v:.6f}\" if v is not None else \"empty shape\", log_warnings()\n except Exception as exc:\n message = re.sub(r\"IfcColumn\\('[^']*'\", \"IfcColumn(...\", str(exc)) # shorten the product instance\n return False, f\"{type(exc).__name__}: {message}\", log_warnings()\n\n\ndef main():\n print(\n f\"ifcopenshell {ifcopenshell.version} ({ifcopenshell.ifcopenshell_wrapper.version()}), \"\n f\"Python {platform.python_version()}, {platform.system()} {platform.machine()}\"\n )\n settings = ifcopenshell.geom.settings()\n defect = control_failed = False\n for schema in (\"IFC4\", \"IFC2X3\"):\n for axis_first in (True, False):\n f, column, body = build(schema, axis_first)\n order = \"[Axis, Body]\" if axis_first else \"[Body, Axis]\"\n rows = [\n (\n \"create_shape(settings, product)\",\n lambda p=column: ifcopenshell.geom.create_shape(settings, p),\n not axis_first,\n ),\n (\n \"CONTROL create_shape(settings, product, body)\",\n lambda p=column, r=body: ifcopenshell.geom.create_shape(settings, p, r),\n True,\n ),\n ]\n print(f\"\\n{schema}, representations {order}; expected volume {VOLUME:.6f}\")\n for label, call, is_control in rows:\n ok, result, log = attempt(call)\n print(f\" {label:46s} {result:40s} {'OK' if ok else 'WRONG'} log: {log}\")\n if is_control:\n control_failed |= not ok\n else:\n defect |= not ok\n it = ifcopenshell.geom.iterator(settings, f, 1)\n ok = False\n if it.initialize():\n shape = it.get()\n v = mesh_volume(shape.geometry)\n ok = abs(v - VOLUME) \u003c= 1e-9\n label = \"CONTROL iterator(settings, file, 1)\"\n print(f\" {label:46s} {f'volume {v:.6f}':40s} {'OK' if ok else 'WRONG'}\")\n control_failed |= not ok\n print(\"\\nRESULT:\", \"CONTROL FAILED\" if control_failed else (\"DEFECT REPRODUCED\" if defect else \"not reproduced\"))\n return 2 if control_failed else (1 if defect else 0)\n\n\nif __name__ == \"__main__\":\n sys.exit(main())\n```\n\n\u003c/details>\n\nObserved with 0.9.0 (exit code 1):\n\n```\nifcopenshell 0.9.0 (0.9.0alpha0-8c614fa), Python 3.14.7, Windows AMD64\n\nIFC4, representations [Axis, Body]; expected volume 0.900000\n create_shape(settings, product) RuntimeError: Failed to process shape. Product: #22=IfcColumn(...,$,'C1',$,$,#20,#21,$,$), representation: #19=IfcShapeRepresentation(#5,'Axis','Curve3D',(#18)) WRONG log: ['[warning] [GEO324] Multiple applicable representations found for element, selecting arbitrary']\n CONTROL create_shape(settings, product, body) volume 0.900000 OK log: no warning or error\n CONTROL iterator(settings, file, 1) volume 0.900000 OK\n\nIFC4, representations [Body, Axis]; expected volume 0.900000\n create_shape(settings, product) volume 0.900000 OK log: ['[warning] [GEO324] Multiple applicable representations found for element, selecting arbitrary']\n CONTROL create_shape(settings, product, body) volume 0.900000 OK log: no warning or error\n CONTROL iterator(settings, file, 1) volume 0.900000 OK\n\nIFC2X3, representations [Axis, Body]; expected volume 0.900000\n create_shape(settings, product) RuntimeError: Failed to process shape. Product: #22=IfcColumn(...,$,'C1',$,$,#20,#21,$), representation: #19=IfcShapeRepresentation(#5,'Axis','Curve3D',(#18)) WRONG log: ['[warning] [GEO324] Multiple applicable representations found for element, selecting arbitrary']\n CONTROL create_shape(settings, product, body) volume 0.900000 OK log: no warning or error\n CONTROL iterator(settings, file, 1) volume 0.900000 OK\n\nIFC2X3, representations [Body, Axis]; expected volume 0.900000\n create_shape(settings, product) volume 0.900000 OK log: ['[warning] [GEO324] Multiple applicable representations found for element, selecting arbitrary']\n CONTROL create_shape(settings, product, body) volume 0.900000 OK log: no warning or error\n CONTROL iterator(settings, file, 1) volume 0.900000 OK\n\nRESULT: DEFECT REPRODUCED\n```\n\nObserved with 0.8.5 (exit code 0):\n\n```\nifcopenshell 0.8.5 (0.8.5-1c5b825), Python 3.14.7, Windows AMD64\n\nIFC4, representations [Axis, Body]; expected volume 0.900000\n create_shape(settings, product) volume 0.900000 OK log: no warning or error\n CONTROL create_shape(settings, product, body) volume 0.900000 OK log: no warning or error\n CONTROL iterator(settings, file, 1) volume 0.900000 OK\n\nIFC4, representations [Body, Axis]; expected volume 0.900000\n create_shape(settings, product) volume 0.900000 OK log: no warning or error\n CONTROL create_shape(settings, product, body) volume 0.900000 OK log: no warning or error\n CONTROL iterator(settings, file, 1) volume 0.900000 OK\n\nIFC2X3, representations [Axis, Body]; expected volume 0.900000\n create_shape(settings, product) volume 0.900000 OK log: no warning or error\n CONTROL create_shape(settings, product, body) volume 0.900000 OK log: no warning or error\n CONTROL iterator(settings, file, 1) volume 0.900000 OK\n\nIFC2X3, representations [Body, Axis]; expected volume 0.900000\n create_shape(settings, product) volume 0.900000 OK log: no warning or error\n CONTROL create_shape(settings, product, body) volume 0.900000 OK log: no warning or error\n CONTROL iterator(settings, file, 1) volume 0.900000 OK\n\nRESULT: not reproduced\n```\n\n**Expected.** As in 0.8.5 and as the iterator does: the 3D `Body` representation is chosen, whatever the order of the list. Failing that, an error saying that several representations apply, instead of an attempt to build a solid from the Axis curve.\n\n**Workarounds.**\n\n- Pass the representation explicitly.\n- Or, when Axis and Body sit in separate subcontexts identified `Axis` and `Body` (as in the script), call `settings.set(\"context-priorities\", [\"Body\"])`. `create_shape` then takes the Body in all four cases of the script, without GEO324. This does not help when all representations share one `Model` context, as in the public sample cited above: there the setting makes every `create_shape` fail with \"No suitable IfcRepresentation found\" (also the Body-first order, which works without it), and only passing the representation works.\n\n(`context-identifiers` and `context-types` are documented as having no effect at present; setting them to `[\"Body\"]` and `[\"Model\"]` indeed leaves GEO324 and the failure unchanged.)\n\n**Related.** #2744 is about `create_shape(settings, element)` depending on the order of several Body representations; it was reported fixed on `v0.8.0` in July 2026. The cause here is different: the 0.9.0 wrapper no longer prefers the Body identifier. See also #8026 and PR #9673, a similar Axis/Body ambiguity in the Bonsai importer, where an imported wall could lose its mesh to the empty Axis mesh when both representations share one context.\n\nThis report and its script were prepared with the assistance of an AI coding tool; the outputs shown come from actual runs on the versions stated.\n\n### Attachments\n\nNone. The script above builds its own model.\n\n### Debug and Error Output\n\n```\nifcopenshell 0.9.0 from PyPI (ifcopenshell_wrapper.version(): 0.9.0alpha0-8c614fa)\nCPython 3.14.7, Windows 11 x64; Linux and macOS not tested.\nNot affected: ifcopenshell 0.8.5 from PyPI (0.8.5-1c5b825).\n```\n","author":{"url":"https://github.com/BryanMGIT","@type":"Person","name":"BryanMGIT"},"datePublished":"2026-10-01T19:58:41Z","url":"https://github.com/IfcOpenShell/IfcOpenShell/issues/9771"}
| 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:d3522ae9-ba64-6519-2ec1-bbe8b89d93db |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DCA6:DF519:1DC551:27F19A:6B04B46E |
| html-safe-nonce | 17bff2f6c35a4a84fa4ab9ce0d75498208b4867ef69ad56fbbd579c20a35f1fd |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQ0E2OkRGNTE5OjFEQzU1MToyN0YxOUE6NkIwNEI0NkUiLCJ2aXNpdG9yX2lkIjoiMjc4NDUxNTU3NzUyOTQzNzI2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 807a3529f6c7a0432ce6de4e69a0e19efd2391b440d7b47554fb8d4b9a68de60 |
| hovercard-subject-tag | issue:5668306641 |
| 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/9771/issue_layout |
| twitter:image | https://opengraph.githubassets.com/53213095ce80bb06acbc8fb5faeb368e5abf1fb17ce58bda1d1dd8cb8e56fccd/IfcOpenShell/IfcOpenShell/issues/9771 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/53213095ce80bb06acbc8fb5faeb368e5abf1fb17ce58bda1d1dd8cb8e56fccd/IfcOpenShell/IfcOpenShell/issues/9771 |
| og:image:alt | Bug Description In 0.9.0, when ifcopenshell.geom.create_shape(settings, product) is called without a representation on a product whose Representations list an Axis representation before its Body, c... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | BryanMGIT |
| hostname | github.com |
| expected-hostname | github.com |
| None | 378bd702ac792b3550e484ad39d9a898fcd25bb52ba6962b0c9cc457c1ea71c7 |
| 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 | b032e77f1ea437ede6c115446a0a467709b468e7 |
| 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