bump modeling-cmds, nuke slow world (#6753)
* bump modeling-cmds, nuke slow world Signed-off-by: Jess Frazelle <github@jessfraz.com> * more stuffs Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * i mechanical engineered today Signed-off-by: Jess Frazelle <github@jessfraz.com> * reverse uno your revolves Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * retry logic Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
@ -313,6 +313,9 @@ pub struct SweepEdge {
|
||||
pub sub_type: SweepEdgeSubType,
|
||||
pub seg_id: ArtifactId,
|
||||
pub cmd_id: uuid::Uuid,
|
||||
// This is only used for sorting, not for the actual artifact.
|
||||
#[serde(skip)]
|
||||
pub index: usize,
|
||||
pub sweep_id: ArtifactId,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub common_surface_ids: Vec<ArtifactId>,
|
||||
@ -438,6 +441,9 @@ impl PartialOrd for Artifact {
|
||||
if a.cmd_id != b.cmd_id {
|
||||
return Some(a.cmd_id.cmp(&b.cmd_id));
|
||||
}
|
||||
if a.index != b.index {
|
||||
return Some(a.index.cmp(&b.index));
|
||||
}
|
||||
Some(a.id.cmp(&b.id))
|
||||
}
|
||||
(Artifact::EdgeCut(a), Artifact::EdgeCut(b)) => {
|
||||
@ -1182,90 +1188,93 @@ fn artifacts_to_update(
|
||||
}
|
||||
return Ok(return_arr);
|
||||
}
|
||||
ModelingCmd::Solid3dGetNextAdjacentEdge(kcmc::Solid3dGetNextAdjacentEdge { face_id, edge_id, .. })
|
||||
| ModelingCmd::Solid3dGetOppositeEdge(kcmc::Solid3dGetOppositeEdge { face_id, edge_id, .. }) => {
|
||||
let sub_type = match cmd {
|
||||
ModelingCmd::Solid3dGetNextAdjacentEdge(_) => SweepEdgeSubType::Adjacent,
|
||||
ModelingCmd::Solid3dGetOppositeEdge(_) => SweepEdgeSubType::Opposite,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
let face_id = ArtifactId::new(*face_id);
|
||||
let edge_id = ArtifactId::new(*edge_id);
|
||||
let Some(Artifact::Wall(wall)) = artifacts.get(&face_id) else {
|
||||
ModelingCmd::Solid3dGetAdjacencyInfo(kcmc::Solid3dGetAdjacencyInfo { .. }) => {
|
||||
let OkModelingCmdResponse::Solid3dGetAdjacencyInfo(info) = response else {
|
||||
return Ok(Vec::new());
|
||||
};
|
||||
let Some(Artifact::Sweep(sweep)) = artifacts.get(&wall.sweep_id) else {
|
||||
return Ok(Vec::new());
|
||||
};
|
||||
let Some(Artifact::Path(_)) = artifacts.get(&sweep.path_id) else {
|
||||
return Ok(Vec::new());
|
||||
};
|
||||
let Some(Artifact::Segment(segment)) = artifacts.get(&edge_id) else {
|
||||
return Ok(Vec::new());
|
||||
};
|
||||
let response_edge_id = match response {
|
||||
OkModelingCmdResponse::Solid3dGetNextAdjacentEdge(r) => {
|
||||
let Some(edge_id) = r.edge else {
|
||||
return Err(KclError::Internal(KclErrorDetails {
|
||||
message:format!(
|
||||
"Expected Solid3dGetNextAdjacentEdge response to have an edge ID, but found none: id={id:?}, {response:?}"
|
||||
),
|
||||
source_ranges: vec![range],
|
||||
}));
|
||||
};
|
||||
edge_id.into()
|
||||
}
|
||||
OkModelingCmdResponse::Solid3dGetOppositeEdge(r) => r.edge.into(),
|
||||
_ => {
|
||||
return Err(KclError::Internal(KclErrorDetails {
|
||||
message:format!(
|
||||
"Expected Solid3dGetNextAdjacentEdge or Solid3dGetOppositeEdge response, but got: id={id:?}, {response:?}"
|
||||
),
|
||||
source_ranges: vec![range],
|
||||
|
||||
let mut return_arr = Vec::new();
|
||||
for (index, edge) in info.edges.iter().enumerate() {
|
||||
let Some(original_info) = &edge.original_info else {
|
||||
continue;
|
||||
};
|
||||
let edge_id = ArtifactId::new(original_info.edge_id);
|
||||
let Some(artifact) = artifacts.get(&edge_id) else {
|
||||
continue;
|
||||
};
|
||||
match artifact {
|
||||
Artifact::Segment(segment) => {
|
||||
let mut new_segment = segment.clone();
|
||||
new_segment.common_surface_ids =
|
||||
original_info.faces.iter().map(|face| ArtifactId::new(*face)).collect();
|
||||
return_arr.push(Artifact::Segment(new_segment));
|
||||
}
|
||||
Artifact::SweepEdge(sweep_edge) => {
|
||||
let mut new_sweep_edge = sweep_edge.clone();
|
||||
new_sweep_edge.common_surface_ids =
|
||||
original_info.faces.iter().map(|face| ArtifactId::new(*face)).collect();
|
||||
return_arr.push(Artifact::SweepEdge(new_sweep_edge));
|
||||
}
|
||||
_ => {}
|
||||
};
|
||||
|
||||
let Some(Artifact::Segment(segment)) = artifacts.get(&edge_id) else {
|
||||
continue;
|
||||
};
|
||||
let Some(surface_id) = segment.surface_id else {
|
||||
continue;
|
||||
};
|
||||
let Some(Artifact::Wall(wall)) = artifacts.get(&surface_id) else {
|
||||
continue;
|
||||
};
|
||||
let Some(Artifact::Sweep(sweep)) = artifacts.get(&wall.sweep_id) else {
|
||||
continue;
|
||||
};
|
||||
let Some(Artifact::Path(_)) = artifacts.get(&sweep.path_id) else {
|
||||
continue;
|
||||
};
|
||||
|
||||
if let Some(opposite_info) = &edge.opposite_info {
|
||||
return_arr.push(Artifact::SweepEdge(SweepEdge {
|
||||
id: opposite_info.edge_id.into(),
|
||||
sub_type: SweepEdgeSubType::Opposite,
|
||||
seg_id: edge_id,
|
||||
cmd_id: artifact_command.cmd_id,
|
||||
index,
|
||||
sweep_id: sweep.id,
|
||||
common_surface_ids: opposite_info.faces.iter().map(|face| ArtifactId::new(*face)).collect(),
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
let mut return_arr = Vec::new();
|
||||
return_arr.push(Artifact::SweepEdge(SweepEdge {
|
||||
id: response_edge_id,
|
||||
sub_type,
|
||||
seg_id: edge_id,
|
||||
cmd_id: artifact_command.cmd_id,
|
||||
sweep_id: sweep.id,
|
||||
common_surface_ids: Vec::new(),
|
||||
}));
|
||||
let mut new_segment = segment.clone();
|
||||
new_segment.edge_ids = vec![response_edge_id];
|
||||
return_arr.push(Artifact::Segment(new_segment));
|
||||
let mut new_sweep = sweep.clone();
|
||||
new_sweep.edge_ids = vec![response_edge_id];
|
||||
return_arr.push(Artifact::Sweep(new_sweep));
|
||||
return Ok(return_arr);
|
||||
}
|
||||
ModelingCmd::Solid3dGetAllEdgeFaces(kcmc::Solid3dGetAllEdgeFaces { edge_id, .. }) => {
|
||||
let OkModelingCmdResponse::Solid3dGetAllEdgeFaces(faces) = response else {
|
||||
return Ok(Vec::new());
|
||||
};
|
||||
let edge_id = ArtifactId::new(*edge_id);
|
||||
let Some(artifact) = artifacts.get(&edge_id) else {
|
||||
return Ok(Vec::new());
|
||||
};
|
||||
let mut return_arr = Vec::new();
|
||||
match artifact {
|
||||
Artifact::Segment(segment) => {
|
||||
let mut new_segment = segment.clone();
|
||||
new_segment.common_surface_ids = faces.faces.iter().map(|face| ArtifactId::new(*face)).collect();
|
||||
new_segment.edge_ids = vec![opposite_info.edge_id.into()];
|
||||
return_arr.push(Artifact::Segment(new_segment));
|
||||
let mut new_sweep = sweep.clone();
|
||||
new_sweep.edge_ids = vec![opposite_info.edge_id.into()];
|
||||
return_arr.push(Artifact::Sweep(new_sweep));
|
||||
let mut new_wall = wall.clone();
|
||||
new_wall.edge_cut_edge_ids = vec![opposite_info.edge_id.into()];
|
||||
return_arr.push(Artifact::Wall(new_wall));
|
||||
}
|
||||
Artifact::SweepEdge(sweep_edge) => {
|
||||
let mut new_sweep_edge = sweep_edge.clone();
|
||||
new_sweep_edge.common_surface_ids = faces.faces.iter().map(|face| ArtifactId::new(*face)).collect();
|
||||
return_arr.push(Artifact::SweepEdge(new_sweep_edge));
|
||||
if let Some(adjacent_info) = &edge.adjacent_info {
|
||||
return_arr.push(Artifact::SweepEdge(SweepEdge {
|
||||
id: adjacent_info.edge_id.into(),
|
||||
sub_type: SweepEdgeSubType::Adjacent,
|
||||
seg_id: edge_id,
|
||||
cmd_id: artifact_command.cmd_id,
|
||||
index,
|
||||
sweep_id: sweep.id,
|
||||
common_surface_ids: adjacent_info.faces.iter().map(|face| ArtifactId::new(*face)).collect(),
|
||||
}));
|
||||
let mut new_segment = segment.clone();
|
||||
new_segment.edge_ids = vec![adjacent_info.edge_id.into()];
|
||||
return_arr.push(Artifact::Segment(new_segment));
|
||||
let mut new_sweep = sweep.clone();
|
||||
new_sweep.edge_ids = vec![adjacent_info.edge_id.into()];
|
||||
return_arr.push(Artifact::Sweep(new_sweep));
|
||||
let mut new_wall = wall.clone();
|
||||
new_wall.edge_cut_edge_ids = vec![adjacent_info.edge_id.into()];
|
||||
return_arr.push(Artifact::Wall(new_wall));
|
||||
}
|
||||
_ => {}
|
||||
};
|
||||
|
||||
}
|
||||
return Ok(return_arr);
|
||||
}
|
||||
ModelingCmd::Solid3dFilletEdge(cmd) => {
|
||||
|
Reference in New Issue
Block a user