Title: incorrect results from clash_intersection_many · Issue #5357 · IfcOpenShell/IfcOpenShell · GitHub
Open Graph Title: incorrect results from clash_intersection_many · Issue #5357 · IfcOpenShell/IfcOpenShell
X Title: incorrect results from clash_intersection_many · Issue #5357 · IfcOpenShell/IfcOpenShell
Description: I'm trying to clash file with walls, slabs(a) to file with spaces(b). The result is always supposed to have result.a as instance of IfcWall/IfcSlab and result.b as instance of IfcSpace. While majority of the result is correct, I noticed ...
Open Graph Description: I'm trying to clash file with walls, slabs(a) to file with spaces(b). The result is always supposed to have result.a as instance of IfcWall/IfcSlab and result.b as instance of IfcSpace. While major...
X Description: I'm trying to clash file with walls, slabs(a) to file with spaces(b). The result is always supposed to have result.a as instance of IfcWall/IfcSlab and result.b as instance of IfcSpace. While m...
Opengraph URL: https://github.com/IfcOpenShell/IfcOpenShell/issues/5357
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"incorrect results from clash_intersection_many","articleBody":"I'm trying to clash file with walls, slabs(a) to file with spaces(b). The result is always supposed to have `result.a` as instance of `IfcWall/IfcSlab` and `result.b` as instance of `IfcSpace`.\r\nWhile majority of the result is correct, I noticed is that some clash result from `clash_intersection_many` is flipped - i.e `result.a` is supposed to be `result.b` and vice versa.\r\n\r\nSteps to reproduce :\r\nUnfortunately, I cannot share the ifc files. Here is the code for convinience\r\n```python\r\nimport logging\r\n\r\nimport ifcopenshell\r\nfrom ifcclash.ifcclash import Clasher, ClashSettings\r\n\r\n\r\ndef intersect_zones_elements(zones_file_path: str, elements_file_path: str,\r\n tolerance: float,\r\n ):\r\n clash_settings = ClashSettings()\r\n clash_settings.logger = logging.getLogger(\"ifcclash\")\r\n c = Clasher(clash_settings)\r\n # https://docs.ifcopenshell.org/ifcopenshell-python/selector_syntax.html\r\n clash_set = {\r\n \"mode\": \"intersection\",\r\n \"tolerance\": tolerance,\r\n \"check_all\": False,\r\n \"a\": [\r\n {\r\n \"selector\": \"IfcWall,IfcSlab\",\r\n \"mode\": \"i\",\r\n \"file\": elements_file_path,\r\n }\r\n ],\r\n \"b\": [\r\n {\r\n \"selector\": \"IfcSpace\",\r\n \"mode\": \"i\",\r\n \"file\": zones_file_path,\r\n }\r\n ],\r\n }\r\n\r\n c.clash()\r\n c.tree = ifcopenshell.geom.tree()\r\n c.create_group(\"a\")\r\n for source in clash_set[\"a\"]:\r\n source[\"ifc\"] = c.load_ifc(source[\"file\"])\r\n c.add_collision_objects(\"a\", source[\"ifc\"], source.get(\"mode\", None), source.get(\"selector\", None))\r\n\r\n c.create_group(\"b\")\r\n for source in clash_set[\"b\"]:\r\n source[\"ifc\"] = c.load_ifc(source[\"file\"])\r\n c.add_collision_objects(\"b\", source[\"ifc\"], source.get(\"mode\", None), source.get(\"selector\", None))\r\n\r\n results = c.tree.clash_intersection_many(\r\n list(c.groups[\"a\"][\"elements\"].values()),\r\n list(c.groups[\"b\"][\"elements\"].values()),\r\n tolerance=clash_set[\"tolerance\"],\r\n check_all=clash_set[\"check_all\"],\r\n )\r\n\r\n mismatch_counter = 0\r\n for result in results:\r\n clash_type = [\"protrusion\", \"pierce\", \"collision\", \"clearance\"][result.clash_type]\r\n a_type, b_type, a_id, b_id = result.a.is_a(), result.b.is_a(), result.a.get_argument(0), result.b.get_argument(0)\r\n if a_type == \"IfcSpace\":\r\n mismatch_counter += 1\r\n print(f\"{a_type} {b_type} {a_id} {b_id} {clash_type}\")\r\n\r\n print(f\"# of mismatch: {mismatch_counter}, tolerance: {tolerance}\")\r\n\r\n\r\nif __name__ == \"__main__\":\r\n _zones_file = \"/path/to/zones.ifc\"\r\n _elements_file = \"/path/to/elements.ifc\"\r\n intersect_zones_elements(_zones_file, _elements_file, 0.05)\r\n```","author":{"url":"https://github.com/zahmadsaleem","@type":"Person","name":"zahmadsaleem"},"datePublished":"2024-09-09T13:53:47Z","url":"https://github.com/IfcOpenShell/IfcOpenShell/issues/5357"}
| 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:88460600-acac-e31f-0836-fe7ff917edab |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CB38:C24D0:5F4CD7:84CD32:6B048356 |
| html-safe-nonce | af369971a5e06038a62107561e6a1e8af215df93bfc9dcd54a601191c29b7eaa |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQjM4OkMyNEQwOjVGNENENzo4NENEMzI6NkIwNDgzNTYiLCJ2aXNpdG9yX2lkIjoiODA5ODE4MzUwMjk0NTg3ODg3MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 16ed68b7bd926164173338da92a1492a87339b1a54f62c615ea293a4f22b8191 |
| hovercard-subject-tag | issue:2514042953 |
| 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/5357/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d051dece36d460a17aa424fa2ba1d43ce7b5e83ce2d6b0a265aca30efb2f67c6/IfcOpenShell/IfcOpenShell/issues/5357 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d051dece36d460a17aa424fa2ba1d43ce7b5e83ce2d6b0a265aca30efb2f67c6/IfcOpenShell/IfcOpenShell/issues/5357 |
| og:image:alt | I'm trying to clash file with walls, slabs(a) to file with spaces(b). The result is always supposed to have result.a as instance of IfcWall/IfcSlab and result.b as instance of IfcSpace. While major... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | zahmadsaleem |
| hostname | github.com |
| expected-hostname | github.com |
| None | 1d5c152376e38b7d2e37f3d5179be29a73bee93b85110da28a4eebe1159cdc70 |
| 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 | f5017e8ff4ea25a8011fcf0f2a0e430c60dc86c8 |
| ui-target | canary-2 |
| 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