- added renderer

This commit is contained in:
bklronin
2026-07-12 22:21:20 +02:00
parent b8516fff91
commit 210e3cfb5d
12 changed files with 2628 additions and 1580 deletions
+26
View File
@@ -626,6 +626,17 @@ class OCCSketch(SketchInterface):
elif ctype == "equal_radius":
# tracked only (no solver entity)
pass
elif ctype == "diameter":
# Update circle radius in sketch data
circle_id = ids[0]
if circle_id in self._circles:
center_id, _ = self._circles[circle_id]
radius = params[0] / 2.0
self._circles[circle_id] = (center_id, radius)
ent = self._entities.get(circle_id)
if ent is not None and ent.geometry is not None:
cx, cy = ent.geometry[0] if isinstance(ent.geometry[0], tuple) else ent.geometry
ent.geometry = ((cx, cy), radius)
else:
return False
return True
@@ -788,6 +799,21 @@ class OCCSketch(SketchInterface):
self._record_constraint("equal_radius", (circle1.id, circle2.id))
return True
def constrain_diameter(self, circle: SketchEntity, diameter: float) -> bool:
"""Set the diameter of a circle."""
radius = diameter / 2.0
# Update the circle's radius in the sketch
if circle.id in self._circles:
center_id, _ = self._circles[circle.id]
self._circles[circle.id] = (center_id, radius)
# Update the entity geometry
ent = self._entities.get(circle.id)
if ent is not None:
cx, cy = ent.geometry
ent.geometry = ((cx, cy), radius)
self._record_constraint("diameter", (circle.id,), (diameter,))
return True
def constrain_fixed(self, entity: SketchEntity) -> bool:
"""Fix an entity in place via dragged constraint."""
ent = self._entities.get(entity.id)