Skip to content

Integrate CAD Sketcher module#8098

Draft
falken10vdl wants to merge 13 commits into
IfcOpenShell:v0.8.0from
falken10vdl:cadsketcher-integration
Draft

Integrate CAD Sketcher module#8098
falken10vdl wants to merge 13 commits into
IfcOpenShell:v0.8.0from
falken10vdl:cadsketcher-integration

Conversation

@falken10vdl

@falken10vdl falken10vdl commented May 23, 2026

Copy link
Copy Markdown
Contributor

This PR integrates CAD Sketcher-driven authoring into Bonsai, so IFC elements can be created/updated directly from tagged CAD Sketcher entities.

It adds a dedicated cadsketcher module, exposes the fetch workflow in Bonsai UI, and supports both Plan and Elevation sketch roles (aligned with CAD Sketcher’s simplified role model).

Supported CAD Sketcher tags and output

  • Walls:
    • Plan: tagged lines and wall runs
    • Elevation: tagged wall polylines (including elevation profile handling)
  • Slabs, Coverings, Plates from closed polylines
  • Openings, Windows, Doors from tagged closed polylines (with host assignment support)
  • Beams, Members, Footings from lines/open polylines
  • Columns and Piles from points/height definitions
  • Reimport/update behavior preserves existing IFC linkage where possible (GUID-aware update path)

Sketch role model are now explicitly:

  • Plan
  • Elevation

Dependency / requirement
This integration requires CAD Sketcher addon changes from PR #550 to be present:

hlorus/CAD_Sketcher#550

Cheers!

Keep only CAD Sketcher integration changes, including Plan/Elevation role alignment.\n\nGenerated with the assistance of an AI coding tool.
Replace all per-entity .tag / .guid attribute access with the new
sketch.groups (SketchGroup / SketchGroupMember) data model:

- Add module-level helpers: _entity_guid, _set_entity_guid,
  _entities_with_ifc_tag, _ensure_entity_in_group, _entity_ifc_tag
- invoke(): entity discovery and GUID pre-population use helpers
- execute(): wall/profile/point element discovery + seg-group propagation
- _create_or_update_wall(): GUID ops guarded by isinstance(_FakeWallLine)
- _create_or_update_profile_element(): add sketch= param, derive ifc_tag
- _create_or_update_point_element(): add sketch= param, derive ifc_tag
- _create_or_update_{slab,covering,plate,opening,fill}: use helpers
- _get_*_polylines(): use _entities_with_ifc_tag instead of .tag filter
- _resolve_elevation_wall_guid(): use _entity_guid via src sketch lookup
- _find_orth_sketch_for_point(): position-only match, remove debug prints
- _ensure_column_height_line(): use _ensure_entity_in_group, no guid prop
- _create_wall_from_elevation_polyline(): group-aware GUID resolution and
  back-propagation to source plan line
- _auto_fetch_sketch(): all entity discovery and GUID ops use helpers
…i-tag

The SketchGroup.tag single StringProperty has been replaced by a
tags CollectionProperty on the CAD_Sketcher side. Update the five
module-level helper functions in operator.py to use the new API:

- group.tag != ifc_tag   → not group.has_tag(ifc_tag)
- group.tag = ifc_tag    → group.add_tag(ifc_tag)
- return group.tag       → vals = group.tag_values(); return vals[0] if vals else ''

Affected helpers: _entity_guid, _set_entity_guid,
_entities_with_ifc_tag, _ensure_entity_in_group, _entity_ifc_tag
@falken10vdl falken10vdl marked this pull request as draft May 27, 2026 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant