Fix PI picker viewport coordinate calculation and add georeference support

- Fix modal operator to use absolute mouse coordinates converted to 3D
  viewport region space, instead of event.mouse_region_x/y which are
  relative to whichever region received the event
- Store 3D viewport area, region, and region_data references in invoke()
  for consistent raycasting throughout modal operation
- Add coordinate transformation methods (blender_to_ifc_coordinates and
  ifc_to_blender_coordinates) for projects with geospatial Blender offsets
- Transform alignment curve vertices from IFC global to Blender local
  coordinates when has_blender_offset is enabled
- Add try/except for piecewise-step-size geometry setting in util.py

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
DesertSpringsCivil
2026-02-02 10:19:02 -07:00
parent 5ad40612fb
commit 95952d03f8
3 changed files with 204 additions and 13 deletions
@@ -93,8 +93,11 @@ def generate_vertices(rep_curve: entity_instance, distance_interval: float = 5.0
try:
s.set("piecewise-step-type", 0) # 0 = step-size is maximum step size, 1 = step-size is mininimum number of steps
except RuntimeError:
pass # Setting not available in older IfcOpenShell versions
s.set("piecewise-step-size", distance_interval)
print("[util.py] piecewise-step-type setting not available, skipping")
try:
s.set("piecewise-step-size", distance_interval)
except RuntimeError:
print("[util.py] piecewise-step-size setting not available, skipping")
shape = ifcopenshell.geom.create_shape(s, rep_curve)
vertices = shape.verts
if len(vertices) == 0: