mirror of
https://github.com/hannobraun/Fornjot
synced 2025-01-22 08:06:08 +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"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cuboid",
|
||||
"fj",
|
||||
]
|
||||
|
||||
|
@ -3,5 +3,9 @@ name = "split"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
|
||||
[dependencies.fj]
|
||||
path = "../../crates/fj"
|
||||
|
||||
[dependencies.cuboid]
|
||||
path = "../cuboid"
|
||||
|
@ -1,17 +1,11 @@
|
||||
use fj::{
|
||||
core::{
|
||||
objects::{Region, Sketch, Solid},
|
||||
operations::{
|
||||
build::{BuildRegion, BuildSketch},
|
||||
insert::Insert,
|
||||
split::SplitFace,
|
||||
sweep::{SweepFaceOfShell, SweepSketch},
|
||||
update::{UpdateSketch, UpdateSolid},
|
||||
},
|
||||
services::Services,
|
||||
storage::Handle,
|
||||
use fj::core::{
|
||||
objects::Solid,
|
||||
operations::{
|
||||
insert::Insert, split::SplitFace, sweep::SweepFaceOfShell,
|
||||
update::UpdateSolid,
|
||||
},
|
||||
math::Vector,
|
||||
services::Services,
|
||||
storage::Handle,
|
||||
};
|
||||
|
||||
pub fn model(
|
||||
@ -19,22 +13,7 @@ pub fn model(
|
||||
split_pos: f64,
|
||||
services: &mut Services,
|
||||
) -> Handle<Solid> {
|
||||
let sketch = Sketch::empty().add_region(
|
||||
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);
|
||||
let solid = cuboid::model([size, size, size], services);
|
||||
|
||||
solid
|
||||
.update_shell(solid.shells().only(), |shell| {
|
||||
|
Loading…
Reference in New Issue
Block a user