Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Rob2309
Copy link
Contributor

@Rob2309 Rob2309 commented Aug 12, 2025

This PR addresses a few issues with the plan view.

Together with #6986 and #7003, plan view is much easier to work with.

Cut geometry not updating properly

Previously, placing a door / window into a wall resulted in the "fill" geometry not updating correctly, while the "cut" geometry updated normally. This is now fixed.

Before After
image image

Snapping to cut geometry

Previously, it was very hard to place doors / windows into a wall, as snapping seemed to prefer the floor slab. This was somewhat fixed by adding logic to snap to the "cut" and "fill" geometry in plan mode. Additionally, if any viable snap point is found on this geometry, all other snap points are ignored.

Placing objects into the intended container

Previously, generic objects like furniture were always placed into the default container. This is especially frustrating in plan view, as only one storey will be visible most of the time.
With this PR, generic objects will be placed into the container of the object that is snapped to. The preview was also updated to accomodate this. The default container will only be used if no object was snapped to or the snapped object does not have a container.

Before After
image image

(Images taken in model view to better visualize what is happening)

This incidentally also fixes window / door previews (they were already placed in the snapped container, but the preview was not reflecting this), but this is explicitly fixed in #6986.

Using the appropriate representation for placement preview

Previously, when placing an object (e.g. a door), the current representation of the type object would be used. This would be the wrong preview if the type was last seen in a different mode (e.g. plan view). The preview now switches to the appropriate representation.

@Rob2309
Copy link
Contributor Author

Rob2309 commented Aug 22, 2025

@theoryshaw since you seem to be working in plan view a lot, you could test this PR as well if you have the time.

@theoryshaw
Copy link
Member

NP.

Got error when trying to place a door...

using: https://hub.openingdesign.com/OpeningDesign/Bonsai_Tutorials/src/commit/a53e49b75af162003ee40e214c4f095991f6695f/_Model/House.ifc

os: Windows
os_version: 10.0.26100
python_version: 3.11.7
architecture: ('64bit', 'WindowsPE')
machine: AMD64
processor: Intel64 Family 6 Model 191 Stepping 2, GenuineIntel
blender_version: 4.2.9 LTS
bonsai_version: 0.0.0
bonsai_commit_hash: 1758d16
bonsai_commit_date: 2025-08-18T17:24:07+02:00
last_actions: 
# ifcopenshell.api: geometry.map_representation
>>> {"representation": {"cast_type": "entity_instance", "value": 272579, "Name": null}}
# ifcopenshell.api: geometry.assign_representation
>>> {"product": {"cast_type": "entity_instance", "value": 2894943, "Name": "Window"}, "representation": {"cast_type": "entity_instance", "value": 2894958, "Name": null}}
# ifcopenshell.api: owner.update_owner_history
>>> {"element": {"cast_type": "entity_instance", "value": 2894943, "Name": "Window"}}
# ifcopenshell.api: spatial.assign_container
>>> {"products": [{"cast_type": "entity_instance", "value": 2894943, "Name": "Window"}], "relating_structure": {"cast_type": "entity_instance", "value": 40, "Name": "My Site"}}
# ifcopenshell.api: aggregate.unassign_object
>>> {"products": "[]"}
# ifcopenshell.api: owner.update_owner_history
>>> {"element": {"cast_type": "entity_instance", "value": 107560, "Name": null}}
# ifcopenshell.api: owner.update_owner_history
>>> {"element": {"cast_type": "entity_instance", "value": 615304, "Name": null}}
# ifcopenshell.api: geometry.edit_object_placement
>>> {"product": {"cast_type": "entity_instance", "value": 2894943, "Name": "Window"}, "matrix": {"cast_type": "ndarray", "value": [[1.0, 0.0, 0.0, 24.44831085205078], [0.0, 1.0, 0.0, -123.2313003540039], [0.0, 0.0, 1.0, 3.0384750366210938], [0.0, 0.0, 0.0, 1.0]]}}
# ifcopenshell.api: owner.update_owner_history
>>> {"element": {"cast_type": "entity_instance", "value": 2894943, "Name": "Window"}}
# operator: BIM_OT_draw_occurrence
# operator: BIM_OT_draw_occurrence
# operator: BIM_OT_draw_occurrence
# operator: BIM_OT_draw_occurrence
# operator: BIM_OT_draw_occurrence
# operator: BIM_OT_load_drawings
# operator: BIM_OT_activate_drawing
# operator: BIM_OT_activate_drawing_style
# ifcopenshell.api: pset.edit_pset
>>> {"pset": {"cast_type": "entity_instance", "value": 56043, "Name": "EPset_Drawing"}, "properties": "{'CurrentShadingStyle': 'Plan'}"}
# operator: BIM_OT_hotkey
# operator: BIM_OT_draw_occurrence
last_error: Traceback (most recent call last):
  File "C:\Users\olivi\AppData\Roaming\Blender Foundation\Blender\4.2\extensions\.local\lib\python3.11\site-packages\bonsai\bim\ifc.py", line 522, in execute_ifc_operator
    result = getattr(operator, "_execute")(context)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\olivi\AppData\Roaming\Blender Foundation\Blender\4.2\extensions\.local\lib\python3.11\site-packages\bonsai\bim\module\model\workspace.py", line 1132, in _execute
    getattr(self, f"hotkey_{self.hotkey}")()
  File "C:\Users\olivi\AppData\Roaming\Blender Foundation\Blender\4.2\extensions\.local\lib\python3.11\site-packages\bonsai\bim\module\model\workspace.py", line 1192, in hotkey_S_A
    return bpy.ops.bim.draw_occurrence("INVOKE_DEFAULT")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Blender Foundation\Blender 4.2\4.2\scripts\modules\bpy\ops.py", line 107, in __call__
    ret = _op_call(self.idname_py(), kw, C_exec, C_undo)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Error: Python: Traceback (most recent call last):
  File "C:\Users\olivi\AppData\Roaming\Blender Foundation\Blender\4.2\extensions\.local\lib\python3.11\site-packages\bonsai\bim\ifc.py", line 524, in execute_ifc_operator
    result = getattr(operator, "_invoke")(context, event)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\olivi\AppData\Roaming\Blender Foundation\Blender\4.2\extensions\.local\lib\python3.11\site-packages\bonsai\bim\module\model\product.py", line 265, in _invoke
    super().invoke(context, event)
  File "C:\Users\olivi\AppData\Roaming\Blender Foundation\Blender\4.2\extensions\.local\lib\python3.11\site-packages\bonsai\bim\module\model\polyline.py", line 1053, in invoke
    detected_snaps = tool.Snap.detect_snapping_points(context, event, self.objs_2d_bbox, self.tool_state)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\olivi\AppData\Roaming\Blender Foundation\Blender\4.2\extensions\.local\lib\python3.11\site-packages\bonsai\tool\snap.py", line 453, in detect_snapping_points
    bm.faces.new([bverts[vi] for vi in tri])
ValueError: faces.new(verts): face already exists
Location: C:\Program Files\Blender Foundation\Blender 4.2\4.2\scripts\modules\bpy\ops.py:107


ifc: House.ifc
schema: IFC4
preprocessor_version: IfcOpenShell 0.0.0
originating_system: Bonsai 0.8.4-alpha250730-b4452c0

@Rob2309
Copy link
Contributor Author

Rob2309 commented Aug 25, 2025

This issue should now be fixed, although I'm planning to add a bit of caching for better plan view performance...

@theoryshaw
Copy link
Member

I'm planning to add a bit of caching for better plan view performance...

If this means faster switching between drawings, that would be awesome.

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.

2 participants