Non-destructive, partial surface extrudes/revolves/sweeps etc#1130
Non-destructive, partial surface extrudes/revolves/sweeps etc#1130adamchalmers wants to merge 6 commits intomainfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1130 +/- ##
=======================================
Coverage ? 30.01%
=======================================
Files ? 34
Lines ? 1609
Branches ? 0
=======================================
Hits ? 483
Misses ? 1126
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Good question. I'll ask @max-mrgrsk and @nicboone8. Perhaps it should be configurable. |
|
I would expect them merged by default, but making it configurable is a good idea |
| @@ -265,6 +302,15 @@ define_modeling_cmd_enum! { | |||
| /// Which sketch to revolve. | |||
| /// Must be a closed 2D solid. | |||
| pub target: ModelingCmdId, | |||
There was a problem hiding this comment.
Documentation inconsistency: Revolve.target still says "Must be a closed 2D solid" but should be updated to "Must be a 2D sketch" to match the Extrude operation and reflect support for partial surface revolves via the new segments field.
| /// Which sketch to sweep. | |
| /// Must be a closed 2D solid. | |
| pub target: ModelingCmdId, | |
| /// If given, extrude each of these segments into a separate body with the given ID. | |
| #[serde(default, skip_serializing_if = "Option::is_none")] | |
| pub segments: Option<Vec<IdPair>>, | |
| /// When two collinear segments are extruded, what should happen? | |
| /// If true, creates a body with two surfaces. | |
| /// If false, creates a body with one surface, spanning both collinear segments. | |
| #[serde(default)] | |
| #[builder(default)] | |
| pub keep_seams: bool, | |
| /// Path along which to sweep. | |
| pub trajectory: ModelingCmdId, | |
| /// If true, the sweep will be broken up into sub-sweeps (extrusions, revolves, sweeps) based on the trajectory path components. | |
| /// Which sketch to revolve. | |
| /// Must be a 2D sketch. | |
| pub target: ModelingCmdId, | |
Spotted by Graphite
Is this helpful? React 👍 or 👎 to let us know.
485f01e to
06477d1
Compare
| }, | ||
| "segments": { | ||
| "nullable": true, | ||
| "description": "If given, extrude each of these segments into a separate body with the given ID.", |
There was a problem hiding this comment.
Misleading description: states "extrude each of these segments into a separate body with the given ID" but the array contains segment IDs to be extruded, not body IDs to assign. The wording "with the given ID" incorrectly suggests these UUIDs are for the resulting bodies. Should clarify:
"description": "If given, only extrude these segments from the sketch. Each segment will be extruded into a separate body."This same incorrect description appears in all operation types (lines 2061, 2151, 2230, 2340, 2598).
| "description": "If given, extrude each of these segments into a separate body with the given ID.", | |
| "description": "If given, only extrude these segments from the sketch. Each segment will be extruded into a separate body.", |
Spotted by Graphite
Is this helpful? React 👍 or 👎 to let us know.
This proposes a new way to surface extrude/revolve/sweep for sketch 2. Instead of extruding an entire sketch (solid2D) at once, we instead take a list of segments and extrude each of those separately. Each segment has a (segment ID, new body ID) pair, so the segment IDs are NOT absorbed into new body IDs. The sketch and all its segments are not modified.
Serena pointed out that if the extrude uses method=NEW, this will update old bodies by adding new surfaces, instead of creating new bodies. Let's be explicit about this.
cd56f6d to
3004b11
Compare
| /// All bodies created by this operation. | ||
| pub bodies: Vec<BodyUpdated>, |
There was a problem hiding this comment.
Incorrect documentation. The comment says "All bodies created by this operation" but this struct is BodiesUpdated, not BodiesCreated. The comment describes the wrong behavior.
Fix:
/// All bodies updated by this operation.
pub bodies: Vec<BodyUpdated>,| /// All bodies created by this operation. | |
| pub bodies: Vec<BodyUpdated>, | |
| /// All bodies updated by this operation. | |
| pub bodies: Vec<BodyUpdated>, |
Spotted by Graphite
Is this helpful? React 👍 or 👎 to let us know.
| #[serde(default, skip_serializing_if = "BodiesUpdated::is_empty")] | ||
| pub bodies_updated: BodiesUpdated, |
There was a problem hiding this comment.
Inconsistent field naming for bodies updated. The Extrude response uses bodies_updated but all other response structs (ExtrudeToReference, TwistExtrude, Sweep, Revolve, RevolveAboutEdge) use bodies for the same field type. This inconsistency will cause deserialization errors and confusion for API clients.
// Should be:
pub bodies: BodiesUpdated,Alternatively, all other structs should be changed to use bodies_updated for consistency.
| #[serde(default, skip_serializing_if = "BodiesUpdated::is_empty")] | |
| pub bodies_updated: BodiesUpdated, | |
| #[serde(default, skip_serializing_if = "BodiesUpdated::is_empty")] | |
| pub bodies: BodiesUpdated, |
Spotted by Graphite
Is this helpful? React 👍 or 👎 to let us know.
This proposes a new way to surface extrude/revolve/sweep for sketch 2. Part of KittyCAD/modeling-app#10386
Background
Currently, the engine extrude/revolve/sweep/etc endpoints take an entire sketch as their target. That worked fine for sketch 1 solid extrudes (where the sketch is a closed profile) and for surface extrudes (where the sketch could be closed or open, either way, it extrudes each segment separately).
Problem
In sketch 2, the user might want to surface extrude only some segments in the sketch. Like in the below example, only k of the n segments are selected for extrusion.
Right now the API doesn't allow for this. Clients send the ID of the overall sketch, and the server extrudes the whole thing. There's no way to only surface extrude k of the n segments.
Solution
Instead of extruding an entire sketch (solid2D) at once, we instead take a list of segments and extrude each of those separately.
Here's a motivating example:
In this example, after extruding:
We want to:
Ideally we would not need any follow-up calls to query these bodies. Let's just send back all relevant information in the Extrude response.
Here's my proposed return for Extrude. I'm using YAML because it's more concise, but we'd actually be sending JSON. See the attachment for syntax highlighting, or copypastable here: