Helix: draw the thing, then let the numbers be dragged

grep -i helix over the viewport code returned nothing at all. The tool was four
coupled numbers and a Confirm button — you typed radius, pitch, height and taper
blind and pressed OK to find out what you had made. So this is not only the
charter's L2 failure; the tool had no visible state whatsoever while it was open.

Adds a plane-anchored helix gizmo built on the datum-plane gizmo as its template,
being the closest existing thing: also plane-anchored, also driven by a card while
the sketch tool is inactive, also a render / hit-test / drag triad.

It draws the live curve and the axis, and puts a handle on each of the three
lengths: radius on the base circle, height at the top of the axis, pitch at the
end of the first turn — which is exactly where one pitch of rise lands, so the
handle means what it is standing on. Below one full turn the pitch handle moves
to the end of the curve rather than floating off a curve that does not exist yet.

Taper and handedness stay on the card. One is a shape modifier and the other a
flag; L2 governs numbers you can point at.

A drag reports the whole (radius, pitch, height) triple rather than one value,
because pitch and height are coupled through the turn count and writing one alone
would redraw a stale curve. The callback re-feeds the gizmo directly instead of
going through refresh_preview(), since Helix takes the produces-no-solid early
return and refresh_preview would rewrite the status line on every mouse move.

REVIEW CATCH, fixed here: the first cut read taper as a fraction of the radius
consumed over the turn count. It is an ANGLE IN DEGREES — helix_spine() builds a
Geom_ConicalSurface of half-angle taper and takes the top radius as R+H*tan(taper),
growing with the height risen. The wrong reading drew a preview that collapsed to
a point for any non-zero taper while the committed feature was perfectly fine. A
preview that lies is worse than no preview, which is what this commit replaced.

Reviewed and compiled (libslic3r_gui, RC=0); not exercised. snaporca-i3jc.
This commit is contained in:
Tommaso Bianchi
2026-08-12 20:40:21 +02:00
parent a5bb41e340
commit e8306a6e9a
6 changed files with 267 additions and 1 deletions
+18
View File
@@ -843,6 +843,24 @@ void DesignCanvas::set_on_datum_offset_changed(std::function<void(double)> cb)
m_sketch_tool.on_datum_offset_changed = std::move(cb);
}
void DesignCanvas::set_helix_gizmo(const SketchPlane& plane, double radius, double pitch,
double height, double taper, bool left_handed)
{
m_sketch_tool.set_helix_gizmo(plane, radius, pitch, height, taper, left_handed);
request_repaint();
}
void DesignCanvas::clear_helix_gizmo()
{
m_sketch_tool.clear_helix_gizmo();
request_repaint();
}
void DesignCanvas::set_on_helix_changed(std::function<void(double, double, double)> cb)
{
m_sketch_tool.on_helix_changed = std::move(cb);
}
void DesignCanvas::set_base_pick(std::vector<SketchPlane> planes, std::vector<int> bases,
std::vector<std::string> labels)
{