forked from 1b-agent/opencadstudio-upstream
Complete UNION command behavior
This commit is contained in:
1 parent
143703d809
commit
a59ea47990
11 files changed
+503
-75
No files matched your search
@@ -163,6 +163,10 @@ pub fn kernel_surface_body(surface: &Surface) -> Option<KernelBody> {
|
||||
kernel_acis_body(&surface.acis_data)
|
||||
}
|
||||
|
||||
pub fn kernel_region_body(region: &Region) -> Option<KernelBody> {
|
||||
kernel_acis_body(®ion.acis_data)
|
||||
}
|
||||
|
||||
fn kernel_acis_body(acis: &acadrust::entities::AcisData) -> Option<KernelBody> {
|
||||
let sat = parse_acis(
|
||||
|| acis.parse(),
|
||||
|
||||
@@ -605,6 +605,9 @@ impl Scene {
|
||||
Some(EntityType::Surface(surface)) => {
|
||||
crate::scene::convert::solid3d_tess::kernel_surface_body(surface)
|
||||
}
|
||||
Some(EntityType::Region(region)) => {
|
||||
crate::scene::convert::solid3d_tess::kernel_region_body(region)
|
||||
}
|
||||
_ => None,
|
||||
})?;
|
||||
Some((handle, body))
|
||||
|
||||
@@ -975,6 +975,41 @@ fn cone_properties(
|
||||
]
|
||||
}
|
||||
|
||||
fn brep_properties(
|
||||
document: &acadrust::CadDocument,
|
||||
handle: acadrust::Handle,
|
||||
) -> Vec<PropSection> {
|
||||
let (record_history, object_show_history, show_history_mode) =
|
||||
history_flags(document, handle).unwrap_or((false, false, 1));
|
||||
let (show_history, show_history_editable) =
|
||||
displayed_history_state(object_show_history, show_history_mode);
|
||||
vec![PropSection {
|
||||
title: t!("Solid History").into_owned(),
|
||||
props: vec![
|
||||
Property {
|
||||
label: t!("History").into_owned(),
|
||||
field: PROP_HISTORY,
|
||||
value: PropValue::Choice {
|
||||
selected: if record_history { "Record" } else { "None" }.to_string(),
|
||||
options: vec!["None".to_string(), "Record".to_string()],
|
||||
},
|
||||
},
|
||||
Property {
|
||||
label: t!("Show History").into_owned(),
|
||||
field: PROP_SHOW_HISTORY,
|
||||
value: if show_history_editable {
|
||||
PropValue::Choice {
|
||||
selected: if show_history { "Yes" } else { "No" }.to_string(),
|
||||
options: vec!["No".to_string(), "Yes".to_string()],
|
||||
}
|
||||
} else {
|
||||
PropValue::ReadOnly(if show_history { "Yes" } else { "No" }.to_string())
|
||||
},
|
||||
},
|
||||
],
|
||||
}]
|
||||
}
|
||||
|
||||
fn cylinder_properties(
|
||||
document: &acadrust::CadDocument,
|
||||
handle: acadrust::Handle,
|
||||
@@ -1411,6 +1446,7 @@ pub fn primitive_properties(
|
||||
extrusion_properties(document, handle, value)
|
||||
}
|
||||
SolidHistoryOperation::Revolve(value) => revolve_properties(document, handle, value),
|
||||
SolidHistoryOperation::Brep(_) => brep_properties(document, handle),
|
||||
_ => Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -365,13 +365,18 @@ pub enum Bool {
|
||||
/// missing, and passing that on unchanged is the point: a half-done boolean
|
||||
/// looks finished.
|
||||
pub fn boolean(op: Bool, a: &Body, b: &Body) -> Option<Body> {
|
||||
boolean_result(op, a, b).ok()
|
||||
}
|
||||
|
||||
/// Combine two solids while retaining the kernel's exact refusal reason.
|
||||
pub fn boolean_result(op: Bool, a: &Body, b: &Body) -> Result<Body, brep::Snag> {
|
||||
let how = match op {
|
||||
Bool::Union => brep::Operation::Union,
|
||||
Bool::Subtract => brep::Operation::Difference,
|
||||
Bool::Intersect => brep::Operation::Intersection,
|
||||
};
|
||||
let tolerance = brep::operation_tolerance(&[a, b]);
|
||||
brep::combine(a.clone(), b.clone(), how, tolerance).ok()
|
||||
brep::combine(a.clone(), b.clone(), how, tolerance)
|
||||
}
|
||||
|
||||
// ── Tessellation ────────────────────────────────────────────────────────────
|
||||
|
||||
Reference in new issue
Block a user