Allow standard planes to appear in the artifact graph (#4594)
This commit is contained in:
@ -11,8 +11,8 @@ Map {
|
||||
],
|
||||
],
|
||||
"range": [
|
||||
37,
|
||||
64,
|
||||
12,
|
||||
31,
|
||||
0,
|
||||
],
|
||||
},
|
||||
|
||||
@ -1113,46 +1113,53 @@ async fn make_sketch_plane_from_orientation(
|
||||
exec_state: &mut ExecState,
|
||||
args: &Args,
|
||||
) -> Result<Box<Plane>, KclError> {
|
||||
let mut plane = Plane::from_plane_data(data.clone(), exec_state);
|
||||
let plane = Plane::from_plane_data(data.clone(), exec_state);
|
||||
|
||||
// Get the default planes.
|
||||
let default_planes = args
|
||||
.ctx
|
||||
.engine
|
||||
.default_planes(&mut exec_state.id_generator, args.source_range)
|
||||
.await?;
|
||||
|
||||
plane.id = match data {
|
||||
PlaneData::XY => default_planes.xy,
|
||||
PlaneData::NegXY => default_planes.neg_xy,
|
||||
PlaneData::XZ => default_planes.xz,
|
||||
PlaneData::NegXZ => default_planes.neg_xz,
|
||||
PlaneData::YZ => default_planes.yz,
|
||||
PlaneData::NegYZ => default_planes.neg_yz,
|
||||
// Create the plane on the fly.
|
||||
let clobber = false;
|
||||
let size = LengthUnit(60.0);
|
||||
let hide = Some(true);
|
||||
match data {
|
||||
PlaneData::XY | PlaneData::NegXY | PlaneData::XZ | PlaneData::NegXZ | PlaneData::YZ | PlaneData::NegYZ => {
|
||||
let x_axis = match data {
|
||||
PlaneData::NegXY => Point3d::new(-1.0, 0.0, 0.0),
|
||||
PlaneData::NegXZ => Point3d::new(-1.0, 0.0, 0.0),
|
||||
PlaneData::NegYZ => Point3d::new(0.0, -1.0, 0.0),
|
||||
_ => plane.x_axis,
|
||||
};
|
||||
args.batch_modeling_cmd(
|
||||
plane.id,
|
||||
ModelingCmd::from(mcmd::MakePlane {
|
||||
clobber,
|
||||
origin: plane.origin.into(),
|
||||
size,
|
||||
x_axis: x_axis.into(),
|
||||
y_axis: plane.y_axis.into(),
|
||||
hide,
|
||||
}),
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
PlaneData::Plane {
|
||||
origin,
|
||||
x_axis,
|
||||
y_axis,
|
||||
z_axis: _,
|
||||
} => {
|
||||
// Create the custom plane on the fly.
|
||||
let id = exec_state.id_generator.next_uuid();
|
||||
args.batch_modeling_cmd(
|
||||
id,
|
||||
plane.id,
|
||||
ModelingCmd::from(mcmd::MakePlane {
|
||||
clobber: false,
|
||||
clobber,
|
||||
origin: (*origin).into(),
|
||||
size: LengthUnit(60.0),
|
||||
size,
|
||||
x_axis: (*x_axis).into(),
|
||||
y_axis: (*y_axis).into(),
|
||||
hide: Some(true),
|
||||
hide,
|
||||
}),
|
||||
)
|
||||
.await?;
|
||||
|
||||
id
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Ok(Box::new(plane))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user