René's URL Explorer Experiment


Title: project.append_asset drops material surface styles when the material is reached via IfcMaterialLayerSetUsage · Issue #8662 · IfcOpenShell/IfcOpenShell · GitHub

Open Graph Title: project.append_asset drops material surface styles when the material is reached via IfcMaterialLayerSetUsage · Issue #8662 · IfcOpenShell/IfcOpenShell

X Title: project.append_asset drops material surface styles when the material is reached via IfcMaterialLayerSetUsage · Issue #8662 · IfcOpenShell/IfcOpenShell

Description: Summary ifcopenshell.api.project.append_asset drops a material's surface style (IfcMaterial.HasRepresentation → IfcMaterialDefinitionRepresentation → IfcStyledItem → IfcSurfaceStyle) when the material is reached through an IfcMaterialLay...

Open Graph Description: Summary ifcopenshell.api.project.append_asset drops a material's surface style (IfcMaterial.HasRepresentation → IfcMaterialDefinitionRepresentation → IfcStyledItem → IfcSurfaceStyle) when the mater...

X Description: Summary ifcopenshell.api.project.append_asset drops a material's surface style (IfcMaterial.HasRepresentation → IfcMaterialDefinitionRepresentation → IfcStyledItem → IfcSurfaceStyle) when the m...

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

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.112.4


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"project.append_asset drops material surface styles when the material is reached via IfcMaterialLayerSetUsage","articleBody":"## Summary\n\n`ifcopenshell.api.project.append_asset` drops a material's **surface style**\n(`IfcMaterial.HasRepresentation` → `IfcMaterialDefinitionRepresentation` →\n`IfcStyledItem` → `IfcSurfaceStyle`) when the material is reached through an\n**`IfcMaterialLayerSetUsage`** — i.e. real wall/slab *occurrences*. The materials\nthemselves are appended, but arrive with `HasRepresentation == ()`, so they lose their\ncolour.\n\nIn Bonsai this shows up when appending an object (e.g. via\n`bpy.ops.bim.append_library_element_by_query()` /\n`bpy.ops.bim.append_library_element()`): the object's materials come across but the\nstyles assigned to those materials do not.\n\nIt only reproduces when the material sits in a set reached via a **usage**. A single\ndirectly-assigned material, or a type product carrying a bare `IfcMaterialLayerSet`,\nboth preserve their styles — which is why it can be easy to miss.\n\n## Minimal reproduction (pure `ifcopenshell`, no Bonsai)\n\n```python\nimport ifcopenshell\nimport ifcopenshell.api.root, ifcopenshell.api.context, ifcopenshell.api.material\nimport ifcopenshell.api.style, ifcopenshell.api.project, ifcopenshell.api.type\nimport ifcopenshell.api.owner.settings\n\n# Bare-script owner-history stubs (Bonsai sets these up for you).\nifcopenshell.api.owner.settings.get_user = lambda ifc: None\nifcopenshell.api.owner.settings.get_application = lambda ifc: None\n\n# --- Library: a wall type + occurrence sharing one styled material ---\nlib = ifcopenshell.api.project.create_file()  # IFC4\nifcopenshell.api.root.create_entity(lib, ifc_class=\"IfcProject\")\nctx = ifcopenshell.api.context.add_context(lib, context_type=\"Model\")\n\nwall_type = ifcopenshell.api.root.create_entity(lib, ifc_class=\"IfcWallType\")\nwall = ifcopenshell.api.root.create_entity(lib, ifc_class=\"IfcWall\")\nifcopenshell.api.type.assign_type(lib, related_objects=[wall], relating_type=wall_type)\n\nmaterial = ifcopenshell.api.material.add_material(lib, name=\"Material\")\nstyle = ifcopenshell.api.style.add_style(lib)  # IfcSurfaceStyle\nifcopenshell.api.style.assign_material_style(lib, material=material, style=style, context=ctx)\n\nlayer_set = ifcopenshell.api.material.add_material_set(lib, set_type=\"IfcMaterialLayerSet\")\nlayer = ifcopenshell.api.material.add_layer(lib, layer_set=layer_set, material=material)\nifcopenshell.api.material.edit_layer(lib, layer=layer, attributes={\"LayerThickness\": 0.1})\n\n# Type gets the bare layer set; the occurrence wraps it in a usage, like real walls.\nifcopenshell.api.material.assign_material(lib, products=[wall_type], material=layer_set)\nusage = lib.create_entity(\"IfcMaterialLayerSetUsage\", ForLayerSet=layer_set,\n    LayerSetDirection=\"AXIS2\", DirectionSense=\"POSITIVE\", OffsetFromReferenceLine=0.0)\nlib.create_entity(\"IfcRelAssociatesMaterial\", GlobalId=ifcopenshell.guid.new(),\n    RelatedObjects=[wall], RelatingMaterial=usage)\n\nassert material.HasRepresentation, \"sanity: library material is styled\"\n\n# --- Append the occurrence into a fresh project ---\nf = ifcopenshell.file(schema=lib.schema)\nifcopenshell.api.root.create_entity(f, ifc_class=\"IfcProject\")\nifcopenshell.api.context.add_context(f, context_type=\"Model\")\nifcopenshell.api.project.append_asset(f, library=lib, element=wall)\n\nm = f.by_type(\"IfcMaterial\")[0]\nprint(\"appended material HasRepresentation:\", m.HasRepresentation)\nprint(\"appended IfcSurfaceStyle          :\", f.by_type(\"IfcSurfaceStyle\"))\n```\n\n**Expected**\n```\nappended material HasRepresentation: (#..=IfcMaterialDefinitionRepresentation(...),)\nappended IfcSurfaceStyle          : [#..=IfcSurfaceStyle(...)]\n```\n\n**Actual**\n```\nappended material HasRepresentation: ()\nappended IfcSurfaceStyle          : []\n```\n\n## Root cause\n\nIn `append_asset.py`, `Usecase.add_element`:\n\n1. The occurrence's `RelatingMaterial` is an `IfcMaterialLayerSetUsage` →\n   `IfcMaterialLayerSet`. `file_add` **forward-copies** the whole usage → set → layers →\n   materials subgraph into the project. `file_add` only copies *forward* attributes;\n   inverse attributes (`HasRepresentation`, `HasProperties`, …) are handled separately by\n   `check_inverses`, which runs from `add_element`'s subgraph traversal.\n2. When that traversal reaches the layer set, `get_existing_element` matches the fresh\n   forward-copy as \"existing\" (via `material_sets_are_equal`), so it takes the\n   `if existing_element:` branch — which **does not extend the traversal queue into the\n   set**. The member `IfcMaterial`s are therefore never visited, `check_inverses` never\n   runs on them, and `IfcMaterial.HasRepresentation` (which carries the surface style) is\n   never transplanted.\n3. A subsequent type append short-circuits even earlier: the set is already in\n   `added_elements`, so `add_element` returns immediately.\n\n## Regression origin\n\nThis is a regression from the material-set **reuse** feature:\n\n- `b4740b6949` — *append_asset to also match material sets by the name #6762*\n- `a17b0604e1` — *api.project.append_asset deduplicate material sets* (added\n  `material_sets_are_equal`)\n\nBefore those, appended materials kept their styles.\n\n## Notes\n\n- Not a Bonsai import bug — Bonsai's `import_material_styles` / `create_style` are correct;\n  the IFC simply arrives style-less.\n- A fix (descend into a matched-existing material set so member materials get\n  `check_inverses`, keyed off `MATERIAL_SETS` so constituent/profile sets benefit too) plus\n  a regression test are prepared and will be submitted as a PR.\n\nEnvironment: `ifcopenshell` 0.8.0 (current `v0.8.0`); reproduced on Windows, IFC4 (schema-agnostic).\n","author":{"url":"https://github.com/theoryshaw","@type":"Person","name":"theoryshaw"},"datePublished":"2026-07-16T22:03:36Z","url":"https://github.com/IfcOpenShell/IfcOpenShell/issues/8662"}

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:48ddc86f-5e99-c0bc-fbef-38f25d825432
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC21A:222D8A:249793:33A3DD:6B046952
html-safe-nonce1432129c4a5bc540ffd73b683552d317b66b8736989a243dce6cdfe46592f2d2
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMjFBOjIyMkQ4QToyNDk3OTM6MzNBM0REOjZCMDQ2OTUyIiwidmlzaXRvcl9pZCI6IjU3MDcxMjQ2NDg5MDc2NjM2OTgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacc36d0aaccdb9aff7b9c4218c54f9af1a17e6d1ccf49f2ccbbc20676612633b44
hovercard-subject-tagissue:4906346156
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/8662/issue_layout
twitter:imagehttps://opengraph.githubassets.com/233ce31a6d69cdb880f8b9aac6e843e975862e51ba9c92d1baf1a948d2f855d6/IfcOpenShell/IfcOpenShell/issues/8662
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/233ce31a6d69cdb880f8b9aac6e843e975862e51ba9c92d1baf1a948d2f855d6/IfcOpenShell/IfcOpenShell/issues/8662
og:image:altSummary ifcopenshell.api.project.append_asset drops a material's surface style (IfcMaterial.HasRepresentation → IfcMaterialDefinitionRepresentation → IfcStyledItem → IfcSurfaceStyle) when the mater...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernametheoryshaw
hostnamegithub.com
expected-hostnamegithub.com
None83e4c0e58c5162177f3c161c5fbad38527ae04c11ac14980f9f9d85ae2027b1f
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
releaseca4d07a7cef4e4b75f821dc25e7300d80c1450a9
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/IfcOpenShell/IfcOpenShell/issues/8662#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FIfcOpenShell%2FIfcOpenShell%2Fissues%2F8662
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%2F8662
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/8662
Reloadhttps://github.com/IfcOpenShell/IfcOpenShell/issues/8662
Reloadhttps://github.com/IfcOpenShell/IfcOpenShell/issues/8662
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 requests936 (936)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/8662
New issuehttps://github.com/login?return_to=https://github.com/IfcOpenShell/IfcOpenShell/issues/8662
#8663https://github.com/IfcOpenShell/IfcOpenShell/pull/8663
project.append_asset drops material surface styles when the material is reached via IfcMaterialLayerSetUsagehttps://github.com/IfcOpenShell/IfcOpenShell/issues/8662#top
#8663https://github.com/IfcOpenShell/IfcOpenShell/pull/8663
IfcOpenShell-Pythonhttps://github.com/IfcOpenShell/IfcOpenShell/issues?q=state%3Aopen%20label%3A%22IfcOpenShell-Python%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 Jul 16, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/8662#issue-4906346156
append_asset is duplicating material sets #6762https://github.com/IfcOpenShell/IfcOpenShell/issues/6762
theoryshawhttps://github.com/theoryshaw
IfcOpenShell-Pythonhttps://github.com/IfcOpenShell/IfcOpenShell/issues?q=state%3Aopen%20label%3A%22IfcOpenShell-Python%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
on Jul 16, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/8662#event-28093981598
https://github.com/theoryshaw
theoryshawhttps://github.com/theoryshaw
on Jul 16, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/8662#issuecomment-4997119141
b4740b6https://github.com/IfcOpenShell/IfcOpenShell/commit/b4740b6949b7596007466ae0af29deff49e627ee
@Andrej730https://github.com/Andrej730
#6762https://github.com/IfcOpenShell/IfcOpenShell/issues/6762
a17b060https://github.com/IfcOpenShell/IfcOpenShell/commit/a17b0604e1a9653a6af25236eb88c6c80ff7dfed
@brunopostlehttps://github.com/brunopostle
theoryshawhttps://github.com/theoryshaw
on Oct 2, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/8662#event-32360791084
api.project.append_asset: preserve material styles reached via a laye…https://github.com/theoryshaw/IfcOpenShell/commit/c1186f8e3d75c757978b3a87b74be96e89262763
https://docs.github.com/articles/closing-issues-via-commit-messages
c1186f8https://github.com/theoryshaw/IfcOpenShell/commit/c1186f8e3d75c757978b3a87b74be96e89262763
theoryshawhttps://github.com/theoryshaw
on Nov 8, 2026https://github.com/IfcOpenShell/IfcOpenShell/issues/8662#event-35468878779
api.project.append_asset: preserve material styles reached via a laye…https://github.com/theoryshaw/IfcOpenShell/commit/117e844254fd9c4f1478849d0895df1daf59c1c9
https://docs.github.com/articles/closing-issues-via-commit-messages
117e844https://github.com/theoryshaw/IfcOpenShell/commit/117e844254fd9c4f1478849d0895df1daf59c1c9
Sign up for freehttps://github.com/signup?return_to=https://github.com/IfcOpenShell/IfcOpenShell/issues/8662
Sign in to commenthttps://github.com/login?return_to=https://github.com/IfcOpenShell/IfcOpenShell/issues/8662
IfcOpenShell-Pythonhttps://github.com/IfcOpenShell/IfcOpenShell/issues?q=state%3Aopen%20label%3A%22IfcOpenShell-Python%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.