forked from 1b-agent/opencadstudio-upstream
Complete Region: create from a profile, plus tuple and int friendliness
RegionFromProfile reuses the REGION command's kernel calls; doc.solids.region exposes it with layer and delete_source options. The lifecycle test builds regions from real circle and polyline entities and covers refusals, a move, both formats and undo. create_entity now accepts coordinate tuples for point properties and every generated float setter accepts Python ints. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
04cd9e462d
commit
c731d3a9a4
9 files changed
+233
-7
No files matched your search
@@ -406,6 +406,10 @@ fn leaf_to_py(registry: &TypeRegistry, type_id: &str, item_expr: &str) -> String
|
||||
|
||||
/// `value_expr` must already be an owned `PyObjectRef` expression. Result: a `PyResult<T>` expression.
|
||||
fn leaf_from_py(registry: &TypeRegistry, type_id: &str, value_expr: &str) -> String {
|
||||
if type_id == "f64" {
|
||||
// RustPython's f64 conversion rejects ints; scripts write `radius=5`.
|
||||
return format!("py_number_to_f64({value_expr}, vm)");
|
||||
}
|
||||
if type_id == "u64" {
|
||||
// serde reports Rust `usize` as `u64`; the inferred cast serves both.
|
||||
return format!("{value_expr}.try_into_value::<u64>(vm).map(|n| n as _)");
|
||||
|
||||
Reference in new issue
Block a user