mirror of
https://github.com/hannobraun/Fornjot
synced 2025-02-02 05:15:54 +00:00
Re-use cuboid
model in split
model
This commit is contained in:
parent
4aaacc2af3
commit
c1d2fc1f1e
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -2989,6 +2989,7 @@ dependencies = [
|
|||||||
name = "split"
|
name = "split"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"cuboid",
|
||||||
"fj",
|
"fj",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -3,5 +3,9 @@ name = "split"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
|
|
||||||
[dependencies.fj]
|
[dependencies.fj]
|
||||||
path = "../../crates/fj"
|
path = "../../crates/fj"
|
||||||
|
|
||||||
|
[dependencies.cuboid]
|
||||||
|
path = "../cuboid"
|
||||||
|
@ -1,17 +1,11 @@
|
|||||||
use fj::{
|
use fj::core::{
|
||||||
core::{
|
objects::Solid,
|
||||||
objects::{Region, Sketch, Solid},
|
|
||||||
operations::{
|
operations::{
|
||||||
build::{BuildRegion, BuildSketch},
|
insert::Insert, split::SplitFace, sweep::SweepFaceOfShell,
|
||||||
insert::Insert,
|
update::UpdateSolid,
|
||||||
split::SplitFace,
|
|
||||||
sweep::{SweepFaceOfShell, SweepSketch},
|
|
||||||
update::{UpdateSketch, UpdateSolid},
|
|
||||||
},
|
},
|
||||||
services::Services,
|
services::Services,
|
||||||
storage::Handle,
|
storage::Handle,
|
||||||
},
|
|
||||||
math::Vector,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn model(
|
pub fn model(
|
||||||
@ -19,22 +13,7 @@ pub fn model(
|
|||||||
split_pos: f64,
|
split_pos: f64,
|
||||||
services: &mut Services,
|
services: &mut Services,
|
||||||
) -> Handle<Solid> {
|
) -> Handle<Solid> {
|
||||||
let sketch = Sketch::empty().add_region(
|
let solid = cuboid::model([size, size, size], services);
|
||||||
Region::polygon(
|
|
||||||
[
|
|
||||||
[-size / 2., -size / 2.],
|
|
||||||
[size / 2., -size / 2.],
|
|
||||||
[size / 2., size / 2.],
|
|
||||||
[-size / 2., size / 2.],
|
|
||||||
],
|
|
||||||
services,
|
|
||||||
)
|
|
||||||
.insert(services),
|
|
||||||
);
|
|
||||||
|
|
||||||
let surface = services.objects.surfaces.xy_plane();
|
|
||||||
let path = Vector::from([0., 0., size]);
|
|
||||||
let solid = sketch.sweep_sketch(surface, path, services);
|
|
||||||
|
|
||||||
solid
|
solid
|
||||||
.update_shell(solid.shells().only(), |shell| {
|
.update_shell(solid.shells().only(), |shell| {
|
||||||
|
Loading…
Reference in New Issue
Block a user