Decide Insert and Polyline: Insert creatable by block name, Polyline update-only

Insert can be created by naming an existing ordinary block; the host refuses
unknown blocks, model/paper space and containment cycles, and keeps legacy
inserts of missing blocks editable. The legacy Polyline is update-only with a
hint toward Polyline2D and Polyline3D because both writers convert it on
save. The generator gains update_only_message.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Felix RiestraandClaude Sonnet 5 committed 2026-09-20 16:14:02 +02:00
1 parent cae188dd08
commit eb22de636b
8 files changed
+734 -201

No files matched your search

+10 -1
View File
@@ -55,6 +55,9 @@ pub struct EntityOverride {
/// create one without host-side reference setup.
#[serde(default)]
pub update_only: bool,
/// Message returned when a script tries to create an update-only kind.
#[serde(default)]
pub update_only_message: Option<String>,
#[serde(default)]
pub fields: std::collections::BTreeMap<String, FieldOverride>,
}
@@ -874,7 +877,13 @@ pub(crate) fn entity_to_dict(vm: &VirtualMachine, entity: &acadrust::EntityType)
fn gen_dict_to_entity(manifest: &Manifest, registry: &TypeRegistry) -> String {
let mut arms = String::new();
for kind in &manifest.type_filter {
if manifest.overrides.get(kind).is_some_and(|override_def| override_def.update_only) {
if let Some(override_def) = manifest.overrides.get(kind).filter(|o| o.update_only) {
let message = override_def.update_only_message.clone().unwrap_or_else(|| {
format!("{kind} cannot be created through the generic API; only existing {kind} entities can be edited")
});
arms.push_str(&format!(
" \"{kind}\" => {{ return Err(vm.new_value_error({message:?}.to_owned())); }}\n"
));
continue;
}
if manifest.manual_kinds.contains(kind) {