forked from 1b-agent/opencadstudio-upstream
feat: ATTREQ — attribute prompting during INSERT
When inserting a block that contains AttributeDefinition entities, the INSERT command now enters an attribute-filling phase: each attdef is prompted tag-by-tag (showing its prompt text and default value). Pressing Enter accepts the default. The completed AttributeEntity list is embedded in the Insert before committing. Blocks without attdefs continue to insert immediately as before. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
1 parent
f73d38f0a2
commit
a20558a024
4 files changed
+168
-17
No files matched your search
@@ -138,6 +138,10 @@ pub enum CmdResult {
|
||||
/// Translation vector to apply to vertices inside the window.
|
||||
delta: Vec3,
|
||||
},
|
||||
/// INSERT landed on a block that has AttributeDefinitions.
|
||||
/// The host should look up the attdefs for `block_name` from the document
|
||||
/// and call `attreq_set_attdefs()` on the command, then loop on text input.
|
||||
AttreqNeeded { block_name: String },
|
||||
}
|
||||
|
||||
// ── Trait ─────────────────────────────────────────────────────────────────
|
||||
@@ -242,6 +246,17 @@ pub trait CadCommand: Send {
|
||||
/// Inject attribute (tag, value) pairs into the command after entity pick.
|
||||
fn attedit_set_attrs(&mut self, _attrs: Vec<(String, String)>) {}
|
||||
|
||||
/// Inject attribute definitions (tag, prompt, default_value) for ATTREQ
|
||||
/// attr-filling after INSERT point is picked.
|
||||
fn attreq_set_attdefs(&mut self, _attdefs: Vec<(String, String, String)>) {}
|
||||
|
||||
/// Returns the INSERT entity built so far (pending attr fill) if this is an
|
||||
/// ATTREQ-aware INSERT command waiting for attdef injection.
|
||||
/// Called by the host after `AttreqNeeded` to commit the completed Insert.
|
||||
fn attreq_take_insert(&mut self) -> Option<acadrust::EntityType> {
|
||||
None
|
||||
}
|
||||
|
||||
|
||||
/// Called instead of `on_point` when the command needs a tangent pick
|
||||
/// and the snap system found a tangent object.
|
||||
|
||||
Reference in new issue
Block a user