Prepare for simplifying `SweepSketch`

`SweepSketch` has two internal code paths. All models have so far been
using the more complicated one. This commit updates them to instead use
the more simple one, in preparation of removing the more complicated
one.
This commit is contained in:
Hanno Braun 2024-08-14 19:46:42 +02:00
parent b78358dfd9
commit 125c21c7e2
5 changed files with 11 additions and 8 deletions

View File

@ -14,7 +14,7 @@ pub fn model(size: impl Into<Vector<3>>, core: &mut fj::core::Core) -> Solid {
let [x, y, z] = size.into().components; let [x, y, z] = size.into().components;
let bottom_surface = core.layers.topology.surfaces.xy_plane(); let bottom_surface = core.layers.topology.surfaces.xy_plane();
let sweep_path = Vector::from([Scalar::ZERO, Scalar::ZERO, z]); let sweep_path = Vector::from([Scalar::ZERO, Scalar::ZERO, -z]);
Sketch::empty(&core.layers.topology) Sketch::empty(&core.layers.topology)
.add_regions( .add_regions(

View File

@ -18,7 +18,10 @@ pub fn model(radius: impl Into<Scalar>, core: &mut fj::core::Core) -> Solid {
cuboid.update_shell( cuboid.update_shell(
cuboid.shells().only(), cuboid.shells().only(),
|shell, core| { |shell, core| {
let bottom_face = shell.faces().first(); let bottom_face = shell
.faces()
.nth(5)
.expect("Expected shell to have bottom face");
let offset = size / 2.; let offset = size / 2.;
let depth = size / 2.; let depth = size / 2.;
@ -32,11 +35,11 @@ pub fn model(radius: impl Into<Scalar>, core: &mut fj::core::Core) -> Solid {
core, core,
); );
let bottom_face = shell.faces().first(); let bottom_face = shell
let top_face = shell
.faces() .faces()
.nth(5) .nth(5)
.expect("Expected shell to have top face"); .expect("Expected shell to have bottom face");
let top_face = shell.faces().first();
[shell.add_through_hole( [shell.add_through_hole(
[ [

View File

@ -18,7 +18,7 @@ pub fn model(
core: &mut fj::core::Core, core: &mut fj::core::Core,
) -> Solid { ) -> Solid {
let bottom_surface = core.layers.topology.surfaces.xy_plane(); let bottom_surface = core.layers.topology.surfaces.xy_plane();
let sweep_path = Vector::from([0., 0., height]); let sweep_path = Vector::from([0., 0., -height]);
Sketch::empty(&core.layers.topology) Sketch::empty(&core.layers.topology)
.add_regions( .add_regions(

View File

@ -22,7 +22,7 @@ pub fn model(size: f64, split_pos: f64, core: &mut fj::core::Core) -> Solid {
let (shell, [face, _]) = shell.split_face(face, line, core); let (shell, [face, _]) = shell.split_face(face, line, core);
[shell [shell
.sweep_face_of_shell(face, [0., 0., -size / 2.], core) .sweep_face_of_shell(face, [0., 0., size / 2.], core)
.shell] .shell]
}, },
core, core,

View File

@ -41,7 +41,7 @@ pub fn model(
} }
let bottom_surface = core.layers.topology.surfaces.xy_plane(); let bottom_surface = core.layers.topology.surfaces.xy_plane();
let sweep_path = Vector::from([0., 0., h]); let sweep_path = Vector::from([0., 0., -h]);
Sketch::empty(&core.layers.topology) Sketch::empty(&core.layers.topology)
.add_regions( .add_regions(