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

types for linear patterns #19

Merged
merged 9 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from 8 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
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Adding a new modeling command

- In `each_command.rs` add your new `struct MyNewCommand` with one field for each parameter the command has.
- In `each_cmd.rs` add your new `struct MyNewCommand` with one field for each parameter the command has.
- In `def_enum.rs` add a new variant of `ModelingCmd` with your type, e.g. `MyNewCommand(MyNewCommand)`.
- If your command responds with data:
- In `output.rs`, add a `struct MyNewCommand` following the existing examples.
Expand Down
2 changes: 2 additions & 0 deletions modeling-cmds/src/def_enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ pub enum ModelingCmd {
ObjectSetMaterialParamsPbr(ObjectSetMaterialParamsPbr),
/// What is the distance between these two entities?
EntityGetDistance(EntityGetDistance),
/// Duplicate the given entity, evenly spaced along the chosen axis.
EntityLinearPattern(EntityLinearPattern),
}

impl ModelingCmd {
Expand Down
13 changes: 13 additions & 0 deletions modeling-cmds/src/each_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,19 @@ pub struct EntityGetDistance {
pub distance_type: DistanceType,
}

/// Create a linear pattern using this entity
gserena01 marked this conversation as resolved.
Show resolved Hide resolved
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct EntityLinearPattern {
/// ID of the entity being copied.
pub entity_id: Uuid,
/// Axis along which to make the copites
pub axis: Point3d<f64>,
adamchalmers marked this conversation as resolved.
Show resolved Hide resolved
/// Number of repetitions to make.
pub num_repetitions: u32,
/// Spacing between repetitions.
pub spacing: f64,
}

/// Enter edit mode
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct EditModeEnter {
Expand Down
1 change: 1 addition & 0 deletions modeling-cmds/src/impl_traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ impl_variant_output!(EntityGetNumChildren);
impl_variant_output!(EntityGetChildUuid);
impl_variant_output!(EntityGetAllChildUuids);
impl_variant_output!(EntityGetDistance);
impl_variant_output!(EntityLinearPattern);
impl_variant_empty!(EditModeEnter);
impl_variant_output!(SelectWithPoint);
impl_variant_empty!(SelectAdd);
Expand Down
1 change: 1 addition & 0 deletions modeling-cmds/src/ok_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ build_enum! {
SelectGet,
GetEntityType,
EntityGetDistance,
EntityLinearPattern,
Solid3dGetAllEdgeFaces,
Solid3dGetAllOppositeEdges,
Solid3dGetOppositeEdge,
Expand Down
8 changes: 8 additions & 0 deletions modeling-cmds/src/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,13 @@ pub struct EntityGetDistance {
pub max_distance: f64,
}

/// The response from the `EntityLinearPattern` command.
#[derive(Debug, Serialize, Deserialize, JsonSchema)]
pub struct EntityLinearPattern {
/// The UUIDs of the entities that were created.
pub entity_ids: Vec<Uuid>,
}

impl ModelingCmdOutput for Export {}
impl ModelingCmdOutput for SelectWithPoint {}
impl ModelingCmdOutput for HighlightSetEntity {}
Expand All @@ -264,6 +271,7 @@ impl ModelingCmdOutput for EntityGetNumChildren {}
impl ModelingCmdOutput for EntityGetParentId {}
impl ModelingCmdOutput for EntityGetAllChildUuids {}
impl ModelingCmdOutput for EntityGetDistance {}
impl ModelingCmdOutput for EntityLinearPattern {}
impl ModelingCmdOutput for SelectGet {}
impl ModelingCmdOutput for GetEntityType {}
impl ModelingCmdOutput for Solid3dGetAllEdgeFaces {}
Expand Down
Loading