diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c1a0fd34..4381d56a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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. diff --git a/modeling-cmds/src/def_enum.rs b/modeling-cmds/src/def_enum.rs index 3b38b073..8144f8cb 100644 --- a/modeling-cmds/src/def_enum.rs +++ b/modeling-cmds/src/def_enum.rs @@ -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 { diff --git a/modeling-cmds/src/each_cmd.rs b/modeling-cmds/src/each_cmd.rs index c6ed05a1..b907ced9 100644 --- a/modeling-cmds/src/each_cmd.rs +++ b/modeling-cmds/src/each_cmd.rs @@ -189,6 +189,19 @@ pub struct EntityGetDistance { pub distance_type: DistanceType, } +/// Create a linear pattern using this entity (currently only valid for 3D solids). +#[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, + /// 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 { diff --git a/modeling-cmds/src/impl_traits.rs b/modeling-cmds/src/impl_traits.rs index be6f2660..27d2a855 100644 --- a/modeling-cmds/src/impl_traits.rs +++ b/modeling-cmds/src/impl_traits.rs @@ -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); diff --git a/modeling-cmds/src/ok_response.rs b/modeling-cmds/src/ok_response.rs index cce27e29..ff56b6e3 100644 --- a/modeling-cmds/src/ok_response.rs +++ b/modeling-cmds/src/ok_response.rs @@ -33,6 +33,7 @@ build_enum! { SelectGet, GetEntityType, EntityGetDistance, + EntityLinearPattern, Solid3dGetAllEdgeFaces, Solid3dGetAllOppositeEdges, Solid3dGetOppositeEdge, diff --git a/modeling-cmds/src/output.rs b/modeling-cmds/src/output.rs index 78f46216..b23e1382 100644 --- a/modeling-cmds/src/output.rs +++ b/modeling-cmds/src/output.rs @@ -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, +} + impl ModelingCmdOutput for Export {} impl ModelingCmdOutput for SelectWithPoint {} impl ModelingCmdOutput for HighlightSetEntity {} @@ -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 {}