-
Notifications
You must be signed in to change notification settings - Fork 88
Set the surface values appropriately for cloned objects #8525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
gserena01
wants to merge
29
commits into
main
Choose a base branch
from
serena/cloning-set-surfaces
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 25 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
3ace707
update snapshot
c282196
Merge branch 'main' of github.com:KittyCAD/modeling-app
e6e5c6e
Merge branch 'main' of github.com:KittyCAD/modeling-app
1102cea
Merge branch 'main' of github.com:KittyCAD/modeling-app
2278a9c
Merge branch 'main' of github.com:KittyCAD/modeling-app
b80242a
Merge branch 'main' of github.com:KittyCAD/modeling-app
5889be8
Merge branch 'main' of github.com:KittyCAD/modeling-app
8267b15
Merge branch 'main' of github.com:KittyCAD/modeling-app
8a26c87
Merge branch 'main' of github.com:KittyCAD/modeling-app
4da3008
Merge branch 'main' of github.com:KittyCAD/modeling-app
864f7e1
Merge branch 'main' of github.com:KittyCAD/modeling-app
0eb1a8a
Merge branch 'main' of github.com:KittyCAD/modeling-app
d931eea
Merge branch 'main' of github.com:KittyCAD/modeling-app
3eb8bf7
Merge branch 'main' of github.com:KittyCAD/modeling-app
800a8ed
Merge branch 'main' of github.com:KittyCAD/modeling-app
e040b03
Merge branch 'main' of github.com:KittyCAD/modeling-app
5688d86
Merge branch 'main' of github.com:KittyCAD/modeling-app
e987953
Merge branch 'main' of github.com:KittyCAD/modeling-app
1e3760b
update surfaces of clones
e816e21
fmt and clippy
144ea83
Merge branch 'main' into serena/cloning-set-surfaces
gserena01 c630566
unfix clipppy sryyy
ab754df
Merge branch 'serena/cloning-set-surfaces' of github.com:KittyCAD/mod…
1417f4b
Fix lint
iterion f8f8ae9
fmt
8a66b14
udpate according to suggestions
036fcf5
udpate according to suggestions
f5af928
Merge branch 'serena/cloning-set-surfaces' of github.com:KittyCAD/mod…
6a9839f
fix excessive if let
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -313,6 +313,7 @@ | |
exec_state, | ||
&args, | ||
None, | ||
None, | ||
) | ||
.await?, | ||
); | ||
|
@@ -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 | ||
) -> Result<Solid, KclError> { | ||
// Bring the object to the front of the scene. | ||
// See: https://github.com/KittyCAD/modeling-app/issues/806 | ||
|
@@ -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!( | ||
gserena01 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
"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)?; | ||
gserena01 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
gserena01 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
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()) | ||
gserena01 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
} else { | ||
gserena01 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
None | ||
} | ||
} else { | ||
println!( | ||
gserena01 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
"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) | ||
// } | ||
gserena01 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
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) { | ||
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 { | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,6 +104,7 @@ async fn inner_loft( | |
exec_state, | ||
&args, | ||
None, | ||
None, | ||
) | ||
.await?, | ||
)) | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -208,6 +208,7 @@ async fn inner_revolve( | |
exec_state, | ||
&args, | ||
edge_id, | ||
None, | ||
) | ||
.await?, | ||
); | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,6 +108,7 @@ async fn inner_sweep( | |
exec_state, | ||
&args, | ||
None, | ||
None, | ||
) | ||
.await?, | ||
); | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.