René's URL Explorer Experiment


Title: bim.add_aggregate fragments aggregates when parts are selected · Issue #9588 · IfcOpenShell/IfcOpenShell · GitHub

Open Graph Title: bim.add_aggregate fragments aggregates when parts are selected · Issue #9588 · IfcOpenShell/IfcOpenShell

X Title: bim.add_aggregate fragments aggregates when parts are selected · Issue #9588 · IfcOpenShell/IfcOpenShell

Description: Bug Description bim.add_aggregate corrupts aggregates when the selection includes parts, or spans more than one aggregate. Worst for linked aggregates, where the damage is silent. 1. The new aggregate is parented inside one of the elemen...

Open Graph Description: Bug Description bim.add_aggregate corrupts aggregates when the selection includes parts, or spans more than one aggregate. Worst for linked aggregates, where the damage is silent. 1. The new aggreg...

X Description: Bug Description bim.add_aggregate corrupts aggregates when the selection includes parts, or spans more than one aggregate. Worst for linked aggregates, where the damage is silent. 1. The new aggreg...

Opengraph URL: https://github.com/IfcOpenShell/IfcOpenShell/issues/9588

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.112.3


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"bim.add_aggregate fragments aggregates when parts are selected","articleBody":"### Bug Description\n\n`bim.add_aggregate` corrupts aggregates when the selection includes parts, or spans\nmore than one aggregate. Worst for linked aggregates, where the damage is silent.\n\n**1. The new aggregate is parented inside one of the elements it is collecting**\n\n`BIM_OT_add_aggregate._execute` recomputes the new aggregate's parent on every\niteration of the selection loop:\n\n```python\nfor obj in tool.Blender.get_selected_objects():\n    current_aggregate = ifcopenshell.util.element.get_aggregate(element)\n    if current_aggregate:\n        core.assign_object(..., relating_obj=..., related_obj=aggregate)   # new agg -> into this element's parent\n    ...\n    core.assign_object(..., relating_obj=aggregate, related_obj=obj)       # element -> into new agg\n```\n\nWhen parts are selected, a part's `get_aggregate()` is the assembly it belongs to,\nso the new aggregate is parented *inside* the very assembly whose parts it is about\nto take. Whichever selected object is processed last wins, so the damage is\nselection-order dependent.\n\n**2. Selecting a part fragments its aggregate**\n\nEvery selected object is re-parented individually, including parts that should\ntravel with their assembly. For a linked aggregate this silently desynchronises it\nfrom its linked copies.\n\n### Steps to reproduce\n\n1. Create two linked aggregates (duplicate one with `Ctrl+Shift+D`).\n2. Select both empties **and all their parts**.\n3. `bim.add_aggregate()`.\n4. `bim.refresh_linked_aggregate()` -> `StopIteration`.\n\n**Before**\n\n```\n#105 'Default_Name'    group=[127]  Aggregate_Index 0   +- #72, #89\n#213 'Default_Name_01' group=[127]  Aggregate_Index 1   +- #169, #145\n```\n\n**After `bim.add_aggregate()`**\n\n```\n#105 'Default_Name'  group=[127]                 \u003c- still a group member\n  +- #271 'Default_Name'  group=-  pset=None     \u003c- NEW wrapper, nested inside #105\n      +- #72\n      +- #213 'Default_Name_1'  group=[127]      \u003c- the OTHER member, now inside #105\n      |   +- #169, #145\n      +- #89\n```\n\nTwo group members now nest inside one another, and an ungrouped\n`IfcElementAssembly` sits as a *part* of a group member.\n\n### Consequences\n\n- `RefreshLinkedAggregate.get_original_data` recurses into nested assemblies and\n  looks up their `BBIM_Linked_Aggregate` group with a bare `next()`. The ungrouped\n  wrapper raises `StopIteration` (reported separately as #9582).\n- `delete_objects` recurses into nested assemblies, so refreshing deletes a member\n  nested inside another member - including, for some selections, the base instance,\n  which then raises `RuntimeError: An unknown error occurred` from\n  `entity_instance.id()`.\n- Once a wrapper has swallowed already-numbered parts, `add_linked_aggregate_pset`\n  takes its `index == 0` branch test to mean \"is root\" and writes `{\"Index\": N}`\n  with no `Name`/`Aggregate_Index`, which later raises `KeyError: 'Name'`.\n\n### Proposed fix\n\n1. Decide the new aggregate's parent **once**, from the selection, rather than per\n   object.\n2. Drop selected elements already contained by another selected element - parts\n   travel with their aggregate.\n3. **Promote a selected part to the aggregate that contains it**, so selecting any\n   part collects the whole aggregate. This makes the result independent of how\n   thoroughly the user selected, and stops anyone unwittingly fragmenting an\n   aggregate.\n\nPromotion needs a way to say \"no, I really do want to restructure *inside* this\naggregate\" - which is what aggregate mode already means. So:\n\n> **Not in aggregate mode** -> promote to the outermost enclosing aggregate.\n> **Tabbed into an aggregate** -> no promotion past it; the selected parts are\n> grouped into a sub-assembly, as now.\n\nThis keeps sub-assembly creation, and makes the choice explicit rather than\ninferred. It applies uniformly to linked and plain aggregates - a user should not\nneed to know which kind they have to predict what the operator does.\n\nWith this, selecting one part from each linked aggregate, or both empties plus\nevery part, or any mixture, all produce the same result:\n\n```\n#\u003cnew>  group=-\n  +- #105 'Default_Name'    group=[127]  +- #72, #89\n  +- #213 'Default_Name_01' group=[127]  +- #169, #145\n```\n\n### Behaviour change\n\nOutside aggregate mode, selecting a part of a **plain** aggregate now collects the\nwhole aggregate instead of extracting that part into a nested sub-assembly. The\nexisting scenario `Add aggregate - add a nested aggregate` in\n`src/bonsai/test/bim/feature/aggregate.feature` covers the old behaviour and is\nupdated to tab into the aggregate first. Flagging this explicitly since it is an\nintentional UX change rather than a bug fix.\n\n### Also folded in: #6663\n\n`execute_ifc_duplicate_linked_aggregate_operator` calls\n`tool.Root.recreate_aggregate(old_to_new)` a second time, after\n`execute_ifc_duplicate_operator` already called it via `duplicate_ifc_objects`.\nOn the second run the parent aggregate is still absent from `old_to_new` (it was\nnever duplicated), so `recreate_aggregate` takes its \"parent not found\" branch and\nunassigns the copy from the parent it had just been restored to, stranding it\noutside.\n\nThat blocks the workflow this issue enables: tab into a linked aggregate, create a\nplain sub-assembly, then `bim.duplicate_linked_aggregate_to_3d_cursor()`. The\nsub-assembly is correctly promoted to a linked aggregate and duplicated, but the\ncopy lands outside the wrapper instead of beside its sibling.\n\nRemoving the redundant call is the same fix as PR #8638. It is folded in here\nbecause this issue's workflow depends on it.\n\nFixes #6663.\n\n### Attachments\n\nNone. The reproduction is a new file with two linked aggregates, built by the\nsteps above in a few seconds; the before and after trees are given in full.\n\n### Debug and Error Output\n\n```true\nblender_version: 5.2.1 LTS\nbonsai_version: 0.8.6-alpha260923-8ffab9d\nschema: IFC4\n\nlast_error: Traceback (most recent call last):\n  File \"bonsai\\bim\\ifc.py\", line 569, in execute_ifc_operator\n    result = getattr(operator, \"_execute\")(context)\n  File \"bonsai\\bim\\module\\geometry\\operator.py\", line 2062, in _execute\n    element_original_data = get_original_data(element)\n  File \"bonsai\\bim\\module\\geometry\\operator.py\", line 1848, in get_original_data\n    nested_data = get_original_data(part)\n  File \"bonsai\\bim\\module\\geometry\\operator.py\", line 1821, in get_original_data\n    group: int = next(\n        r.RelatingGroup\n        for r in getattr(element, \"HasAssignments\", []) or []\n        if r.is_a(\"IfcRelAssignsToGroup\")\n        if self.group_name in r.RelatingGroup.Name\n    ).id()\nStopIteration\n```\n\n\n","author":{"url":"https://github.com/theoryshaw","@type":"Person","name":"theoryshaw"},"datePublished":"2026-09-24T15:00:33Z","url":"https://github.com/IfcOpenShell/IfcOpenShell/issues/9588"}

