Skip to content

Commit

Permalink
Fix some rebase issues
Browse files Browse the repository at this point in the history
  • Loading branch information
bschwind committed Aug 5, 2023
1 parent 0dd22bf commit 6be9e51
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion crates/viewer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl GameApp for ViewerApp {
// Model sourced from:
// https://nist.gov/ctl/smart-connected-systems-division/smart-connected-manufacturing-systems-group/mbe-pmi-0
// let keycap = Shape::read_step("crates/viewer/models/nist_ftc_06.step").unwrap();
let keycap = examples::gizmo::shape();
let keycap = examples::flywheel::shape();

let mesh = keycap.mesh();
let cad_mesh = CadMesh::from_mesh(&mesh, graphics_device.device());
Expand Down
10 changes: 5 additions & 5 deletions examples/src/bowl.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use glam::dvec3;
use opencascade::{
primitives::{self, Direction, Solid},
primitives::{Direction, Shape, Solid},
workplane::Workplane,
};

pub fn main() {
pub fn shape() -> Shape {
let bot_rad: f64 = 30.0;
let top_rad: f64 = 40.0;
let height: f64 = 30.0;
Expand All @@ -14,16 +14,16 @@ pub fn main() {

// inner ( shell does not exist yest)
let inner = bowly_shape(bot_rad - thickness, top_rad - thickness, height, thickness);
(loft, _) = loft.subtract_shape(&inner);
loft = loft.subtract(&inner).into();

// rouind out the top
let top_side = loft.faces().farthest(Direction::PosZ).edges();
loft.fillet_edges(thickness / 2.0, top_side);

loft.write_stl("bowl.stl").unwrap();
loft
}

fn bowly_shape(bot_rad: f64, top_rad: f64, height: f64, offset: f64) -> primitives::Shape {
fn bowly_shape(bot_rad: f64, top_rad: f64, height: f64, offset: f64) -> Shape {
let bottom = Workplane::xy().circle(0.0, 0.0, bot_rad);
let mut top = Workplane::xy().circle(0.0, 0.0, top_rad);
top.translate(dvec3(0.0, 0.0, height));
Expand Down
16 changes: 8 additions & 8 deletions examples/src/flywheel.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use glam::dvec3;
use opencascade::{angle::Angle, primitives::Shape, workplane::Workplane};

pub fn main() {
pub fn shape() -> Shape {
let outer: f64 = 30.0;
let height: f64 = 8.0;
let thickness: f64 = 8.0;
Expand All @@ -10,22 +10,22 @@ pub fn main() {

let ring = rim(outer, thickness, height);
let sp = spokes(outer - thickness / 2.0, thickness / 2.0, spoke_count);
let (mut fly, smooth) = ring.union_shape(&sp);
fly.fillet_edges(1.0, smooth);
let mut fly = ring.union(&sp);
fly.fillet_new_edges(1.0);

let the_hub = hub(hub_outer, thickness);
let (mut fly, hub_con) = fly.union_shape(&the_hub);
fly.fillet_edges(1.0, hub_con);
let mut fly = fly.union(&the_hub);
fly.fillet_new_edges(1.0);

fly.write_stl("flywheel.stl").unwrap();
fly.into()
}

fn rim(outer: f64, thickness: f64, height: f64) -> Shape {
let outer_wire = Workplane::xy().circle(0.0, 0.0, outer);
let mut ring = outer_wire.to_face().extrude(dvec3(0.0, 0.0, height)).to_shape();
let inner_wire = Workplane::xy().circle(0.0, 0.0, outer - thickness / 2.0);
let inner_ring = inner_wire.to_face().extrude(dvec3(0.0, 0.0, height)).to_shape();
(ring, _) = ring.subtract_shape(&inner_ring);
ring = ring.subtract(&inner_ring).into();
ring.chamfer(0.1);
ring
}
Expand All @@ -51,7 +51,7 @@ fn spokes(length: f64, thickness: f64, count: usize) -> Shape {
let mut first_s = spoke(length, thickness, 0.0);
for i in 1..count {
let s = spoke(length, thickness, incr * i as f64);
(first_s, _) = first_s.union_shape(&s);
first_s = first_s.union(&s).into();
}
first_s
}
2 changes: 2 additions & 0 deletions examples/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
pub mod bowl;
pub mod box_shape;
pub mod chamfer;
pub mod flywheel;
pub mod gizmo;
pub mod high_level_bottle;
pub mod keyboard_case;
Expand Down

0 comments on commit 6be9e51

Please sign in to comment.