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