Skip to content

Commit

Permalink
evolLog is now computing the project state as it goes
Browse files Browse the repository at this point in the history
  • Loading branch information
MattFerraro committed May 10, 2024
1 parent 711cc48 commit cb3f413
Show file tree
Hide file tree
Showing 3 changed files with 215 additions and 216 deletions.
6 changes: 4 additions & 2 deletions packages/cadmium/src/extrusion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ use crate::sketch::Vector2;

// use truck_meshalgo::prelude::*;
use truck_modeling::{
builder, Edge, Face as TruckFace, Point3 as TruckPoint3, Vector3 as TruckVector3,
Vertex, Wire, Curve, Surface, Plane, builder::translated
builder, builder::translated, Curve, Edge, Face as TruckFace, Plane, Point3 as TruckPoint3,
Surface, Vector3 as TruckVector3, Vertex, Wire,
};

use truck_topology::Solid as TruckSolid;
Expand All @@ -49,6 +49,7 @@ const MESH_TOLERANCE: f64 = 0.1;
pub struct Extrusion {
pub sketch_id: String,
pub face_ids: Vec<u64>,
pub face_shas: Vec<String>,
pub length: f64,
pub offset: f64,
pub direction: Direction,
Expand All @@ -75,6 +76,7 @@ impl Extrusion {
Extrusion {
sketch_id,
face_ids,
face_shas: vec![],
length,
offset,
direction,
Expand Down
41 changes: 22 additions & 19 deletions packages/cadmium/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,19 @@ fn stacked_cubes() {
start: (100.0, 0.0),
end: (0.0, 0.0),
});
// Add a handle to pull the extrusion from
let handle_id = el.append(Operation::AddSketchHandle {
sketch_id: sketch_id.clone(),
position: (20.0, 20.0),
});
// // Add a handle to pull the extrusion from
// let handle_id = el.append(Operation::AddSketchHandle {
// sketch_id: sketch_id.clone(),
// position: (20.0, 20.0),
// });

// This should trigger a commit that adds the Face
el.append(Operation::FinalizeSketch {
sketch_id: sketch_id.clone(),
workbench_id: workbench_id.clone(),
});
// el.append(Operation::FinalizeSketch {
// sketch_id: sketch_id.clone(),
// workbench_id: workbench_id.clone(),
// });``

//
el.find_faces(&workbench_id, &sketch_id);

// extrude the square
let extrusion_id = el.append(Operation::CreateExtrusion {
Expand All @@ -101,20 +103,21 @@ fn stacked_cubes() {
extrusion_id: extrusion_id.clone(),
name: "Extrude1".to_string(),
});
el.append(Operation::SetExtrusionSketch {
extrusion_id: extrusion_id.clone(),
sketch_id: sketch_id.clone(),
});
el.append(Operation::SetExtrusionHandles {
extrusion_id: extrusion_id.clone(),
handles: vec![handle_id.clone()],
});
el.append(Operation::SetExtrusionDepth {
extrusion_id: extrusion_id.clone(),
depth: 100.0,
});
// el.append(Operation::SetExtrusionSketch {
// extrusion_id: extrusion_id.clone(),
// sketch_id: sketch_id.clone(),
// });
// el.append(Operation::SetExtrusionHandles {
// extrusion_id: extrusion_id.clone(),
// handles: vec![handle_id.clone()],
// });

// el.git_log();
println!("project: {:?}", el.project);

el.to_project();
// el.to_project();
}
Loading

0 comments on commit cb3f413

Please sign in to comment.