forked from 1b-agent/opencadstudio-upstream
Fix extrusion surface properties and snapping
This commit is contained in:
1 parent
a24d1e6108
commit
11057cc5e9
15 files changed
+383
-55
No files matched your search
+24
-9
@@ -2142,6 +2142,17 @@ impl OpenCADStudio {
|
||||
entity_type_label(entity)
|
||||
}
|
||||
}
|
||||
acadrust::EntityType::Surface(_)
|
||||
if matches!(
|
||||
crate::scene::model::solid_history::primitive_property_operation(
|
||||
&self.tabs[i].scene.document,
|
||||
handle,
|
||||
),
|
||||
Some(acadrust::objects::SolidHistoryOperation::Extrusion(_))
|
||||
) =>
|
||||
{
|
||||
format!("{} ({})", t!("Surface"), t!("Extrusion"))
|
||||
}
|
||||
_ => entity_type_label(entity),
|
||||
};
|
||||
ui::PropertiesPanel {
|
||||
@@ -2249,23 +2260,22 @@ filter={:.1} local={:.1} aggregate={:.1} entities={}",
|
||||
);
|
||||
}
|
||||
}
|
||||
if local_refs.iter().all(|(handle, _)| {
|
||||
let compact_solids = local_refs.iter().all(|(handle, _)| {
|
||||
crate::scene::model::solid_history::has_compact_solid_properties(
|
||||
&self.tabs[i].scene.document,
|
||||
*handle,
|
||||
)
|
||||
}) {
|
||||
sections.retain(|section| {
|
||||
!section.props.iter().any(|property| {
|
||||
property.field.starts_with("acis_")
|
||||
|| property.field.starts_with("s3d_")
|
||||
})
|
||||
});
|
||||
});
|
||||
if compact_solids {
|
||||
retain_compact_solid_sections(&mut sections);
|
||||
}
|
||||
sections.extend(aggregate_solid_history_sections(
|
||||
&self.tabs[i].scene.document,
|
||||
&local_refs.iter().map(|(handle, _)| *handle).collect::<Vec<_>>(),
|
||||
));
|
||||
if compact_solids {
|
||||
retain_compact_solid_sections(&mut sections);
|
||||
}
|
||||
ui::PropertiesPanel {
|
||||
choice_combos: sections
|
||||
.iter()
|
||||
@@ -3205,6 +3215,10 @@ fn retain_compact_solid_sections(
|
||||
sections: &mut Vec<crate::scene::model::object::PropSection>,
|
||||
) {
|
||||
sections.iter_mut().for_each(|section| {
|
||||
let internal_surface_section = section
|
||||
.props
|
||||
.iter()
|
||||
.any(|property| property.field == "srf_kind");
|
||||
section.props.retain(|property| {
|
||||
matches!(
|
||||
property.field,
|
||||
@@ -3217,7 +3231,8 @@ fn retain_compact_solid_sections(
|
||||
| "transparency"
|
||||
| "hyperlink"
|
||||
| "material"
|
||||
) || crate::scene::model::solid_history::is_specialized_property(property.field)
|
||||
) || (!internal_surface_section
|
||||
&& crate::scene::model::solid_history::is_specialized_property(property.field))
|
||||
});
|
||||
});
|
||||
sections.retain(|section| !section.props.is_empty());
|
||||
|
||||
@@ -2002,7 +2002,48 @@ pub(super) fn on_tab_close(&mut self, idx: usize) -> Task<Message> {
|
||||
}
|
||||
self.push_undo_snapshot(i, "CHPROP");
|
||||
|
||||
if crate::scene::model::solid_history::is_loft_geometry_choice(field) {
|
||||
if crate::scene::model::solid_history::is_surface_property_choice(field) {
|
||||
use crate::scene::model::solid_history::{
|
||||
PROP_SURFACE_MAINTAIN_ASSOCIATIVITY, PROP_SURFACE_SHOW_ASSOCIATIVITY,
|
||||
PROP_SURFACE_WIREFRAME_TYPE,
|
||||
};
|
||||
for &handle in &handles {
|
||||
if self.tabs[i].scene.is_layer_locked(handle) {
|
||||
continue;
|
||||
}
|
||||
let Some(mut state) = self.tabs[i]
|
||||
.scene
|
||||
.document
|
||||
.get_entity(handle)
|
||||
.and_then(|entity| match entity {
|
||||
acadrust::EntityType::Surface(surface) => Some(
|
||||
crate::entities::solid3d::surface_property_state(surface),
|
||||
),
|
||||
_ => None,
|
||||
})
|
||||
else {
|
||||
continue;
|
||||
};
|
||||
match field {
|
||||
PROP_SURFACE_WIREFRAME_TYPE => {
|
||||
state.isolines = !value.eq_ignore_ascii_case("Isoparms")
|
||||
}
|
||||
PROP_SURFACE_MAINTAIN_ASSOCIATIVITY => {
|
||||
state.maintain_associativity = value.eq_ignore_ascii_case("Yes")
|
||||
}
|
||||
PROP_SURFACE_SHOW_ASSOCIATIVITY => {
|
||||
state.show_associativity = value.eq_ignore_ascii_case("Yes")
|
||||
}
|
||||
_ => continue,
|
||||
}
|
||||
crate::scene::view::dispatch::set_entity_xdata(
|
||||
&mut self.tabs[i].scene.document,
|
||||
handle,
|
||||
crate::entities::solid3d::SURFACE_PROPERTIES_APP,
|
||||
Some(crate::entities::solid3d::surface_property_xdata_values(state)),
|
||||
);
|
||||
}
|
||||
} else if crate::scene::model::solid_history::is_loft_geometry_choice(field) {
|
||||
// These choices change the generated body, not just history
|
||||
// flags. Use the same transactional rebuild as numeric edits.
|
||||
for &handle in &handles {
|
||||
|
||||
Reference in new issue
Block a user