forked from 1b-agent/opencadstudio-upstream
ocs_doc_api: Phase 3 attributes + nested block traversal
- SetAttribute op + GetAttributes/GetBlockEntities queries (append-only). - backend set_attribute (add/update Insert attribute), attributes (tag,value pairs), block_entities (read-only traversal via BlockRecord.entity_handles -> id+kind+bounds). - facade Entity::set_attribute/attributes, Document::block_entities. - spec Insert methods; api_reference + binding_schema regenerated; mocks + baseline. - Query enum: drop Copy (GetBlockEntities carries String). - Test phase3_attributes_and_block_traversal -> 608 host lib + 3 consistency green.
This commit is contained in:
1 parent
2dba0158ca
commit
67655add72
15 files changed
+267
-14
No files matched your search
@@ -145,6 +145,11 @@ Block reference. Place an existing BlockRecord by name; transform moves its inse
|
||||
|
||||
- **create_insert**(`block_name: &str, insert_point: [f64; 3], scale: f64, rotation: f64`) -> `Entity`
|
||||
|
||||
### Methods
|
||||
|
||||
- **attributes**(``) -> `Vec<(String, String)>` — query `GetAttributes`
|
||||
- **set_attribute**(`tag: &str, value: &str`) -> `()` — op `SetAttribute`
|
||||
|
||||
## `Entity` (acadrust `Viewport`, collection `entities`)
|
||||
|
||||
Paper-space viewport: a width×height window at center looking at view_target with view_height zoom. bounds = center ± w/2,h/2; transform moves center.
|
||||
|
||||
@@ -300,7 +300,39 @@
|
||||
"acadrust_variant": "Insert",
|
||||
"collection": "entities",
|
||||
"handle": "Entity",
|
||||
"methods": [],
|
||||
"methods": [
|
||||
{
|
||||
"args": [],
|
||||
"bulk": false,
|
||||
"fixed": null,
|
||||
"kind": "query",
|
||||
"name": "attributes",
|
||||
"op": null,
|
||||
"query": "GetAttributes",
|
||||
"read_only": true,
|
||||
"returns": "Vec<(String, String)>"
|
||||
},
|
||||
{
|
||||
"args": [
|
||||
{
|
||||
"name": "tag",
|
||||
"ty": "&str"
|
||||
},
|
||||
{
|
||||
"name": "value",
|
||||
"ty": "&str"
|
||||
}
|
||||
],
|
||||
"bulk": false,
|
||||
"fixed": null,
|
||||
"kind": "op",
|
||||
"name": "set_attribute",
|
||||
"op": "SetAttribute",
|
||||
"query": null,
|
||||
"read_only": false,
|
||||
"returns": "()"
|
||||
}
|
||||
],
|
||||
"name": "Insert"
|
||||
},
|
||||
{
|
||||
|
||||
@@ -40,4 +40,6 @@ pub enum Operation {
|
||||
CreateHatch(HatchSpec),
|
||||
// dimensions
|
||||
CreateDimensionLinear(DimensionSpec),
|
||||
// attributes
|
||||
SetAttribute { id: ObjectId, tag: String, value: String },
|
||||
}
|
||||
@@ -9,7 +9,8 @@ use crate::id::ObjectId;
|
||||
|
||||
/// A typed read query (plan §5). Read-only: no mutation, no undo, no revision
|
||||
/// bump. Safe to batch (`EnvelopeBody::Queries`). Append new variants at the END only.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
|
||||
/// (Not `Copy`: some variants carry owned data like a block name.)
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
#[non_exhaustive]
|
||||
pub enum Query {
|
||||
GetEntity { id: ObjectId },
|
||||
@@ -25,4 +26,8 @@ pub enum Query {
|
||||
GetHatchBoundary { id: ObjectId },
|
||||
/// The measured value of a Dimension (distance or angle).
|
||||
GetDimensionMeasurement { id: ObjectId },
|
||||
/// An insert's attributes as (tag, value) pairs.
|
||||
GetAttributes { id: ObjectId },
|
||||
/// The entity ids + kinds inside a block definition (read-only traversal).
|
||||
GetBlockEntities { block_name: String },
|
||||
}
|
||||
Reference in new issue
Block a user