Skip to content
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

add helix from params endpoint #678

Merged
merged 5 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
27 changes: 26 additions & 1 deletion modeling-cmds/src/def_enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
Vec::new()
}

fn default_angle() -> Angle {
gserena01 marked this conversation as resolved.
Show resolved Hide resolved
Angle::from_degrees(0.0)
}

Check warning on line 47 in modeling-cmds/src/def_enum.rs

View check run for this annotation

Codecov / codecov/patch

modeling-cmds/src/def_enum.rs#L45-L47

Added lines #L45 - L47 were not covered by tests

/// Evaluates the position of a path in one shot (engine utility for kcl executor)
#[derive(
Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
Expand Down Expand Up @@ -403,14 +407,35 @@
pub cylinder_id: Uuid,
/// Number of revolutions.
pub revolutions: f64,
/// Start angle (in degrees).
/// Start angle.
#[serde(default = "default_angle")]
gserena01 marked this conversation as resolved.
Show resolved Hide resolved
pub start_angle: Angle,
/// Is the helix rotation clockwise?
pub is_clockwise: bool,
/// Length of the helix.
pub length: LengthUnit,
}

/// Create a helix using the specified parameters.
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]

Check warning on line 420 in modeling-cmds/src/def_enum.rs

View check run for this annotation

Codecov / codecov/patch

modeling-cmds/src/def_enum.rs#L420

Added line #L420 was not covered by tests
pub struct EntityMakeHelixFromParams {
/// Radius of the helix.
pub radius: f64,
/// Length of the helix.
pub length: LengthUnit,
/// Number of revolutions.
pub revolutions: f64,
/// Start angle.
#[serde(default = "default_angle")]
gserena01 marked this conversation as resolved.
Show resolved Hide resolved
pub start_angle: Angle,
/// Is the helix rotation clockwise?
pub is_clockwise: bool,
/// Center of the helix at the base of the helix.
pub center: Point3d<LengthUnit>,
/// Axis of the helix. The helix will be created around and in the direction of this axis.
pub axis: Point3d<f64>,
}

/// Mirror the input entities over the specified axis. (Currently only supports sketches)
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
pub struct EntityMirror {
Expand Down
6 changes: 6 additions & 0 deletions modeling-cmds/src/ok_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ define_ok_modeling_cmd_response_enum! {
pub struct EntityMakeHelix {
}

/// The response from the `EntityMakeHelixFromParams` endpoint.
#[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ModelingCmdOutput)]
pub struct EntityMakeHelixFromParams {
}


/// The response from the `EntityMirror` endpoint.
#[derive(Debug, Serialize, Deserialize, Clone, JsonSchema, ModelingCmdOutput)]
pub struct EntityMirror {
Expand Down
Loading