forked from 1b-agent/opencadstudio-upstream
ocs_doc_api: Phase 3 (block references)
- Operation::CreateInsert(InsertSpec) appended to the wire enum (append-only). - backend add_insert validates the BlockRecord exists (unknown block -> Validation, no mutation); host inserts acadrust::entities::Insert with scale+rotation. - Insert transform moves insert_point (transform_entity_geometry) + ensure_transformable includes Insert. - facade EntityCollection::create_insert; spec Insert family; api_reference + binding_schema regenerated; mocks updated. - Test phase3_create_insert_and_transform -> 599 host lib green. - IMPLEMENTATION.md: Phase 3 done (attributes/traversal remaining).
This commit is contained in:
1 parent
d46351cdb3
commit
b03f68737e
13 files changed
+146
-5
No files matched your search
@@ -464,6 +464,21 @@ pub struct EntityCollection {
|
||||
}
|
||||
|
||||
impl EntityCollection {
|
||||
/// Place a block reference (`INSERT`) for `block_name` (must exist).
|
||||
pub fn create_insert(&self, block_name: &str, insert_point: [f64; 3], scale: f64, rotation: f64) -> ApiResult<Entity> {
|
||||
let receipt = self.session.apply_op(Operation::CreateInsert(crate::ops::InsertSpec {
|
||||
block_name: block_name.to_string(),
|
||||
insert_point,
|
||||
scale,
|
||||
rotation,
|
||||
}))?;
|
||||
let id = receipt
|
||||
.outcome
|
||||
.and_then(|o| o.new_id())
|
||||
.ok_or_else(|| ApiError::Transport("create_insert returned no id".into()))?;
|
||||
Ok(Entity::new(self.session.clone(), id))
|
||||
}
|
||||
|
||||
/// Generic lookup by id (any family) → `Entity` (downcast via `as_solid()`, …).
|
||||
pub fn get(&self, id: ObjectId) -> ApiResult<Entity> {
|
||||
// Validate existence eagerly so `get` errors surface as `UnknownId`.
|
||||
|
||||
Reference in new issue
Block a user