Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions modeling-cmds/src/def_enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ define_modeling_cmd_enum! {
Angle,
CutType,
CameraMovement,
ExtrudedFaceInfo,
AnnotationOptions, AnnotationType, CameraDragInteractionType, Color, DistanceType, EntityType,
PathComponentConstraintBound, PathComponentConstraintType, PathSegment, PerspectiveCameraParameters,
Point2d, Point3d, SceneSelectionType, SceneToolType,
Expand Down Expand Up @@ -99,6 +100,10 @@ define_modeling_cmd_enum! {
pub target: ModelingCmdId,
/// How far off the plane to extrude
pub distance: LengthUnit,
/// Which IDs should the new faces have?
/// If this isn't given, the engine will generate IDs.
#[serde(default)]
pub faces: Option<ExtrudedFaceInfo>,
}

/// Extrude the object along a path.
Expand Down
24 changes: 24 additions & 0 deletions modeling-cmds/src/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use enum_iterator::Sequence;
use parse_display_derive::{Display, FromStr};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use uuid::Uuid;

#[cfg(feature = "cxx")]
use crate::impl_extern_type;
Expand Down Expand Up @@ -619,6 +620,29 @@ impl From<EngineErrorCode> for http::StatusCode {
}
}

/// IDs for the extruded faces.
#[derive(Debug, Serialize, Deserialize, JsonSchema, Clone)]
pub struct ExtrudedFaceInfo {
/// The face made from the original 2D shape being extruded.
/// If the solid is extruded from a shape which already has an ID
/// (e.g. extruding something which was sketched on a face), this
/// doesn't need to be sent.
pub bottom: Option<Uuid>,
/// Top face of the extrusion (parallel and further away from the original 2D shape being extruded).
pub top: Uuid,
/// Any intermediate sides between the top and bottom.
pub sides: Vec<SideFace>,
}

/// IDs for a side face, extruded from the path of some sketch/2D shape.
#[derive(Debug, Serialize, Deserialize, JsonSchema, Clone)]
pub struct SideFace {
/// ID of the path this face is being extruded from.
pub path_id: Uuid,
/// Desired ID for the resulting face.
pub face_id: Uuid,
}

/// Camera settings including position, center, fov etc
#[derive(Debug, Serialize, Deserialize, JsonSchema, Clone)]
pub struct CameraSettings {
Expand Down
1 change: 1 addition & 0 deletions modeling-session/examples/cube_png.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ async fn main() -> Result<()> {
Extrude {
distance: CUBE_WIDTH * 2.0,
target: path,
faces: None,
}
.into(),
)
Expand Down
1 change: 1 addition & 0 deletions modeling-session/examples/cube_png_batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ async fn main() -> Result<()> {
cmd: ModelingCmd::Extrude(Extrude {
distance: CUBE_WIDTH * 2.0,
target: path,
faces: None,
}),
cmd_id: random_id(),
});
Expand Down
1 change: 1 addition & 0 deletions modeling-session/examples/lsystem_png_batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ async fn main() -> Result<()> {
cmd: ModelingCmd::Extrude(Extrude {
distance: LengthUnit(1.0),
target: path,
faces: None,
}),
cmd_id: random_id(),
});
Expand Down
Loading