-
-
Notifications
You must be signed in to change notification settings - Fork 119
/
lib.rs
31 lines (29 loc) · 860 Bytes
/
lib.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use fj::{
core::{
algorithms::sweep::Sweep,
objects::{Region, Sketch, Solid},
operations::{BuildRegion, BuildSketch, Insert, UpdateSketch},
services::Services,
storage::Handle,
},
math::Vector,
};
pub fn model(x: f64, y: f64, z: f64, services: &mut Services) -> Handle<Solid> {
let sketch = Sketch::empty()
.add_region(
Region::polygon(
[
[-x / 2., -y / 2.],
[x / 2., -y / 2.],
[x / 2., y / 2.],
[-x / 2., y / 2.],
],
services,
)
.insert(services),
)
.insert(services);
let surface = services.objects.surfaces.xy_plane();
let path = Vector::from([0., 0., z]);
(sketch, surface).sweep(path, services)
}