forked from 1b-agent/opencadstudio-upstream
Aligned constraint: axis lines, zero collapse, Properties form/reference/description, screen-sized text
Point & line and 2Lines take a text baseline or an ellipse axis as the line; a zero value folds the points onto the first one; 2Lines turns the second line about its start. The Properties Constraint section edits Constraint Form (Dynamic on the *ADSK_CONSTRAINTS layer, Annotational on the current layer), Reference (driven constraint in parentheses whose parameter follows the measurement) and Description (stored with the parameter and the native variable). Dynamic dimensions keep a 12 px text and 8 px arrows at any zoom, drop trailing zeros and show formulas as `fx: len=d1*2`; the hidden constraints layer stays out of the layer lists. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
6969c19746
commit
5fab97a7d0
12 files changed
+476
-45
No files matched your search
@@ -474,6 +474,9 @@ pub struct Parameter {
|
||||
#[derive(Debug, Clone, Default, PartialEq)]
|
||||
pub struct ParameterTable {
|
||||
parameters: Vec<Parameter>,
|
||||
/// The free-text description a parameter carries (the reference's
|
||||
/// Description column), by name.
|
||||
descriptions: HashMap<String, String>,
|
||||
}
|
||||
|
||||
impl ParameterTable {
|
||||
@@ -481,6 +484,23 @@ impl ParameterTable {
|
||||
Self::default()
|
||||
}
|
||||
|
||||
pub fn description(&self, name: &str) -> &str {
|
||||
self.descriptions.get(name).map_or("", String::as_str)
|
||||
}
|
||||
|
||||
/// Stores `description` for an existing parameter; an empty text clears it.
|
||||
pub fn set_description(&mut self, name: &str, description: &str) {
|
||||
if !self.contains(name) {
|
||||
return;
|
||||
}
|
||||
if description.trim().is_empty() {
|
||||
self.descriptions.remove(name);
|
||||
} else {
|
||||
self.descriptions
|
||||
.insert(name.to_string(), description.trim().to_string());
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.parameters.is_empty()
|
||||
}
|
||||
@@ -549,6 +569,7 @@ impl ParameterTable {
|
||||
/// need to invent (a future UI stage may still want to warn before
|
||||
/// deleting — that's a UI-layer decision, not a data-layer one).
|
||||
pub fn remove(&mut self, name: &str) -> bool {
|
||||
self.descriptions.remove(name);
|
||||
match self.index_of(name) {
|
||||
Some(i) => {
|
||||
self.parameters.remove(i);
|
||||
|
||||
Reference in new issue
Block a user