getCommonEdge as default way of filleting (#6043)

* Common edge faces into artifact graph

* clean up

* kingdom of tags

* add tests

* hook up tags with edge treatments

* update unit tests

* update e2e

* clean up

* more fix up after main merge

* fmt

* revolve fix

* fix new circular dependency

* fix revolve

* remove numbers from circ deps, makes diffs bad

* sim test updates

* try and get tests working

* update

* Fix tsc error

---------

Co-authored-by: max-mrgrsk <156543465+max-mrgrsk@users.noreply.github.com>
Co-authored-by: max <margorskyi@gmail.com>
Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
This commit is contained in:
Kurt Hutten
2025-04-26 14:00:28 +10:00
committed by GitHub
parent 50f8131d83
commit 8de648f0db
224 changed files with 157661 additions and 42680 deletions

View File

@ -175,6 +175,8 @@ pub struct Segment {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub edge_cut_id: Option<ArtifactId>,
pub code_ref: CodeRef,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub common_surface_ids: Vec<ArtifactId>,
}
/// A sweep is a more generic term for extrude, revolve, loft, and sweep.
@ -277,6 +279,8 @@ pub struct SweepEdge {
pub sub_type: SweepEdgeSubType,
pub seg_id: ArtifactId,
pub sweep_id: ArtifactId,
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub common_surface_ids: Vec<ArtifactId>,
}
#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq, ts_rs::TS)]
@ -464,6 +468,7 @@ impl Segment {
merge_opt_id(&mut self.surface_id, new.surface_id);
merge_ids(&mut self.edge_ids, new.edge_ids);
merge_opt_id(&mut self.edge_cut_id, new.edge_cut_id);
merge_ids(&mut self.common_surface_ids, new.common_surface_ids);
None
}
@ -792,6 +797,7 @@ fn artifacts_to_update(
edge_ids: Vec::new(),
edge_cut_id: None,
code_ref: CodeRef { range, path_to_node },
common_surface_ids: Vec::new(),
}));
let path = artifacts.get(&path_id);
if let Some(Artifact::Path(path)) = path {
@ -1039,6 +1045,7 @@ fn artifacts_to_update(
sub_type,
seg_id: edge_id,
sweep_id: sweep.id,
common_surface_ids: Vec::new(),
}));
let mut new_segment = segment.clone();
new_segment.edge_ids = vec![response_edge_id];
@ -1048,6 +1055,31 @@ fn artifacts_to_update(
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();
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 = faces.faces.iter().map(|face| ArtifactId::new(*face)).collect();
return_arr.push(Artifact::SweepEdge(new_sweep_edge));
}
_ => {}
};
return Ok(return_arr);
}
ModelingCmd::Solid3dFilletEdge(cmd) => {
let mut return_arr = Vec::new();
return_arr.push(Artifact::EdgeCut(EdgeCut {

View File

@ -119,6 +119,7 @@ impl Artifact {
if let Some(edge_cut_id) = a.edge_cut_id {
ids.push(edge_cut_id);
}
ids.extend(&a.common_surface_ids);
ids
}
Artifact::Solid2d(_) => {
@ -155,10 +156,12 @@ impl Artifact {
ids.extend(&a.path_ids);
ids
}
Artifact::SweepEdge(_) => {
Artifact::SweepEdge(a) => {
// Note: Don't include these since they're parents: seg_id,
// sweep_id.
Vec::new()
let mut ids = Vec::new();
ids.extend(&a.common_surface_ids);
ids
}
Artifact::EdgeCut(a) => {
// Note: Don't include these since they're parents: