mirror of
https://github.com/bherbruck/solidcraft.git
synced 2026-11-03 18:45:55 +00:00
UI tests: picks that name one thing, and a thread that names its start
- The shaft's rim was picked at its polyline's first point, the vertex where the wall's seam
meets it, as near the seam as the rim; SMLib's cylinder lists the seam first, so the pick
took it ("the edge is not circular", "the revolve axis does not lie in the sketch plane").
The rim is picked at its middle.
- The gear discs touch at x = 10, on both walls; G1 is picked on its far side.
- 366b90597 refuses a thread of some length picked in the middle of a face free at both ends
and asks for `from`; the cosmetic thread test gives it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -54,8 +54,9 @@ fn picked_gear_faces_choose_their_joints_and_radii() {
|
||||
let mut app = discs();
|
||||
app.start("joint.gear");
|
||||
let mut d = app.dialog.take().unwrap();
|
||||
// G2 first, G1 second: the joints follow the picks, whatever the dialog started on.
|
||||
for (i, p) in [Vec3::new(50.0, 0.0, 2.5), Vec3::new(10.0, 0.0, 2.5)].into_iter().enumerate() {
|
||||
// G2 first, G1 second: the joints follow the picks, whatever the dialog started on. The
|
||||
// discs touch at x = 10, on both walls, so G1 is picked on its far side.
|
||||
for (i, p) in [Vec3::new(50.0, 0.0, 2.5), Vec3::new(-10.0, 0.0, 2.5)].into_iter().enumerate() {
|
||||
d.active = i;
|
||||
let pick = wall(&app, p);
|
||||
d.pick(&app.session, pick);
|
||||
|
||||
@@ -24,7 +24,9 @@ fn shaft() -> Harness {
|
||||
h
|
||||
}
|
||||
|
||||
/// The shaft's wall, top rim and top cap, as picks.
|
||||
/// The shaft's wall, top rim and top cap, as picks. The rim is picked at the middle of its
|
||||
/// polyline: its first point is the vertex where the wall's seam meets it, as near the seam as
|
||||
/// the rim.
|
||||
fn picks(h: &Harness) -> (Sel, Sel, Sel) {
|
||||
use solidcraft_engine::kernel::{FaceSurface, face_surface};
|
||||
let st = h.app.session.world_state().unwrap();
|
||||
@@ -42,7 +44,7 @@ fn picks(h: &Harness) -> (Sel, Sel, Sel) {
|
||||
.enumerate()
|
||||
.find_map(|(index, e)| {
|
||||
let c = solidcraft_engine::kernel::edge_circle(&b.body, index)?;
|
||||
(c.center.z > 9.0).then(|| Sel::Edge { body: "Shaft".into(), index, point: e[0] })
|
||||
(c.center.z > 9.0).then(|| Sel::Edge { body: "Shaft".into(), index, point: crate::viewport::polyline_mid(e) })
|
||||
})
|
||||
.unwrap();
|
||||
(wall, rim, cap)
|
||||
|
||||
@@ -9473,7 +9473,8 @@ mod tests {
|
||||
fn cosmetic_threads_use_depth_tested_lines_and_keep_selection_and_wireframe() {
|
||||
let mut s = solidcraft_engine::Session::default();
|
||||
s.execute("solid.cylinder", &json!({"radius":3,"height":10})).unwrap();
|
||||
s.execute("solid.thread", &json!({"face":[3,0,5],"designation":"M6","length":5})).unwrap();
|
||||
// A pick in the middle of a face free at both ends names the end the thread starts from.
|
||||
s.execute("solid.thread", &json!({"face":[3,0,5],"designation":"M6","length":5,"from":[3,0,0]})).unwrap();
|
||||
let mut app = SolveApp::new(s, crate::Services::default());
|
||||
let count = |sc: GpuScene| {
|
||||
sc.merged()
|
||||
|
||||
Reference in New Issue
Block a user