Sweeps and pipes along 3D sketch curves (projected, intersection and included curves): a path that uses sketch wires is followed as one chain of points by a new kernel sweep_path (rotation-minimising frame; smooth B-spline walls per profile segment, or ruled walls mitred at sharp corners and for profiles with holes); 3D sketch curves can be picked as sweep paths
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AS5Tn3xieewUSg3uxrMVdL
This commit is contained in:
1 parent
3aacebdda4
commit
f79b5c1045
6 files changed
+487
-13
No files matched your search
@@ -2009,7 +2009,8 @@ fn source_features(s: &Session, bodies: &[String]) -> Vec<String> {
|
||||
/// The sketch holding all these curve ids (the active sketch first, never `not`).
|
||||
fn curves_sketch(app: &SolveApp, ids: &[String], not: Option<u64>) -> Option<u64> {
|
||||
let st = app.session.model.state();
|
||||
let has = |sid: u64| st.sketch(sid).is_some_and(|ss| ids.iter().all(|id| ss.sketch.curve_index(id).is_some()));
|
||||
let has =
|
||||
|sid: u64| st.sketch(sid).is_some_and(|ss| ids.iter().all(|id| ss.sketch.curve_index(id).is_some() || ss.sketch.wire_index(id).is_some()));
|
||||
if let Some(a) = app.session.active_sketch
|
||||
&& Some(a) != not
|
||||
&& has(a)
|
||||
|
||||
@@ -483,6 +483,16 @@ pub fn pick(app: &SolveApp, proj: &Proj, pos: Pos2) -> Vec<Hit> {
|
||||
}
|
||||
}
|
||||
}
|
||||
// 3D sketch curves (paths for sweeps and pipes).
|
||||
for w in &ss.sketch.wires {
|
||||
let pts: Vec<Pos2> = w.pts.iter().filter_map(|q| proj.to_screen(*q)).collect();
|
||||
for seg in pts.windows(2) {
|
||||
let dd = seg_dist(pos, seg[0], seg[1]) - bonus;
|
||||
if dd < 6.0 && bestc.as_ref().is_none_or(|(b, _)| dd < *b) {
|
||||
bestc = Some((dd, Hit::SketchCurve { sketch: sid, id: w.id.clone(), straight: false }));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some((_, h)) = bestc {
|
||||
hits.push(h);
|
||||
@@ -847,6 +857,16 @@ fn build_highlight(app: &SolveApp) -> GpuScene {
|
||||
}
|
||||
}
|
||||
Sel::Profile { sketch, index } => profile_fill(&mut sc, app, *sketch, *index, t.sel_profile, t.sel_profile_edge),
|
||||
// A 3D sketch curve, in whichever sketch has it.
|
||||
Sel::SketchCurve { id } if st.sketches.iter().any(|ss| ss.sketch.wire_index(id).is_some()) => {
|
||||
for ss in st.sketches.iter() {
|
||||
if let Some(w) = ss.sketch.wire_index(id).and_then(|i| ss.sketch.wires.get(i)) {
|
||||
for q in w.pts.windows(2) {
|
||||
sc.line(q[0].to_f32(), q[1].to_f32(), c4(t.sel_edge), 3.5, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Sel::SketchCurve { id } => {
|
||||
if let Some(ss) = app.session.active_sketch.and_then(|sid| st.sketch(sid))
|
||||
&& let Some(ci) = ss.sketch.curve_index(id)
|
||||
|
||||
Reference in new issue
Block a user