forked from 1b-agent/opencadstudio-upstream
Complete MultiLeader host model coverage
Extends the adapter generator (Color, LineWeight, mixed unit/payload enums, fixed float arrays, bitflags-2 newtypes, keep_types override) and maps MultiLeader with a merge-style context patch, host validation and reference checks. staged_python_multileader_lifecycle_over_real_ipc passes the full gate including DWG and DXF reopen. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
22f9c20fe8
commit
b3f5388208
14 files changed
+523
-31
No files matched your search
@@ -0,0 +1,23 @@
|
||||
// Merge helpers for nested structs that scripts edit as a partial patch.
|
||||
|
||||
/// Apply `patch` (a dict of context fields) onto `existing`, so a script can
|
||||
/// change one context field without resetting the rest. Unknown keys error.
|
||||
fn merge_multileader_context(
|
||||
existing: &acadrust::entities::MultiLeaderAnnotContext,
|
||||
patch: PyObjectRef,
|
||||
vm: &VirtualMachine,
|
||||
) -> PyResult<acadrust::entities::MultiLeaderAnnotContext> {
|
||||
let patch = patch.try_into_value::<rustpython_vm::builtins::PyDictRef>(vm)?;
|
||||
let merged = multi_leader_annot_context_to_dict(vm, existing)?
|
||||
.try_into_value::<rustpython_vm::builtins::PyDictRef>(vm)?;
|
||||
for key in patch.keys_vec() {
|
||||
let name = key.clone().try_into_value::<String>(vm)?;
|
||||
if merged.get_item_opt(name.as_str(), vm)?.is_none() {
|
||||
return Err(vm.new_value_error(format!(
|
||||
"ocs: MultiLeader.context property {name:?} is outside the editable schema"
|
||||
)));
|
||||
}
|
||||
merged.set_item(name.as_str(), patch.get_item(name.as_str(), vm)?, vm)?;
|
||||
}
|
||||
dict_to_multi_leader_annot_context(merged.into(), vm)
|
||||
}
|
||||
Reference in new issue
Block a user