- arc improvements, fillets, operations, bodys

This commit is contained in:
bklronin
2026-08-05 16:47:25 +02:00
parent a7e7a9f2c3
commit 1e9b0cab1c
15 changed files with 3506 additions and 92 deletions
+33
View File
@@ -1779,6 +1779,39 @@ class OCCSketch(SketchInterface):
return points
def get_line_axis(self, line_id: int) -> Optional[Tuple[Tuple[float, float, float], Tuple[float, float, float]]]:
"""Return ``((origin_x, origin_y, origin_z), (dir_x, dir_y, dir_z))`` for a line.
The axis is computed from the line's solved endpoints mapped into world
coordinates on the sketch workplane: origin = line start, direction =
normalized start→end. Returns ``None`` if the id is missing, not a
line, or degenerate. Used by the revolve tool and feature replay so
the revolve axis tracks the sketch line even after it is dragged.
"""
import math
ent = self._entities.get(line_id)
if ent is None or ent.entity_type != "line" or ent.is_external:
return None
geom = ent.geometry
if not geom or len(geom) != 2 or not geom[0] or not geom[1]:
return None
try:
start = self._uv_to_world(*geom[0])
end = self._uv_to_world(*geom[1])
except Exception:
return None
dx = end.X() - start.X()
dy = end.Y() - start.Y()
dz = end.Z() - start.Z()
length = math.sqrt(dx * dx + dy * dy + dz * dz)
if length < 1e-9:
return None
return (
(float(start.X()), float(start.Y()), float(start.Z())),
(dx / length, dy / length, dz / length),
)
def get_polygon_points(self) -> List[Point2D]:
"""Get ordered polygon points from connected lines (uses solved positions).