react-profiling0
react-import-mapreact,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-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:211cf090-1673-8283-f873-f2ae85a9cadb
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8798:2843FB:4462BD:5DB777:6B046F84
html-safe-nonce5ebdaf81e398fea2d8025e2340972c0f30c28343ce1724470fa70a2d0d488d0d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4Nzk4OjI4NDNGQjo0NDYyQkQ6NURCNzc3OjZCMDQ2Rjg0IiwidmlzaXRvcl9pZCI6IjQ1NjQ5NzYwMTY0NzUwNTI4NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac3bdae5a25ba39a2d7a1e3fe315a59a50ebd16402c94d127fcf21d67159fc9f56
hovercard-subject-tagissue:5570299892
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/IfcOpenShell/IfcOpenShell/9588/issue_layout
twitter:imagehttps://opengraph.githubassets.com/0c6e224b1f52423a5523f6c9367cf7af89cb8233f65d17f4ab247e82280c54e4/IfcOpenShell/IfcOpenShell/issues/9588
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/0c6e224b1f52423a5523f6c9367cf7af89cb8233f65d17f4ab247e82280c54e4/IfcOpenShell/IfcOpenShell/issues/9588
og:image:altBug Description bim.add_aggregate corrupts aggregates when the selection includes parts, or spans more than one aggregate. Worst for linked aggregates, where the damage is silent. 1. The new aggreg...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernametheoryshaw
hostnamegithub.com
expected-hostnamegithub.com
Noneae8802492f12d3ba4f6b0d814054e617a2a5616b6327bf8555c10cd5b0dc2a6f
turbo-cache-controlno-preview
go-importgithub.com/IfcOpenShell/IfcOpenShell git https://github.com/IfcOpenShell/IfcOpenShell.git
octolytics-dimension-user_id13692563
octolytics-dimension-user_loginIfcOpenShell
octolytics-dimension-repository_id40473201
octolytics-dimension-repository_nwoIfcOpenShell/IfcOpenShell
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id40473201
octolytics-dimension-repository_network_root_nwoIfcOpenShell/IfcOpenShell
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasecfb5f24c6e01d85f70804652a5107e5cac03a161
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/IfcOpenShell/IfcOpenShell/issues/9588#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FIfcOpenShell%2FIfcOpenShell%2Fissues%2F9588
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FIfcOpenShell%2FIfcOpenShell%2Fissues%2F9588
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=IfcOpenShell%2FIfcOpenShell
Reloadhttps://github.com/IfcOpenShell/IfcOpenShell/issues/9588
Reloadhttps://github.com/IfcOpenShell/IfcOpenShell/issues/9588
Reloadhttps://github.com/IfcOpenShell/IfcOpenShell/issues/9588
IfcOpenShellhttps://github.com/IfcOpenShell
IfcOpenShellhttps://github.com/IfcOpenShell/IfcOpenShell
Codehttps://github.com/IfcOpenShell/IfcOpenShell
Issues1.2k (1.2k)https://github.com/IfcOpenShell/IfcOpenShell/issues
Pull requests937 (937)https://github.com/IfcOpenShell/IfcOpenShell/pulls
Discussionshttps://github.com/IfcOpenShell/IfcOpenShell/discussions
Actionshttps://github.com/IfcOpenShell/IfcOpenShell/actions
Projectshttps://github.com/IfcOpenShell/IfcOpenShell/projects
Wikihttps://github.com/IfcOpenShell/IfcOpenShell/wiki
Security and qualityhttps://github.com/IfcOpenShell/IfcOpenShell/security
Insightshttps://github.com/IfcOpenShell/IfcOpenShell/insights
https://github.com/IfcOpenShell/IfcOpenShell
New issuehttps://github.com/login?return_to=https://github.com/IfcOpenShell/IfcOpenShell/issues/9588
New issuehttps://github.com/login?return_to=https://github.com/IfcOpenShell/IfcOpenShell/issues/9588
#9589https://github.com/IfcOpenShell/IfcOpenShell/pull/9589
bim.add_aggregate fragments aggregates when parts are selectedhttps://github.com/IfcOpenShell/IfcOpenShell/issues/9588#top
#9589https://github.com/IfcOpenShell/IfcOpenShell/pull/9589
Bonsaihttps://github.com/IfcOpenShell/IfcOpenShell/issues?q=state%3Aopen%20label%3A%22Bonsai%22
PR ProposedA PR has been proposed for this bug/feature.https://github.com/IfcOpenShell/IfcOpenShell/issues?q=state%3Aopen%20label%3A%22PR%20Proposed%22
https://github.com/theoryshaw
theoryshawhttps://github.com/theoryshaw
on Sep 24, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/9588#issue-5570299892
Refresh Linked Aggregate crashes on a nested assembly that isn't a linked aggregate #9582https://github.com/IfcOpenShell/IfcOpenShell/issues/9582
#6663https://github.com/IfcOpenShell/IfcOpenShell/issues/6663
#8638https://github.com/IfcOpenShell/IfcOpenShell/pull/8638
#6663https://github.com/IfcOpenShell/IfcOpenShell/issues/6663
theoryshawhttps://github.com/theoryshaw
Bonsaihttps://github.com/IfcOpenShell/IfcOpenShell/issues?q=state%3Aopen%20label%3A%22Bonsai%22
on Sep 24, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/9588#event-31766826282
theoryshawhttps://github.com/theoryshaw
on Sep 24, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/9588#event-31770207340
theoryshawhttps://github.com/theoryshaw
PR ProposedA PR has been proposed for this bug/feature.https://github.com/IfcOpenShell/IfcOpenShell/issues?q=state%3Aopen%20label%3A%22PR%20Proposed%22
on Sep 24, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/9588#event-31776316773
Sign up for freehttps://github.com/signup?return_to=https://github.com/IfcOpenShell/IfcOpenShell/issues/9588
Sign in to commenthttps://github.com/login?return_to=https://github.com/IfcOpenShell/IfcOpenShell/issues/9588
Bonsaihttps://github.com/IfcOpenShell/IfcOpenShell/issues?q=state%3Aopen%20label%3A%22Bonsai%22
PR ProposedA PR has been proposed for this bug/feature.https://github.com/IfcOpenShell/IfcOpenShell/issues?q=state%3Aopen%20label%3A%22PR%20Proposed%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.