forked from 1b-agent/opencadstudio-upstream
feat(field): table formula buttons, block placeholders, attribute fields on insert, plot-time field stamping
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
b8def31145
commit
785db5683b
31 files changed
+522
-12
No files matched your search
@@ -231,7 +231,15 @@ impl OpenCADStudio {
|
||||
// objects are not part of the add delta, so the step is a snapshot.
|
||||
let text_field = self.tabs[i].active_cmd.as_ref().and_then(|cmd| cmd.text_field());
|
||||
let label = self.history_label_from_active_cmd(i, "ENTITY");
|
||||
let delta_safe = text_field.is_none() && self.delta_add_safe(i, &entity);
|
||||
// A block reference whose attribute definitions carry fields gets
|
||||
// them copied onto its attributes (field objects: snapshot step).
|
||||
let attribute_fields = match &entity {
|
||||
codec::EntityType::Insert(insert) if !insert.attributes.is_empty() => {
|
||||
crate::entities::field::block_has_attribute_fields(&self.tabs[i].scene.document, &insert.block_name)
|
||||
}
|
||||
_ => false,
|
||||
};
|
||||
let delta_safe = text_field.is_none() && !attribute_fields && self.delta_add_safe(i, &entity);
|
||||
let field_value = match &entity {
|
||||
codec::EntityType::MText(m) => m.value.clone(),
|
||||
codec::EntityType::AttributeDefinition(a) => a.default_value.clone(),
|
||||
@@ -264,6 +272,10 @@ impl OpenCADStudio {
|
||||
&field_value,
|
||||
);
|
||||
}
|
||||
if let (Some(handle), true) = (committed, attribute_fields) {
|
||||
crate::entities::field::attach_attribute_fields(&mut self.tabs[i].scene.document, handle);
|
||||
self.tabs[i].scene.bump_entities(&[(handle, crate::scene::ChangeKind::Modified)]);
|
||||
}
|
||||
if let Some(handle) = committed {
|
||||
self.apply_continuous_constraints(i, &[handle]);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user