[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7FABCPJK61X0GXRKW2WTZP3":3,"skill-same:01M7FABCPJK61X0GXRKW2WTZP3":62},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":28,"commitSha":29,"skillDirectory":30,"forksCount":13,"repositoryHtmlUrl":31,"repositoryHomepageUrl":6,"ownerHtmlUrl":32,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":33,"install":34,"resources":47},"01M7FABCPJK61X0GXRKW2WTZP3","ifcos-core-runtime",null,"Use when debugging IfcOpenShell crashes, entity reference errors, or performance issues. Prevents the common pitfall of comparing entities with == instead of checking .id() or identity, or holding references to entities after removal. Covers C++ binding behavior, entity invalidation, by_type() return semantics, thread safety, memory management, PascalCase attributes, and installation patterns. Keywords: IfcOpenShell runtime, C++ binding, entity invalidation, by_type, thread safety, memory management, PascalCase, installation, entity identity, install IfcOpenShell, pip install ifcopenshell.","lagzgabrielmuller-dot\u002Fkit-ingenieria-3d","lagzgabrielmuller-dot","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F333339260?v=4","01M7F985KYC0XB2XZ97B5YWH4C","01M7F985MHK8N2NVE4VAR5WBWS",0,"MIT","https:\u002F\u002Fgithub.com\u002Flagzgabrielmuller-dot\u002Fkit-ingenieria-3d\u002Fblob\u002Fmain\u002Fplugins\u002Fblender-bim-sverchok\u002Fskills\u002Fifcopenshell\u002Fcore\u002Fifcos-core-runtime\u002FSKILL.md",[],[],"2026-11-16 10:05:34",false,"---\nname: ifcos-core-runtime\ndescription: >\n  Use when debugging IfcOpenShell crashes, entity reference errors, or performance issues.\n  Prevents the common pitfall of comparing entities with == instead of checking .id() or\n  identity, or holding references to entities after removal. Covers C++ binding behavior,\n  entity invalidation, by_type() return semantics, thread safety, memory management,\n  PascalCase attributes, and installation patterns.\n  Keywords: IfcOpenShell runtime, C++ binding, entity invalidation, by_type, thread safety, memory management, PascalCase, installation, entity identity, install IfcOpenShell, pip install ifcopenshell.\nlicense: MIT\ncompatibility: \"Designed for Claude Code. Requires IfcOpenShell Python library.\"\nmetadata:\n  author: OpenAEC-Foundation\n  version: \"1.0\"\n---\n\n# IfcOpenShell Python Runtime\n\n## Quick Reference\n\n### Critical Warnings\n\n- **ALWAYS** use `==` for entity comparison, NEVER `is`. Each query returns a new Python wrapper object.\n- **ALWAYS** set entity references to `None` after calling `model.remove()`. The C++ object is deallocated regardless of Python reference count.\n- **ALWAYS** keep a reference to the `ifcopenshell.file` object alive while any entities from it are in use. If the file is garbage-collected, all entity wrappers become dangling pointers (segfault).\n- **NEVER** write to an `ifcopenshell.file` from multiple threads. The C++ backend has no locking. Concurrent writes corrupt the model or crash.\n- **NEVER** iterate all entities and filter manually when `by_type()` exists. `by_type()` uses an internal index and is 10-100x faster.\n- **NEVER** use `get_info(recursive=True)` on large models. It materializes the entire entity graph into memory.\n- **ALWAYS** use named attribute access (`wall.Name`) instead of positional index access (`wall[2]`). Positional indices vary by entity type and schema version.\n- **ALWAYS** check `model.schema` before accessing schema-specific attributes.\n\n### Decision Tree: Entity Reference Safety\n\n```\nWorking with entity references?\n├── Reading attributes?\n│   ├── One attribute → entity.AttributeName (PascalCase)\n│   ├── All attributes → entity.get_info() (returns dict)\n│   └── Bulk read → entity.get_info(scalar_only=True) (faster)\n│\n├── Comparing entities?\n│   ├── Same entity? → entity_a == entity_b (value equality)\n│   ├── Same STEP ID? → entity_a.id() == entity_b.id()\n│   └── NEVER use → entity_a is entity_b (always False)\n│\n├── Removing entities?\n│   ├── With relationship cleanup → ifcopenshell.api.run(\"root.remove_product\", model, product=entity)\n│   ├── Low-level removal → model.remove(entity) (does NOT clean relationships)\n│   └── After removal → entity_ref = None (ALWAYS nullify)\n│\n└── Storing references across operations?\n    ├── Store entity.id() instead of the entity object\n    ├── Re-fetch with model.by_id(stored_id) when needed\n    └── NEVER cache entity objects across remove\u002Fundo operations\n```\n\n### Decision Tree: Performance\n\n```\nPerformance-critical operation?\n├── Querying entities by type?\n│   ├── Use model.by_type(\"IfcWall\") → indexed, returns tuple\n│   ├── First call builds index (slow), subsequent calls are instant\n│   └── NEVER iterate all entities with manual is_a() filtering\n│\n├── Reading many attributes?\n│   ├── Single entity → entity.get_info() (one C++ round-trip)\n│   ├── Scalar values only → entity.get_info(scalar_only=True)\n│   └── AVOID get_info(recursive=True) (massive memory allocation)\n│\n├── Bulk entity creation?\n│   ├── \u003C 100 entities → ifcopenshell.api.run() (safe, handles metadata)\n│   ├── > 100 entities → model.create_entity() (5-10x faster, no undo tracking)\n│   └── Bulk mode → handle GlobalId, OwnerHistory (IFC2X3) manually\n│\n└── Large model (500MB+ \u002F 100k+ entities)?\n    ├── Memory: ifcopenshell.open() loads ENTIRE file into RAM\n    ├── Streaming: ifcopenshell.open(path, should_stream=True) (sequential only)\n    ├── Parallel: open SEPARATE file instances per thread\n    └── Cleanup: del model + gc.collect() to release C++ memory\n```\n\n---\n\n## Essential Patterns\n\n### Pattern 1: C++ Binding Architecture\n\nIfcOpenShell Python objects are thin wrappers around C++ objects managed by the `ifcopenshell_wrapper` module.\n\n```python\n# Schema-agnostic\nimport ifcopenshell\n\nmodel = ifcopenshell.open(\"model.ifc\")\nwall = model.by_type(\"IfcWall\")[0]\n\n# Python wrapper delegates to C++ core\ntype(wall)                    # \u003Cclass 'ifcopenshell.entity_instance'>\ntype(wall.wrapped_data)       # \u003Cclass 'ifcopenshell_wrapper.entity_instance'>\n\n# The wrapper holds a reference to its parent file\nwall.file  # Returns the ifcopenshell.file object\n```\n\n**Key implication:** Python garbage collection does NOT control C++ memory. The C++ backend allocates and deallocates independently. Calling `model.remove(entity)` frees the C++ object immediately, even if Python references still exist.\n\n### Pattern 2: Entity Identity\n\n```python\n# Schema-agnostic\nwall = model.by_type(\"IfcWall\")[0]\n\n# Two queries for the same entity return DIFFERENT Python wrapper objects\nwall_a = model.by_id(wall.id())\nwall_b = model.by_id(wall.id())\n\nwall_a == wall_b    # True  — value equality via wrapped_data comparison\nwall_a is wall_b    # False — different Python wrapper objects\n\n# ALWAYS compare with == or by STEP ID\nwall_a.id() == wall_b.id()  # True — same STEP ID (#42)\n```\n\n### Pattern 3: Entity Invalidation After Removal\n\n```python\n# Schema-agnostic\nwall = model.by_type(\"IfcWall\")[0]\nwall_id = wall.id()\n\n# Low-level removal deallocates the C++ object\nmodel.remove(wall)\n\n# DANGER: accessing wall after removal causes undefined behavior\n# wall.Name  → segfault or garbage data\n\n# ALWAYS nullify references after removal\nwall = None\n\n# To re-check existence, query by ID\ntry:\n    still_exists = model.by_id(wall_id)\nexcept RuntimeError:\n    still_exists = None  # Entity was removed\n\n# PREFER API removal for products (cleans up relationships)\nother_wall = model.by_type(\"IfcWall\")[0]\nifcopenshell.api.run(\"root.remove_product\", model, product=other_wall)\nother_wall = None  # Still must nullify\n```\n\n### Pattern 4: by_type() Return Semantics\n\n```python\n# Schema-agnostic\nwalls = model.by_type(\"IfcWall\")\n\ntype(walls)   # \u003Cclass 'tuple'> — NOT a list\nlen(walls)    # Number of IfcWall instances\n\n# First call for a type builds an internal C++ index (slower)\n# Subsequent calls for the same type use the cached index (instant)\n\n# To mutate the result, convert to list\nwall_list = list(walls)\nwall_list.append(some_other_entity)\n\n# Include subtypes (default behavior)\nall_walls = model.by_type(\"IfcWall\")  # Includes IfcWallStandardCase in IFC2X3\u002FIFC4\n\n# Exclude subtypes\nonly_walls = model.by_type(\"IfcWall\", include_subtypes=False)\n```\n\n### Pattern 5: PascalCase Attribute Access\n\n```python\n# Schema-agnostic\nwall = model.by_type(\"IfcWall\")[0]\n\n# Named access: PascalCase matching the IFC schema\nname = wall.Name                    # str or None\nglobal_id = wall.GlobalId           # str (22-char encoded GUID)\ndescription = wall.Description      # str or None\nobject_type = wall.ObjectType       # str or None\nowner_history = wall.OwnerHistory   # entity_instance or None\n\n# Positional access: fragile, varies by type and schema\nname = wall[2]  # AVOID: index 2 = Name for IfcWall, but varies for other types\n\n# Check if attribute has a value (IFC $null → Python None)\nif wall.Description is not None:\n    print(wall.Description)\n\n# is_a() checks the full class hierarchy\nwall.is_a(\"IfcWall\")              # True\nwall.is_a(\"IfcBuildingElement\")   # True (parent class)\nwall.is_a(\"IfcProduct\")           # True (grandparent)\nwall.is_a(\"IfcSlab\")              # False\n\n# get_info() returns all attributes as a dict\ninfo = wall.get_info()\n# {\"id\": 42, \"type\": \"IfcWall\", \"GlobalId\": \"...\", \"Name\": \"...\", ...}\n```\n\n### Pattern 6: Thread Safety\n\n```python\n# Schema-agnostic\n\n# SAFE: Read-only operations from multiple threads (no concurrent writes)\nimport concurrent.futures\n\ndef count_type(filepath, ifc_class):\n    model = ifcopenshell.open(filepath)  # Separate instance per thread\n    return len(model.by_type(ifc_class))\n\nwith concurrent.futures.ThreadPoolExecutor() as executor:\n    futures = {\n        executor.submit(count_type, \"model.ifc\", cls): cls\n        for cls in [\"IfcWall\", \"IfcSlab\", \"IfcDoor\"]\n    }\n\n# SAFE: Separate file instances per thread for writes\ndef process_copy(filepath, output_path):\n    local_model = ifcopenshell.open(filepath)\n    # Modify local_model freely — independent C++ instance\n    local_model.write(output_path)\n\n# UNSAFE: Multiple threads writing to the SAME model object\n# This WILL corrupt data or crash: no C++ locks exist\n```\n\n### Pattern 7: Memory Management for Large Models\n\n```python\n# Schema-agnostic\n# Standard open loads entire file into memory\nmodel = ifcopenshell.open(\"large_building.ifc\")  # May use 4-8GB RAM\n\n# Access specific attributes instead of materializing everything\nname = wall.Name                                          # 1 attribute\nmaterial = ifcopenshell.util.element.get_material(wall)   # Targeted query\n\n# AVOID: get_info(recursive=True) on large models\n# deep_info = wall.get_info(recursive=True)  # Massive memory allocation\n\n# Release a large model from memory\ndel model\nimport gc\ngc.collect()  # Ensures Python wrappers are cleaned up and C++ memory freed\n```\n\n### Pattern 8: File Lifecycle: Keep File Reference Alive\n\n```python\n# Schema-agnostic\n# DANGEROUS: File reference lost while entities are in use\ndef get_walls():\n    model = ifcopenshell.open(\"model.ifc\")\n    return model.by_type(\"IfcWall\")  # model goes out of scope after return\n\nwalls = get_walls()\n# model is garbage-collected → all entity wrappers are dangling pointers\n# walls[0].Name  → SEGFAULT\n\n# SAFE: Return both the model and the entities\ndef get_walls_safe():\n    model = ifcopenshell.open(\"model.ifc\")\n    walls = model.by_type(\"IfcWall\")\n    return model, walls\n\nmodel, walls = get_walls_safe()\nwalls[0].Name  # Safe — model reference kept alive\n```\n\n---\n\n## Schema-Specific Attribute Differences\n\n```python\n# ALWAYS check schema before accessing schema-specific attributes\nschema = model.schema  # \"IFC2X3\", \"IFC4\", \"IFC4X3\"\n\n# Entities that differ by schema:\n# IFC2X3\u002FIFC4: IfcWallStandardCase exists\n# IFC4X3: IfcWallStandardCase does NOT exist: use IfcWall\n\n# IFC2X3: IfcDoorStyle, IfcWindowStyle\n# IFC4+:  IfcDoorType, IfcWindowType\n\n# IFC2X3: OwnerHistory is REQUIRED on rooted entities\n# IFC4+:  OwnerHistory is OPTIONAL\n\n# IFC4X3: IfcBuiltElement replaces IfcBuildingElement\n# IFC4X3: New entities: IfcAlignment, IfcRoad, IfcBridge, IfcFacility\n\n# Accessing a non-existent attribute raises AttributeError\ntry:\n    pt = task.PredefinedType  # Exists in IFC4, not in IFC2X3\nexcept AttributeError:\n    pt = None\n```\n\n---\n\n## Installation\n\n### pip (Recommended for Most Users)\n\n```bash\npip install ifcopenshell\npython -c \"import ifcopenshell; print(ifcopenshell.version)\"\n```\n\n- Pre-built wheels for Python 3.8-3.12 on Linux, macOS, Windows\n- Package name is `ifcopenshell` (all lowercase)\n- Bundles C++ core and OpenCASCADE dependencies\n\n### conda (Recommended for Complex Environments)\n\n```bash\nconda install -c conda-forge ifcopenshell\n```\n\n- Better dependency resolution for OpenCASCADE\n- More up-to-date than pip releases\n\n### Blender Integration\n\n```bash\n# Bonsai addon bundles ifcopenshell: no separate install needed\n# For standalone install into Blender's Python:\n\u002Fpath\u002Fto\u002Fblender\u002Fpython\u002Fbin\u002Fpython -m pip install ifcopenshell\n```\n\n### Platform Notes\n\n| Platform | Note |\n|----------|------|\n| Windows | pip works out-of-the-box. For Blender: install into Blender's Python. Watch for PATH conflicts. |\n| macOS | Works on Intel and Apple Silicon. Use native arm64 Python, not Rosetta. |\n| Linux | Works on most distributions. Headless\u002FDocker: no GPU needed. |\n\n---\n\n## Version Detection\n\n```python\nimport ifcopenshell\n\n# Library version\nifcopenshell.version  # e.g., \"0.8.1\"\n\n# Schema of an open file\nmodel = ifcopenshell.open(\"model.ifc\")\nmodel.schema             # \"IFC2X3\", \"IFC4\", or \"IFC4X3\"\nmodel.schema_identifier  # e.g., \"IFC4_ADD2\"\nmodel.schema_version     # e.g., (4, 0, 2, 1)\n```\n\n---\n\n## Reference Links\n\n- [API Method Signatures](references\u002Fmethods.md) — Complete signatures for entity_instance, file, by_type, remove, schema\n- [Working Code Examples](references\u002Fexamples.md) — End-to-end runtime patterns\n- [Anti-Patterns](references\u002Fanti-patterns.md) — Common runtime mistakes and how to avoid them\n","# IfcOpenShell Python Runtime\n\n## Quick Reference\n\n### Critical Warnings\n\n- **ALWAYS** use `==` for entity comparison, NEVER `is`. Each query returns a new Python wrapper object.\n- **ALWAYS** set entity references to `None` after calling `model.remove()`. The C++ object is deallocated regardless of Python reference count.\n- **ALWAYS** keep a reference to the `ifcopenshell.file` object alive while any entities from it are in use. If the file is garbage-collected, all entity wrappers become dangling pointers (segfault).\n- **NEVER** write to an `ifcopenshell.file` from multiple threads. The C++ backend has no locking. Concurrent writes corrupt the model or crash.\n- **NEVER** iterate all entities and filter manually when `by_type()` exists. `by_type()` uses an internal index and is 10-100x faster.\n- **NEVER** use `get_info(recursive=True)` on large models. It materializes the entire entity graph into memory.\n- **ALWAYS** use named attribute access (`wall.Name`) instead of positional index access (`wall[2]`). Positional indices vary by entity type and schema version.\n- **ALWAYS** check `model.schema` before accessing schema-specific attributes.\n\n### Decision Tree: Entity Reference Safety\n\n```\nWorking with entity references?\n├── Reading attributes?\n│   ├── One attribute → entity.AttributeName (PascalCase)\n│   ├── All attributes → entity.get_info() (returns dict)\n│   └── Bulk read → entity.get_info(scalar_only=True) (faster)\n│\n├── Comparing entities?\n│   ├── Same entity? → entity_a == entity_b (value equality)\n│   ├── Same STEP ID? → entity_a.id() == entity_b.id()\n│   └── NEVER use → entity_a is entity_b (always False)\n│\n├── Removing entities?\n│   ├── With relationship cleanup → ifcopenshell.api.run(\"root.remove_product\", model, product=entity)\n│   ├── Low-level removal → model.remove(entity) (does NOT clean relationships)\n│   └── After removal → entity_ref = None (ALWAYS nullify)\n│\n└── Storing references across operations?\n    ├── Store entity.id() instead of the entity object\n    ├── Re-fetch with model.by_id(stored_id) when needed\n    └── NEVER cache entity objects across remove\u002Fundo operations\n```\n\n### Decision Tree: Performance\n\n```\nPerformance-critical operation?\n├── Querying entities by type?\n│   ├── Use model.by_type(\"IfcWall\") → indexed, returns tuple\n│   ├── First call builds index (slow), subsequent calls are instant\n│   └── NEVER iterate all entities with manual is_a() filtering\n│\n├── Reading many attributes?\n│   ├── Single entity → entity.get_info() (one C++ round-trip)\n│   ├── Scalar values only → entity.get_info(scalar_only=True)\n│   └── AVOID get_info(recursive=True) (massive memory allocation)\n│\n├── Bulk entity creation?\n│   ├── \u003C 100 entities → ifcopenshell.api.run() (safe, handles metadata)\n│   ├── > 100 entities → model.create_entity() (5-10x faster, no undo tracking)\n│   └── Bulk mode → handle GlobalId, OwnerHistory (IFC2X3) manually\n│\n└── Large model (500MB+ \u002F 100k+ entities)?\n    ├── Memory: ifcopenshell.open() loads ENTIRE file into RAM\n    ├── Streaming: ifcopenshell.open(path, should_stream=True) (sequential only)\n    ├── Parallel: open SEPARATE file instances per thread\n    └── Cleanup: del model + gc.collect() to release C++ memory\n```\n\n---\n\n## Essential Patterns\n\n### Pattern 1: C++ Binding Architecture\n\nIfcOpenShell Python objects are thin wrappers around C++ objects managed by the `ifcopenshell_wrapper` module.\n\n```python\n# Schema-agnostic\nimport ifcopenshell\n\nmodel = ifcopenshell.open(\"model.ifc\")\nwall = model.by_type(\"IfcWall\")[0]\n\n# Python wrapper delegates to C++ core\ntype(wall)                    # \u003Cclass 'ifcopenshell.entity_instance'>\ntype(wall.wrapped_data)       # \u003Cclass 'ifcopenshell_wrapper.entity_instance'>\n\n# The wrapper holds a reference to its parent file\nwall.file  # Returns the ifcopenshell.file object\n```\n\n**Key implication:** Python garbage collection does NOT control C++ memory. The C++ backend allocates and deallocates independently. Calling `model.remove(entity)` frees the C++ object immediately, even if Python references still exist.\n\n### Pattern 2: Entity Identity\n\n```python\n# Schema-agnostic\nwall = model.by_type(\"IfcWall\")[0]\n\n# Two queries for the same entity return DIFFERENT Python wrapper objects\nwall_a = model.by_id(wall.id())\nwall_b = model.by_id(wall.id())\n\nwall_a == wall_b    # True  — value equality via wrapped_data comparison\nwall_a is wall_b    # False — different Python wrapper objects\n\n# ALWAYS compare with == or by STEP ID\nwall_a.id() == wall_b.id()  # True — same STEP ID (#42)\n```\n\n### Pattern 3: Entity Invalidation After Removal\n\n```python\n# Schema-agnostic\nwall = model.by_type(\"IfcWall\")[0]\nwall_id = wall.id()\n\n# Low-level removal deallocates the C++ object\nmodel.remove(wall)\n\n# DANGER: accessing wall after removal causes undefined behavior\n# wall.Name  → segfault or garbage data\n\n# ALWAYS nullify references after removal\nwall = None\n\n# To re-check existence, query by ID\ntry:\n    still_exists = model.by_id(wall_id)\nexcept RuntimeError:\n    still_exists = None  # Entity was removed\n\n# PREFER API removal for products (cleans up relationships)\nother_wall = model.by_type(\"IfcWall\")[0]\nifcopenshell.api.run(\"root.remove_product\", model, product=other_wall)\nother_wall = None  # Still must nullify\n```\n\n### Pattern 4: by_type() Return Semantics\n\n```python\n# Schema-agnostic\nwalls = model.by_type(\"IfcWall\")\n\ntype(walls)   # \u003Cclass 'tuple'> — NOT a list\nlen(walls)    # Number of IfcWall instances\n\n# First call for a type builds an internal C++ index (slower)\n# Subsequent calls for the same type use the cached index (instant)\n\n# To mutate the result, convert to list\nwall_list = list(walls)\nwall_list.append(some_other_entity)\n\n# Include subtypes (default behavior)\nall_walls = model.by_type(\"IfcWall\")  # Includes IfcWallStandardCase in IFC2X3\u002FIFC4\n\n# Exclude subtypes\nonly_walls = model.by_type(\"IfcWall\", include_subtypes=False)\n```\n\n### Pattern 5: PascalCase Attribute Access\n\n```python\n# Schema-agnostic\nwall = model.by_type(\"IfcWall\")[0]\n\n# Named access: PascalCase matching the IFC schema\nname = wall.Name                    # str or None\nglobal_id = wall.GlobalId           # str (22-char encoded GUID)\ndescription = wall.Description      # str or None\nobject_type = wall.ObjectType       # str or None\nowner_history = wall.OwnerHistory   # entity_instance or None\n\n# Positional access: fragile, varies by type and schema\nname = wall[2]  # AVOID: index 2 = Name for IfcWall, but varies for other types\n\n# Check if attribute has a value (IFC $null → Python None)\nif wall.Description is not None:\n    print(wall.Description)\n\n# is_a() checks the full class hierarchy\nwall.is_a(\"IfcWall\")              # True\nwall.is_a(\"IfcBuildingElement\")   # True (parent class)\nwall.is_a(\"IfcProduct\")           # True (grandparent)\nwall.is_a(\"IfcSlab\")              # False\n\n# get_info() returns all attributes as a dict\ninfo = wall.get_info()\n# {\"id\": 42, \"type\": \"IfcWall\", \"GlobalId\": \"...\", \"Name\": \"...\", ...}\n```\n\n### Pattern 6: Thread Safety\n\n```python\n# Schema-agnostic\n\n# SAFE: Read-only operations from multiple threads (no concurrent writes)\nimport concurrent.futures\n\ndef count_type(filepath, ifc_class):\n    model = ifcopenshell.open(filepath)  # Separate instance per thread\n    return len(model.by_type(ifc_class))\n\nwith concurrent.futures.ThreadPoolExecutor() as executor:\n    futures = {\n        executor.submit(count_type, \"model.ifc\", cls): cls\n        for cls in [\"IfcWall\", \"IfcSlab\", \"IfcDoor\"]\n    }\n\n# SAFE: Separate file instances per thread for writes\ndef process_copy(filepath, output_path):\n    local_model = ifcopenshell.open(filepath)\n    # Modify local_model freely — independent C++ instance\n    local_model.write(output_path)\n\n# UNSAFE: Multiple threads writing to the SAME model object\n# This WILL corrupt data or crash: no C++ locks exist\n```\n\n### Pattern 7: Memory Management for Large Models\n\n```python\n# Schema-agnostic\n# Standard open loads entire file into memory\nmodel = ifcopenshell.open(\"large_building.ifc\")  # May use 4-8GB RAM\n\n# Access specific attributes instead of materializing everything\nname = wall.Name                                          # 1 attribute\nmaterial = ifcopenshell.util.element.get_material(wall)   # Targeted query\n\n# AVOID: get_info(recursive=True) on large models\n# deep_info = wall.get_info(recursive=True)  # Massive memory allocation\n\n# Release a large model from memory\ndel model\nimport gc\ngc.collect()  # Ensures Python wrappers are cleaned up and C++ memory freed\n```\n\n### Pattern 8: File Lifecycle: Keep File Reference Alive\n\n```python\n# Schema-agnostic\n# DANGEROUS: File reference lost while entities are in use\ndef get_walls():\n    model = ifcopenshell.open(\"model.ifc\")\n    return model.by_type(\"IfcWall\")  # model goes out of scope after return\n\nwalls = get_walls()\n# model is garbage-collected → all entity wrappers are dangling pointers\n# walls[0].Name  → SEGFAULT\n\n# SAFE: Return both the model and the entities\ndef get_walls_safe():\n    model = ifcopenshell.open(\"model.ifc\")\n    walls = model.by_type(\"IfcWall\")\n    return model, walls\n\nmodel, walls = get_walls_safe()\nwalls[0].Name  # Safe — model reference kept alive\n```\n\n---\n\n## Schema-Specific Attribute Differences\n\n```python\n# ALWAYS check schema before accessing schema-specific attributes\nschema = model.schema  # \"IFC2X3\", \"IFC4\", \"IFC4X3\"\n\n# Entities that differ by schema:\n# IFC2X3\u002FIFC4: IfcWallStandardCase exists\n# IFC4X3: IfcWallStandardCase does NOT exist: use IfcWall\n\n# IFC2X3: IfcDoorStyle, IfcWindowStyle\n# IFC4+:  IfcDoorType, IfcWindowType\n\n# IFC2X3: OwnerHistory is REQUIRED on rooted entities\n# IFC4+:  OwnerHistory is OPTIONAL\n\n# IFC4X3: IfcBuiltElement replaces IfcBuildingElement\n# IFC4X3: New entities: IfcAlignment, IfcRoad, IfcBridge, IfcFacility\n\n# Accessing a non-existent attribute raises AttributeError\ntry:\n    pt = task.PredefinedType  # Exists in IFC4, not in IFC2X3\nexcept AttributeError:\n    pt = None\n```\n\n---\n\n## Installation\n\n### pip (Recommended for Most Users)\n\n```bash\npip install ifcopenshell\npython -c \"import ifcopenshell; print(ifcopenshell.version)\"\n```\n\n- Pre-built wheels for Python 3.8-3.12 on Linux, macOS, Windows\n- Package name is `ifcopenshell` (all lowercase)\n- Bundles C++ core and OpenCASCADE dependencies\n\n### conda (Recommended for Complex Environments)\n\n```bash\nconda install -c conda-forge ifcopenshell\n```\n\n- Better dependency resolution for OpenCASCADE\n- More up-to-date than pip releases\n\n### Blender Integration\n\n```bash\n# Bonsai addon bundles ifcopenshell: no separate install needed\n# For standalone install into Blender's Python:\n\u002Fpath\u002Fto\u002Fblender\u002Fpython\u002Fbin\u002Fpython -m pip install ifcopenshell\n```\n\n### Platform Notes\n\n| Platform | Note |\n|----------|------|\n| Windows | pip works out-of-the-box. For Blender: install into Blender's Python. Watch for PATH conflicts. |\n| macOS | Works on Intel and Apple Silicon. Use native arm64 Python, not Rosetta. |\n| Linux | Works on most distributions. Headless\u002FDocker: no GPU needed. |\n\n---\n\n## Version Detection\n\n```python\nimport ifcopenshell\n\n# Library version\nifcopenshell.version  # e.g., \"0.8.1\"\n\n# Schema of an open file\nmodel = ifcopenshell.open(\"model.ifc\")\nmodel.schema             # \"IFC2X3\", \"IFC4\", or \"IFC4X3\"\nmodel.schema_identifier  # e.g., \"IFC4_ADD2\"\nmodel.schema_version     # e.g., (4, 0, 2, 1)\n```\n\n---\n\n## Reference Links\n\n- [API Method Signatures](references\u002Fmethods.md) — Complete signatures for entity_instance, file, by_type, remove, schema\n- [Working Code Examples](references\u002Fexamples.md) — End-to-end runtime patterns\n- [Anti-Patterns](references\u002Fanti-patterns.md) — Common runtime mistakes and how to avoid them\n",{"name":5,"license":14,"metadata":23,"description":26,"compatibility":27},{"author":24,"version":25},"OpenAEC-Foundation","1.0","Use when debugging IfcOpenShell crashes, entity reference errors, or performance issues. Prevents the common pitfall of comparing entities with == instead of checking .id() or identity, or holding references to entities after removal. Covers C++ binding behavior, entity invalidation, by_type() return semantics, thread safety, memory management, PascalCase attributes, and installation patterns. Keywords: IfcOpenShell runtime, C++ binding, entity invalidation, by_type, thread safety, memory management, PascalCase, installation, entity identity, install IfcOpenShell, pip install ifcopenshell.\n","Designed for Claude Code. Requires IfcOpenShell Python library.","main","9bb7acf0c2ec4f44373969cb14e55af3c9a8385f","plugins\u002Fblender-bim-sverchok\u002Fskills\u002Fifcopenshell\u002Fcore\u002Fifcos-core-runtime","https:\u002F\u002Fgithub.com\u002Flagzgabrielmuller-dot\u002Fkit-ingenieria-3d","https:\u002F\u002Fgithub.com\u002Flagzgabrielmuller-dot","2026-11-09 13:26:47",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add lagzgabrielmuller-dot\u002Fkit-ingenieria-3d --skill ifcos-core-runtime",{"tool":40,"command":41},"bunx","bunx skills add lagzgabrielmuller-dot\u002Fkit-ingenieria-3d --skill ifcos-core-runtime",{"tool":43,"command":44},"pnpm","pnpm dlx skills add lagzgabrielmuller-dot\u002Fkit-ingenieria-3d --skill ifcos-core-runtime","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flagzgabrielmuller-dot\u002Fkit-ingenieria-3d\u002Fblob\u002Fmain\u002Fplugins\u002Fblender-bim-sverchok\u002Fskills\u002Fifcopenshell\u002Fcore\u002Fifcos-core-runtime\u002FSKILL.md",true,[48,54,58],{"path":49,"resourceType":50,"resourceTypeDesc":51,"sizeBytes":52,"sourceHtmlUrl":53},"references\u002Fanti-patterns.md","REFERENCE","参考文档",10032,"https:\u002F\u002Fgithub.com\u002Flagzgabrielmuller-dot\u002Fkit-ingenieria-3d\u002Fblob\u002Fmain\u002Fplugins\u002Fblender-bim-sverchok\u002Fskills\u002Fifcopenshell\u002Fcore\u002Fifcos-core-runtime\u002Freferences\u002Fanti-patterns.md",{"path":55,"resourceType":50,"resourceTypeDesc":51,"sizeBytes":56,"sourceHtmlUrl":57},"references\u002Fexamples.md",8362,"https:\u002F\u002Fgithub.com\u002Flagzgabrielmuller-dot\u002Fkit-ingenieria-3d\u002Fblob\u002Fmain\u002Fplugins\u002Fblender-bim-sverchok\u002Fskills\u002Fifcopenshell\u002Fcore\u002Fifcos-core-runtime\u002Freferences\u002Fexamples.md",{"path":59,"resourceType":50,"resourceTypeDesc":51,"sizeBytes":60,"sourceHtmlUrl":61},"references\u002Fmethods.md",8229,"https:\u002F\u002Fgithub.com\u002Flagzgabrielmuller-dot\u002Fkit-ingenieria-3d\u002Fblob\u002Fmain\u002Fplugins\u002Fblender-bim-sverchok\u002Fskills\u002Fifcopenshell\u002Fcore\u002Fifcos-core-runtime\u002Freferences\u002Fmethods.md",[63,71,78,85,92,99],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":67,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":18},"01M7FBFSZ93YM463CGS91D0TZG","manimce-best-practices","Trigger when: (1) User mentions \"manim\" or \"Manim Community\" or \"ManimCE\", (2) Code contains `from manim import *`, (3) User runs `manim` CLI commands, (4) Working with Scene, MathTex, Create(), or ManimCE-specific classes.\n\nBest practices for Manim Community Edition - the community-maintained Python animation engine. Covers Scene structure, animations, LaTeX\u002FMathTex, 3D with ThreeDScene, camera control, styling, and CLI usage.\n\nNOT for ManimGL\u002F3b1b version (which uses `manimlib` imports and `manimgl` CLI).","https:\u002F\u002Fgithub.com\u002Flagzgabrielmuller-dot\u002Fkit-ingenieria-3d\u002Fblob\u002Fmain\u002Fplugins\u002Fmanim-animaciones\u002Fskills\u002Fmanimce-best-practices\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Flagzgabrielmuller-dot\u002Fkit-ingenieria-3d\u002Fblob\u002Fmain\u002Fplugins\u002Fmanim-animaciones\u002Fskills\u002Fmanimce-best-practices\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":18},"01M7FB2K59HNNXS9WKHAMWHC3C","drawio","Create, edit, replicate, import, and export draw.io diagrams with an offline YAML-first workflow: architecture, network topologies, flowcharts, UML\u002FER, org charts, Mermaid\u002FCSV conversion, existing .drawio bundles, style presets, themes, and non-publication formula diagrams. For publication figures (paper, thesis, IEEE, camera-ready) use drawio-academic-skills instead.","https:\u002F\u002Fgithub.com\u002Flagzgabrielmuller-dot\u002Fkit-ingenieria-3d\u002Fblob\u002Fmain\u002Fplugins\u002Fdiagramas-y-documentos\u002Fskills\u002Fdrawio\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":18},"01M7FB2BWX7GWK9H2X8BGCYDDD","drawio-academic-skills","Publication-figure overlay for draw.io. Use instead of drawio whenever the diagram is for a paper, thesis, dissertation, journal, conference, IEEE\u002FACM submission, manuscript, camera-ready, Word\u002FLaTeX figure, or other publication. Applies venue, figure-type, color, caption\u002Flegend, formula, and paper-readability gates for architecture, workflow, roadmap, network-topology, and replicated paper figures.","https:\u002F\u002Fgithub.com\u002Flagzgabrielmuller-dot\u002Fkit-ingenieria-3d\u002Fblob\u002Fmain\u002Fplugins\u002Fdiagramas-y-documentos\u002Fskills\u002Fdrawio-academic-skills\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":18},"01M7FB22JESEAV8T15DJT3D444","uncertainty-and-units","Tracks physical units and propagates measurement uncertainty in scientific calculations using pint and uncertainties. Use for unit conversion and dimensional checking, GUM uncertainty budgets, Type A and Type B evaluation, coverage factors and expanded uncertainty, Monte Carlo propagation, significant-figure and plus-minus reporting, error propagation through curve fits, CODATA constants, auditing Python code for stripped units or broken uncertainty propagation, and order-of-magnitude plausibility checks using dimensionless groups (Reynolds, Peclet, Damkohler, Knudsen, Biot, Womersley), characteristic scales such as diffusion time or Debye length, and observed magnitude ranges. Trigger on \"is this number physically reasonable\", \"sanity check these units\", \"what regime is this flow in\", or a result that looks off by orders of magnitude.","https:\u002F\u002Fgithub.com\u002Flagzgabrielmuller-dot\u002Fkit-ingenieria-3d\u002Fblob\u002Fmain\u002Fplugins\u002Fciencia-y-calculo\u002Fskills\u002Funcertainty-and-units\u002FSKILL.md",[],[],{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":18},"01M7FB1ANRSG28R335FDY9SA3R","statistical-analysis","Guided statistical analysis for research data - test selection, assumption checking, effect sizes, power analysis, Bayesian alternatives, and APA-formatted reporting. Use whenever a user wants to compare groups, test a hypothesis, analyze experimental or survey data, check statistical assumptions, compute required sample sizes, or write up results - even if they never name a specific test. Covers t-tests, ANOVA, chi-square, correlation, regression, non-parametric and Bayesian methods. For low-level model APIs, see the statsmodels and pymc skills.","https:\u002F\u002Fgithub.com\u002Flagzgabrielmuller-dot\u002Fkit-ingenieria-3d\u002Fblob\u002Fmain\u002Fplugins\u002Fciencia-y-calculo\u002Fskills\u002Fstatistical-analysis\u002FSKILL.md",[],[],{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":18},"01M7FB15KRA9D7JCPH4P9T6XJY","simpy","Builds, inspects, tests, and analyzes bounded process-based discrete-event simulations with SimPy. Use for event scheduling, resource queues, interrupts, monitoring, independent replications, warm-up, and reproducible output analysis.","https:\u002F\u002Fgithub.com\u002Flagzgabrielmuller-dot\u002Fkit-ingenieria-3d\u002Fblob\u002Fmain\u002Fplugins\u002Fciencia-y-calculo\u002Fskills\u002Fsimpy\u002FSKILL.md",[],[]]