Clean up rust changes, taking the sketch with the most paths
This commit is contained in:
@ -125,7 +125,7 @@ async fn inner_extrude(
|
||||
ModelingCmd::SketchModeDisable(mcmd::SketchModeDisable {}),
|
||||
)
|
||||
.await?;
|
||||
solids.push(do_post_extrude(sketch.clone(), length, exec_state, args.clone(), None).await?);
|
||||
solids.push(do_post_extrude(sketch.clone(), length, exec_state, args.clone()).await?);
|
||||
}
|
||||
|
||||
Ok(solids.into())
|
||||
@ -136,7 +136,6 @@ pub(crate) async fn do_post_extrude(
|
||||
length: f64,
|
||||
exec_state: &mut ExecState,
|
||||
args: Args,
|
||||
force_object_id: Option<Uuid>,
|
||||
) -> Result<Box<Solid>, KclError> {
|
||||
// Bring the object to the front of the scene.
|
||||
// See: https://github.com/KittyCAD/modeling-app/issues/806
|
||||
@ -164,16 +163,14 @@ pub(crate) async fn do_post_extrude(
|
||||
sketch.id = face.solid.sketch.id;
|
||||
}
|
||||
|
||||
let object_id = force_object_id.unwrap_or(sketch.id);
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
web_sys::console::log_1(&format!("Rust Solid3dGetExtrusionFaceInfo cmd edge_id={:?} object_id={:?}", any_edge_id, object_id).into());
|
||||
web_sys::console::log_1(&format!("Rust Solid3dGetExtrusionFaceInfo cmd edge_id={:?} object_id={:?}", any_edge_id, sketch.id).into());
|
||||
let solid3d_info = args
|
||||
.send_modeling_cmd(
|
||||
exec_state.next_uuid(),
|
||||
ModelingCmd::from(mcmd::Solid3dGetExtrusionFaceInfo {
|
||||
edge_id: any_edge_id,
|
||||
object_id: object_id,
|
||||
object_id: sketch.id,
|
||||
}),
|
||||
)
|
||||
.await?;
|
||||
|
||||
@ -168,9 +168,10 @@ async fn inner_loft(
|
||||
}));
|
||||
};
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
web_sys::console::log_1(&format!("Rust Loft solid_id={:?}", data.solid_id).into());
|
||||
|
||||
// Using the first sketch as the base curve, idk we might want to change this later.
|
||||
do_post_extrude(sketches[0].clone(), 0.0, exec_state, args, Some(data.solid_id)).await
|
||||
// Take the sketch with the most paths, and override its id with the loft's solid_id (to get its faces)
|
||||
let mut desc_sorted_sketches = sketches.to_vec();
|
||||
desc_sorted_sketches.sort_by(|s0, s1| s1.paths.len().cmp(&s0.paths.len()));
|
||||
let mut sketch = desc_sorted_sketches[0].clone();
|
||||
sketch.id = data.solid_id;
|
||||
do_post_extrude(sketch, 0.0, exec_state, args).await
|
||||
}
|
||||
|
||||
@ -296,7 +296,7 @@ async fn inner_revolve(
|
||||
}
|
||||
}
|
||||
|
||||
do_post_extrude(sketch, 0.0, exec_state, args, None).await
|
||||
do_post_extrude(sketch, 0.0, exec_state, args).await
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@ -99,5 +99,5 @@ async fn inner_sweep(
|
||||
)
|
||||
.await?;
|
||||
|
||||
do_post_extrude(sketch, 0.0, exec_state, args, None).await
|
||||
do_post_extrude(sketch, 0.0, exec_state, args).await
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user