Skip to content
Open
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
3ace707
update snapshot
Jul 24, 2025
c282196
Merge branch 'main' of github.com:KittyCAD/modeling-app
Jul 24, 2025
e6e5c6e
Merge branch 'main' of github.com:KittyCAD/modeling-app
Jul 25, 2025
1102cea
Merge branch 'main' of github.com:KittyCAD/modeling-app
Jul 25, 2025
2278a9c
Merge branch 'main' of github.com:KittyCAD/modeling-app
Jul 29, 2025
b80242a
Merge branch 'main' of github.com:KittyCAD/modeling-app
Aug 19, 2025
5889be8
Merge branch 'main' of github.com:KittyCAD/modeling-app
Sep 4, 2025
8267b15
Merge branch 'main' of github.com:KittyCAD/modeling-app
Sep 9, 2025
8a26c87
Merge branch 'main' of github.com:KittyCAD/modeling-app
Sep 9, 2025
4da3008
Merge branch 'main' of github.com:KittyCAD/modeling-app
Sep 9, 2025
864f7e1
Merge branch 'main' of github.com:KittyCAD/modeling-app
Sep 12, 2025
0eb1a8a
Merge branch 'main' of github.com:KittyCAD/modeling-app
Sep 15, 2025
d931eea
Merge branch 'main' of github.com:KittyCAD/modeling-app
Sep 15, 2025
3eb8bf7
Merge branch 'main' of github.com:KittyCAD/modeling-app
Sep 19, 2025
800a8ed
Merge branch 'main' of github.com:KittyCAD/modeling-app
Sep 22, 2025
e040b03
Merge branch 'main' of github.com:KittyCAD/modeling-app
Sep 22, 2025
5688d86
Merge branch 'main' of github.com:KittyCAD/modeling-app
Sep 23, 2025
e987953
Merge branch 'main' of github.com:KittyCAD/modeling-app
Sep 25, 2025
1e3760b
update surfaces of clones
Oct 9, 2025
e816e21
fmt and clippy
Oct 9, 2025
144ea83
Merge branch 'main' into serena/cloning-set-surfaces
gserena01 Oct 9, 2025
c630566
unfix clipppy sryyy
Oct 9, 2025
ab754df
Merge branch 'serena/cloning-set-surfaces' of github.com:KittyCAD/mod…
Oct 9, 2025
1417f4b
Fix lint
iterion Oct 10, 2025
f8f8ae9
fmt
Oct 10, 2025
8a66b14
udpate according to suggestions
Oct 14, 2025
036fcf5
udpate according to suggestions
Oct 14, 2025
f5af928
Merge branch 'serena/cloning-set-surfaces' of github.com:KittyCAD/mod…
Oct 14, 2025
6a9839f
fix excessive if let
Oct 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
NODE_ENV = "development";
RUSTFMT = "${pkgs.nightlyRustfmt}/bin/rustfmt";
CHROMEDRIVER = "${pkgs.chromedriver}/bin/chromedriver";
PYO3_PYTHON = "${pkgs.python3Full}/bin/python3";
};
}
);
Expand Down
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions rust/kcl-lib/src/execution/geometry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,9 @@ pub struct Sketch {
/// If the sketch includes a mirror.
#[serde(skip)]
pub mirror: Option<uuid::Uuid>,
/// If the sketch is a clone of another sketch.
#[serde(skip)]
pub clone: Option<uuid::Uuid>,
pub units: UnitLength,
/// Metadata.
#[serde(skip)]
Expand Down
2 changes: 2 additions & 0 deletions rust/kcl-lib/src/std/clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ async fn fix_tags_and_references(
match new_geometry {
GeometryWithImportedGeometry::ImportedGeometry(_) => {}
GeometryWithImportedGeometry::Sketch(sketch) => {
sketch.clone = Some(old_geometry_id);
fix_sketch_tags_and_references(sketch, &entity_id_map, exec_state, None).await?;
}
GeometryWithImportedGeometry::Solid(solid) => {
Expand Down Expand Up @@ -155,6 +156,7 @@ async fn fix_tags_and_references(
exec_state,
args,
None,
None,
)
.await?;

Expand Down
66 changes: 66 additions & 0 deletions rust/kcl-lib/src/std/extrude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@
exec_state,
&args,
None,
None,
)
.await?,
);
Expand All @@ -337,6 +338,7 @@
exec_state: &mut ExecState,
args: &Args,
edge_id: Option<Uuid>,
clone_id_map: Option<&HashMap<Uuid, Uuid>>, // old sketch id -> new sketch id
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the new param is ever passed in.

) -> Result<Solid, KclError> {
// Bring the object to the front of the scene.
// See: https://github.com/KittyCAD/modeling-app/issues/806
Expand Down Expand Up @@ -423,12 +425,31 @@
if let Some(Some(actual_face_id)) = face_id_map.get(&path.get_base().geo_meta.id) {
surface_of(path, *actual_face_id)
} else if no_engine_commands {
println!(
"No face ID found for path ID {:?}, but in no-engine-commands mode, so faking it",
path.get_base().geo_meta.id
);
// Only pre-populate the extrude surface if we are in mock mode.
fake_extrude_surface(exec_state, path)
} else if sketch.clone.is_some() && clone_id_map.is_some() {
let new_path = clone_id_map.unwrap().get(&path.get_base().geo_meta.id)?;

Check warning on line 435 in rust/kcl-lib/src/std/extrude.rs

View workflow job for this annotation

GitHub Actions / semgrep-oss/scan

panic-in-function-returning-result

expect or unwrap called in function returning a Result
let new_face_id = face_id_map.get(new_path);
if let Some(face_id) = new_face_id {
clone_surface_of(path, *new_path, face_id.unwrap())

Check warning on line 438 in rust/kcl-lib/src/std/extrude.rs

View workflow job for this annotation

GitHub Actions / semgrep-oss/scan

panic-in-function-returning-result

expect or unwrap called in function returning a Result
} else {
None
}
} else {
println!(
"No face ID found for path ID {:?}, and not in no-engine-commands mode, so skipping it",
path.get_base().geo_meta.id
);
None
}
});
// if (outer_surfaces.len() < 1) && sketch.clone.is_some() {
// // surface_of(path, actual_face_id)
// }
new_value.extend(outer_surfaces);
let inner_surfaces = sketch.inner_paths.iter().flat_map(|path| {
if let Some(Some(actual_face_id)) = face_id_map.get(&path.get_base().geo_meta.id) {
Expand Down Expand Up @@ -586,6 +607,51 @@
}
}

fn clone_surface_of(path: &Path, clone_path_id: Uuid, actual_face_id: Uuid) -> Option<ExtrudeSurface> {
match path {
Path::Arc { .. }
| Path::TangentialArc { .. }
| Path::TangentialArcTo { .. }
// TODO: (bc) fix me
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like forgery to sign this as Ben, but I won't stop you 🙂

| Path::Ellipse { .. }
| Path::Conic {.. }
| Path::Circle { .. }
| Path::CircleThreePoint { .. } => {
let extrude_surface = ExtrudeSurface::ExtrudeArc(crate::execution::ExtrudeArc {
face_id: actual_face_id,
tag: path.get_base().tag.clone(),
geo_meta: GeoMeta {
id: clone_path_id,
metadata: path.get_base().geo_meta.metadata,
},
});
Some(extrude_surface)
}
Path::Base { .. } | Path::ToPoint { .. } | Path::Horizontal { .. } | Path::AngledLineTo { .. } => {
let extrude_surface = ExtrudeSurface::ExtrudePlane(crate::execution::ExtrudePlane {
face_id: actual_face_id,
tag: path.get_base().tag.clone(),
geo_meta: GeoMeta {
id: clone_path_id,
metadata: path.get_base().geo_meta.metadata,
},
});
Some(extrude_surface)
}
Path::ArcThreePoint { .. } => {
let extrude_surface = ExtrudeSurface::ExtrudeArc(crate::execution::ExtrudeArc {
face_id: actual_face_id,
tag: path.get_base().tag.clone(),
geo_meta: GeoMeta {
id: clone_path_id,
metadata: path.get_base().geo_meta.metadata,
},
});
Some(extrude_surface)
}
}
}

/// Create a fake extrude surface to report for mock execution, when there's no engine response.
fn fake_extrude_surface(exec_state: &mut ExecState, path: &Path) -> Option<ExtrudeSurface> {
let extrude_surface = ExtrudeSurface::ExtrudePlane(crate::execution::ExtrudePlane {
Expand Down
1 change: 1 addition & 0 deletions rust/kcl-lib/src/std/loft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ async fn inner_loft(
exec_state,
&args,
None,
None,
)
.await?,
))
Expand Down
1 change: 1 addition & 0 deletions rust/kcl-lib/src/std/revolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ async fn inner_revolve(
exec_state,
&args,
edge_id,
None,
)
.await?,
);
Expand Down
1 change: 1 addition & 0 deletions rust/kcl-lib/src/std/sketch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1169,6 +1169,7 @@ pub(crate) async fn inner_start_profile(
inner_paths: vec![],
units,
mirror: Default::default(),
clone: Default::default(),
meta: vec![args.source_range.into()],
tags: if let Some(tag) = &tag {
let mut tag_identifier: TagIdentifier = tag.into();
Expand Down
1 change: 1 addition & 0 deletions rust/kcl-lib/src/std/sweep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ async fn inner_sweep(
exec_state,
&args,
None,
None,
)
.await?,
);
Expand Down
Loading