Title: v0.8.0 - segfault initializing iterator with IfcRectangleProfileDef · Issue #4605 · IfcOpenShell/IfcOpenShell · GitHub
Open Graph Title: v0.8.0 - segfault initializing iterator with IfcRectangleProfileDef · Issue #4605 · IfcOpenShell/IfcOpenShell
X Title: v0.8.0 - segfault initializing iterator with IfcRectangleProfileDef · Issue #4605 · IfcOpenShell/IfcOpenShell
Description: Mentioned in #4565 by @piotr-smolira this file https://github.com/IfcOpenShell/IfcOpenShell/files/15160550/LBD-ready-v.0.1.ifc.txt fails to load in v0.8.0 due segfault during ifcopenshell.geom.iterator.initalize(). Ping @aothms I was try...
Open Graph Description: Mentioned in #4565 by @piotr-smolira this file https://github.com/IfcOpenShell/IfcOpenShell/files/15160550/LBD-ready-v.0.1.ifc.txt fails to load in v0.8.0 due segfault during ifcopenshell.geom.iter...
X Description: Mentioned in #4565 by @piotr-smolira this file https://github.com/IfcOpenShell/IfcOpenShell/files/15160550/LBD-ready-v.0.1.ifc.txt fails to load in v0.8.0 due segfault during ifcopenshell.geom.iter...
Opengraph URL: https://github.com/IfcOpenShell/IfcOpenShell/issues/4605
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"v0.8.0 - segfault initializing iterator with IfcRectangleProfileDef","articleBody":"Mentioned in #4565 by @piotr-smolira this file https://github.com/IfcOpenShell/IfcOpenShell/files/15160550/LBD-ready-v.0.1.ifc.txt fails to load in v0.8.0 due segfault during `ifcopenshell.geom.iterator.initalize()`. Ping @aothms \r\n\r\nI was trying to narrow it down and it seems it segfaults when representation is using IfcRectangleProfileDef.\r\n\r\nHere's example code that doesn't require the original file. It adds two elements - both use some extrusion for the repersentation, one is using IfcArbitraryClosedProfileDef and another using IfcRectangleProfileDef (second one segfaults).\r\n```python\r\nimport ifcopenshell\r\nimport ifcopenshell.geom\r\nimport multiprocessing\r\nimport ifcopenshell.util.representation\r\nimport ifcopenshell.api\r\nfrom ifcopenshell.util.shape_builder import ShapeBuilder, V\r\n\r\nifc_file = ifcopenshell.file(schema=\"IFC4x3_ADD1\")\r\nbuilder = ShapeBuilder(ifc_file)\r\nproject = ifcopenshell.api.run(\"root.create_entity\", ifc_file, ifc_class=\"IfcProject\", name=\"project\")\r\nmodel = ifcopenshell.api.run(\"context.add_context\", ifc_file, context_type=\"Model\")\r\ncontext = ifcopenshell.api.run(\r\n \"context.add_context\",\r\n ifc_file,\r\n context_type=\"Model\",\r\n context_identifier=\"Body\",\r\n target_view=\"MODEL_VIEW\",\r\n parent=model,\r\n)\r\nunit = ifcopenshell.api.run(\"unit.add_si_unit\", ifc_file, unit_type=\"LENGTHUNIT\", prefix=\"MILLI\")\r\nifcopenshell.api.run(\"unit.assign_unit\", ifc_file, units=[unit])\r\n\r\n\r\nproducts = []\r\n\r\n# arbitrary profile entity\r\narbitrary_profile_entity = ifcopenshell.api.run(\"root.create_entity\", ifc_file, ifc_class=\"IfcWall\")\r\nrectangle = builder.rectangle(size=V(1000.0, 1000.0))\r\nrep = builder.get_representation(context, [builder.extrude(rectangle, 1000.0)])\r\nifcopenshell.api.run(\"geometry.assign_representation\", ifc_file, product=arbitrary_profile_entity, representation=rep)\r\nproducts.append(arbitrary_profile_entity.id())\r\n\r\n# rectangle profile entity\r\nentity_rectangle_profile = ifcopenshell.api.run(\"root.create_entity\", ifc_file, ifc_class=\"IfcWall\")\r\nrectangle = ifc_file.create_entity(\r\n \"IfcRectangleProfileDef\", ProfileName=\"New Profile\", ProfileType=\"AREA\", XDim=1000.0, YDim=1000.0\r\n)\r\nrep = builder.get_representation(context, [builder.extrude(rectangle, 1000.0)])\r\nifcopenshell.api.run(\"geometry.assign_representation\", ifc_file, product=entity_rectangle_profile, representation=rep)\r\nproducts.append(entity_rectangle_profile.id())\r\n\r\nfor i, product_id in enumerate(products, 1):\r\n product = ifc_file.by_id(product_id)\r\n print(f\"{i}/{len(products)}\", product)\r\n settings = ifcopenshell.geom.settings()\r\n settings.set(\"mesher-linear-deflection\", 0.001)\r\n settings.set(\"mesher-angular-deflection\", 0.5)\r\n # settings.set(settings.STRICT_TOLERANCE, True)\r\n settings.set(\"dimensionality\", ifcopenshell.ifcopenshell_wrapper.CURVES_SURFACES_AND_SOLIDS)\r\n settings.set(\"context-ids\", [context.id()])\r\n iterator = ifcopenshell.geom.iterator(settings, ifc_file, multiprocessing.cpu_count(), include=[product])\r\n valid_file = iterator.initialize()\r\n print(\"never printed because in case of segfault\")\r\n```\r\n\r\nHere's another example using original file, there is a list failing elements in `skip` list and their types in `skipped_types`. Those elements cause a segfault, they all have a basic extrusion based representation that uses IfcRectangleProfileDef and replacing SweptArea with IfcArbitraryClosedProfileDef solves the issue.\r\n```python\r\nimport ifcopenshell\r\nimport ifcopenshell.geom\r\nimport multiprocessing\r\nimport ifcopenshell.util.representation\r\n\r\n# fmt: off\r\nproducts = [ 566499, 567016, 565898, 565524, 566369, 565240, 563367, 564529, 563488, 568931, 46429, 564650, 567969, 404964, 336304, 567907, 568741, 309393, 565026, 565092, 566298, 565158, 415231, 565948, 9585, 562988, 565413, 202056, 565479, 362948, 564077, 337384, 568646, 567473, 566227, 563630, 563412, 564574, 363216, 567737, 568221, 363143, 363242, 568586, 566440, 563865, 564226, 563931, 564292, 564358, 4949, 562967, 363189, 568161, 363017, 567615, 363171, 363250, 363193, 566884, 269350, 363228, 567544, 568343, 144590, 567269, 567447, 219014, 566813, 564443, 568464, 568836, 563043, 373444, 563109, 563175, 565600, 363113, 564143, 1369, 244580, 566727, 563696, 567198, 565347, 337463, 363205, 363238, 566641, 564735, 87088, 564801, 564867, 565690, 563322, 9600, 9688, 563509, 563564, 363130, 363185, 568111, 567138, 562912, 566966, 566570,\r\n]\r\n# fmt: on\r\n\r\npath = r\"LBD-ready-v.0.1.ifc\"\r\nskip = [9585, 562988, 568586, 568161, 564443, 1369, 9600, 563509, 567138, 562912]\r\nskipped_types = [364215, 364335, 364330, 364340]\r\nproducts = [p for p in products if p not in skip]\r\nifc_file = ifcopenshell.open(path)\r\ncontext = ifc_file.by_id(19)\r\nprint(context)\r\n\r\n\r\nfor i, product_id in enumerate(products, 1):\r\n product = ifc_file.by_id(product_id)\r\n print(f\"{i}/{len(products)}\", product)\r\n settings = ifcopenshell.geom.settings()\r\n settings.set(\"mesher-linear-deflection\", 0.001)\r\n settings.set(\"mesher-angular-deflection\", 0.5)\r\n # settings.set(settings.STRICT_TOLERANCE, True)\r\n settings.set(\"dimensionality\", ifcopenshell.ifcopenshell_wrapper.CURVES_SURFACES_AND_SOLIDS)\r\n settings.set(\"context-ids\", [context.id()])\r\n iterator = ifcopenshell.geom.iterator(settings, ifc_file, multiprocessing.cpu_count(), include=[product])\r\n valid_file = iterator.initialize()\r\n print(\"never printed because in case of segfault\")\r\n```","author":{"url":"https://github.com/Andrej730","@type":"Person","name":"Andrej730"},"datePublished":"2024-05-03T07:46:22Z","url":"https://github.com/IfcOpenShell/IfcOpenShell/issues/4605"}
| 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:56dd03d8-e638-485a-eda0-0898841d8d76 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D1BA:C8FAB:77EAB6:A455ED:6B0479EA |
| html-safe-nonce | 5d88da0a4969bed13aeb188e4da7e80e367eb6be7535daa303fa4ec3cef130f1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMUJBOkM4RkFCOjc3RUFCNjpBNDU1RUQ6NkIwNDc5RUEiLCJ2aXNpdG9yX2lkIjoiODc5ODA5ODE2ODE0MDI5ODczMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 76d8755418d4244a8e348e0da9a84596cb3cb91636df54a8b025eecca6f4d2e7 |
| hovercard-subject-tag | issue:2277125282 |
| 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/4605/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a46d9fd033df8ad874f42f100d7cda76b7dbae116d253cf119d94b4bde523520/IfcOpenShell/IfcOpenShell/issues/4605 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a46d9fd033df8ad874f42f100d7cda76b7dbae116d253cf119d94b4bde523520/IfcOpenShell/IfcOpenShell/issues/4605 |
| og:image:alt | Mentioned in #4565 by @piotr-smolira this file https://github.com/IfcOpenShell/IfcOpenShell/files/15160550/LBD-ready-v.0.1.ifc.txt fails to load in v0.8.0 due segfault during ifcopenshell.geom.iter... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Andrej730 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9c099f1b85def81ca352464c276510dfef32deaf3c305404e65b8d270284a58b |
| 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 | cf73f57448d52b3a7b619195e182b33d3b3454ca |
| 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