mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-21 07:52:32 +00:00
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:
@@ -3534,6 +3534,16 @@ DesignPanel::DesignPanel(wxWindow* parent)
|
||||
m_viewport->request_repaint();
|
||||
});
|
||||
|
||||
// Helix handles: a drag reports the whole triple, since pitch and height are coupled
|
||||
// through the turn count and reading one without the others would show a stale curve.
|
||||
m_viewport->set_on_helix_changed([this](double radius, double pitch, double height) {
|
||||
if (m_helix_radius) m_helix_radius->SetValue(radius);
|
||||
if (m_helix_pitch) m_helix_pitch->SetValue(pitch);
|
||||
if (m_helix_height) m_helix_height->SetValue(height);
|
||||
update_helix_gizmo(); // re-feed so the curve follows the drag
|
||||
m_viewport->request_repaint();
|
||||
});
|
||||
|
||||
// Clicking a ghost base plane sets the base graphically (replaces the dropdown). A base pick
|
||||
// drops any offset-from-face choice so the picked base plane wins, then re-resolves the preview.
|
||||
m_viewport->set_on_datum_base_picked([this](int base) {
|
||||
@@ -9100,6 +9110,18 @@ void DesignPanel::update_datum_gizmo()
|
||||
update_reference_planes(); // base ghosts (origins + datums) follow the tool/model state
|
||||
}
|
||||
|
||||
void DesignPanel::update_helix_gizmo()
|
||||
{
|
||||
if (!m_viewport) return;
|
||||
if (m_active != Tool::Helix) { m_viewport->clear_helix_gizmo(); return; }
|
||||
m_viewport->set_helix_gizmo(plane_from_choice(m_helix_plane->GetSelection()),
|
||||
m_helix_radius ? m_helix_radius->GetValue() : 0.0,
|
||||
m_helix_pitch ? m_helix_pitch->GetValue() : 1.0,
|
||||
m_helix_height ? m_helix_height->GetValue() : 0.0,
|
||||
m_helix_taper ? m_helix_taper->GetValue() : 0.0,
|
||||
m_helix_left_handed && m_helix_left_handed->GetValue());
|
||||
}
|
||||
|
||||
// Onshape default planes: the XY/XZ/YZ reference planes are persistent, transparent, labelled, and
|
||||
// larger than the bed — shown as the FALLBACK when there is no object yet. When the Plane tool is
|
||||
// open they additionally surface existing datums so a base can be picked. Single authority for the
|
||||
@@ -9166,6 +9188,7 @@ void DesignPanel::refresh_preview()
|
||||
for (wxButton* b : m_confirm_btns) if (b) b->Enable(true);
|
||||
m_status->Refresh();
|
||||
update_datum_gizmo(); // Plane card: show/refresh the in-canvas resize handles
|
||||
update_helix_gizmo(); // Helix card: draw the live curve + drag handles (no solid ghost)
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -9272,6 +9295,8 @@ void DesignPanel::refresh_preview()
|
||||
update_pattern_gizmo();
|
||||
// Datum-plane resize handles (self-gates: only while the Plane card is open).
|
||||
update_datum_gizmo();
|
||||
// Helix curve + handles (self-gates: only while the Helix card is open).
|
||||
update_helix_gizmo();
|
||||
update_operand_highlight();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user