Files
OneCAD-Draft/crates/ocs_doc_api/spec/entities.toml
T

582 lines
18 KiB
TOML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Curated source of truth for ocs_doc_api codegen (plan §10, decision #6).
# Maps entity families + their construction ops, geometric actions, and queries
# to kernel fns / acadrust variants. build.rs regenerates src/gen/* from this;
# CI fails on drift. New op/query variants append at the END only (bincode
# discriminant stability).
#
# `status` values: "supported" (default), "unsupported" (present but errors),
# "planned" (roadmap; no callable surface). Generic handle methods
# (bounds/transform/delete) are documented once in build.rs and apply to every
# family unless overridden here.
[meta]
envelope_version = 1
# ============================================================================
# SOLID FAMILY (phase 1) — B-rep solids via cadkernel
# ============================================================================
[[family]]
name = "Solid"
acadrust_variant = "Solid3D"
handle = "Solid"
collection = "solids"
description = "B-rep solid. Host resolves bodies via the solid_models cache (lift-on-miss from ACIS SAT)."
[[family.constructor]]
name = "create_cuboid"
args = [{ name = "origin", ty = "[f64; 3]" }, { name = "size", ty = "[f64; 3]" }]
op = "CreateSolid"
fixed = { primitive = "Cuboid" }
[[family.constructor]]
name = "create_sphere"
args = [{ name = "centre", ty = "[f64; 3]" }, { name = "radius", ty = "f64" }]
op = "CreateSolid"
fixed = { primitive = "Sphere" }
[[family.constructor]]
name = "create_cylinder"
args = [{ name = "base", ty = "[f64; 3]" }, { name = "radius", ty = "f64" }, { name = "height", ty = "f64" }]
op = "CreateSolid"
fixed = { primitive = "Cylinder" }
[[family.constructor]]
name = "create_cone"
args = [{ name = "base", ty = "[f64; 3]" }, { name = "radius", ty = "f64" }, { name = "height", ty = "f64" }]
op = "CreateSolid"
fixed = { primitive = "Cone" }
[[family.constructor]]
name = "create_torus"
args = [{ name = "centre", ty = "[f64; 3]" }, { name = "major_radius", ty = "f64" }, { name = "minor_radius", ty = "f64" }]
op = "CreateSolid"
fixed = { primitive = "Torus" }
[[family.constructor]]
name = "create_wedge"
args = [{ name = "origin", ty = "[f64; 3]" }, { name = "size", ty = "[f64; 3]" }]
op = "CreateSolid"
fixed = { primitive = "Wedge" }
[[family.constructor]]
name = "extrude"
args = [{ name = "profile", ty = "EntityRef" }, { name = "direction", ty = "[f64; 3]" }]
op = "Extrude"
[[family.constructor]]
name = "revolve"
args = [{ name = "profile", ty = "EntityRef" }, { name = "pivot", ty = "[f64; 3]" }, { name = "axis", ty = "[f64; 3]" }, { name = "angle", ty = "f64" }]
op = "Revolve"
[[family.constructor]]
name = "loft"
args = [{ name = "profiles", ty = "&[EntityRef]" }]
op = "Loft"
[[family.method]]
name = "intersect"
kind = "op"
op = "SolidBoolean"
args = [{ name = "other", ty = "Solid" }]
returns = "Solid"
fixed = { op = "Intersection", erase_sources = true }
[[family.method]]
name = "union"
kind = "op"
op = "SolidBoolean"
args = [{ name = "other", ty = "Solid" }]
returns = "Solid"
fixed = { op = "Union", erase_sources = true }
[[family.method]]
name = "subtract"
kind = "op"
op = "SolidBoolean"
args = [{ name = "other", ty = "Solid" }]
returns = "Solid"
fixed = { op = "Difference", erase_sources = true }
[[family.method]]
name = "volume"
kind = "query"
query = "GetVolume"
returns = "f64"
[[family.method]]
name = "centroid"
kind = "query"
query = "GetCentroid"
returns = "[f64; 3]"
[[family.method]]
name = "intersects"
kind = "query"
query = "GetIntersects"
args = [{ name = "other", ty = "Solid" }]
returns = "bool"
# ============================================================================
# CURVE FAMILY (phase 1, minimal 2D)
# ============================================================================
[[family]]
name = "Line"
acadrust_variant = "Line"
handle = "Line"
collection = "curves"
[[family.constructor]]
name = "create_line"
args = [{ name = "start", ty = "[f64; 3]" }, { name = "end", ty = "[f64; 3]" }]
op = "CreateCurve"
fixed = { curve = "Line" }
[[family]]
name = "Circle"
acadrust_variant = "Circle"
handle = "Circle"
collection = "curves"
[[family.constructor]]
name = "create_circle"
args = [{ name = "centre", ty = "[f64; 3]" }, { name = "radius", ty = "f64" }]
op = "CreateCurve"
fixed = { curve = "Circle" }
[[family]]
name = "Polyline"
acadrust_variant = "LwPolyline"
handle = "Polyline"
collection = "curves"
[[family.constructor]]
name = "create_polyline"
args = [{ name = "points", ty = "&[[f64; 3]]" }, { name = "closed", ty = "bool" }]
op = "CreateCurve"
fixed = { curve = "Polyline" }
[[family.method]]
name = "add_vertex"
kind = "op"
op = "AddVertex"
args = [{ name = "at", ty = "usize" }, { name = "point", ty = "[f64; 3]" }]
returns = "()"
[[family]]
name = "Point"
acadrust_variant = "Point"
handle = "Point"
collection = "curves"
[[family.constructor]]
name = "create_point"
args = [{ name = "position", ty = "[f64; 3]" }]
op = "CreateCurve"
fixed = { curve = "Point" }
[[family.constructor]]
name = "create_points"
args = [{ name = "positions", ty = "&[[f64; 3]]" }]
op = "CreateMany"
fixed = { curve = "Point" }
bulk = true
returns = "Vec<Point>"
[[family]]
name = "Arc"
acadrust_variant = "Arc"
handle = "ArcCurve"
collection = "curves"
[[family.constructor]]
name = "create_arc"
args = [{ name = "centre", ty = "[f64; 3]" }, { name = "radius", ty = "f64" }, { name = "start_angle", ty = "f64" }, { name = "end_angle", ty = "f64" }]
op = "CreateCurve"
fixed = { curve = "Arc" }
[[family]]
name = "Ellipse"
acadrust_variant = "Ellipse"
handle = "Ellipse"
collection = "curves"
[[family.constructor]]
name = "create_ellipse"
args = [{ name = "centre", ty = "[f64; 3]" }, { name = "major_axis", ty = "[f64; 3]" }, { name = "ratio", ty = "f64" }, { name = "start", ty = "f64" }, { name = "end", ty = "f64" }]
op = "CreateCurve"
fixed = { curve = "Ellipse" }
[[family]]
name = "Spline"
acadrust_variant = "Spline"
handle = "Spline"
collection = "curves"
[[family.constructor]]
name = "create_spline"
args = [{ name = "degree", ty = "i32" }, { name = "control_points", ty = "&[[f64; 3]]" }, { name = "knots", ty = "&[f64]" }, { name = "weights", ty = "&[f64]" }]
op = "CreateCurve"
fixed = { curve = "Spline" }
[[family]]
name = "Ray"
acadrust_variant = "Ray"
handle = "Ray"
collection = "curves"
[[family.constructor]]
name = "create_ray"
args = [{ name = "origin", ty = "[f64; 3]" }, { name = "direction", ty = "[f64; 3]" }]
op = "CreateCurve"
fixed = { curve = "Ray" }
[[family]]
name = "XLine"
acadrust_variant = "XLine"
handle = "XLine"
collection = "curves"
[[family.constructor]]
name = "create_xline"
args = [{ name = "origin", ty = "[f64; 3]" }, { name = "direction", ty = "[f64; 3]" }]
op = "CreateCurve"
fixed = { curve = "XLine" }
# ============================================================================
# ANNOTATION FAMILY (phase 2b) — text annotations
# ============================================================================
[[family]]
name = "Text"
acadrust_variant = "Text"
handle = "Text"
collection = "curves"
description = "Single-line text annotation. content()/set_content() read+replace the value; transform moves insertion point."
[[family.constructor]]
name = "create_text"
args = [{ name = "value", ty = "&str" }, { name = "insertion_point", ty = "[f64; 3]" }, { name = "height", ty = "f64" }, { name = "rotation", ty = "f64" }]
op = "CreateText"
[[family.method]]
name = "content"
kind = "query"
query = "GetTextContent"
returns = "String"
[[family.method]]
name = "set_content"
kind = "op"
op = "SetTextContent"
args = [{ name = "value", ty = "&str" }]
returns = "()"
[[family]]
name = "MText"
acadrust_variant = "MText"
handle = "MText"
collection = "curves"
description = "Multi-line text annotation. content()/set_content() read+replace the value; transform moves insertion point."
[[family.constructor]]
name = "create_mtext"
args = [{ name = "value", ty = "&str" }, { name = "insertion_point", ty = "[f64; 3]" }, { name = "height", ty = "f64" }]
op = "CreateMText"
[[family.method]]
name = "content"
kind = "query"
query = "GetTextContent"
returns = "String"
[[family.method]]
name = "set_content"
kind = "op"
op = "SetTextContent"
args = [{ name = "value", ty = "&str" }]
returns = "()"
# ============================================================================
# HATCH FAMILY (phase 2b) — filled regions
# ============================================================================
[[family]]
name = "Hatch"
acadrust_variant = "Hatch"
handle = "Entity"
collection = "curves"
description = "Filled region over a closed polyline boundary. boundary() returns the loops; bounds from boundary; generic delete."
[[family.constructor]]
name = "create_hatch"
args = [{ name = "boundary", ty = "&[[f64; 2]]" }, { name = "solid", ty = "bool" }]
op = "CreateHatch"
[[family.method]]
name = "boundary"
kind = "query"
query = "GetHatchBoundary"
returns = "Vec<Vec<[f64; 2]>>"
# ============================================================================
# DIMENSION FAMILY (phase 2c) — linear dimensions
# ============================================================================
[[family]]
name = "Dimension"
acadrust_variant = "Dimension"
handle = "Dimension"
collection = "curves"
description = "Linear dimension between two measured points. measurement() reads the distance; bounds from the measured + definition points."
[[family.constructor]]
name = "create_dimension_linear"
args = [{ name = "first_point", ty = "[f64; 3]" }, { name = "second_point", ty = "[f64; 3]" }, { name = "definition_point", ty = "[f64; 3]" }]
op = "CreateDimensionLinear"
[[family.constructor]]
name = "create_dimension_radius"
args = [{ name = "center", ty = "[f64; 3]" }, { name = "point", ty = "[f64; 3]" }]
op = "CreateDimensionRadius"
[[family.constructor]]
name = "create_dimension_diameter"
args = [{ name = "center", ty = "[f64; 3]" }, { name = "point", ty = "[f64; 3]" }]
op = "CreateDimensionDiameter"
[[family.constructor]]
name = "create_dimension_angular"
args = [{ name = "vertex", ty = "[f64; 3]" }, { name = "first_point", ty = "[f64; 3]" }, { name = "second_point", ty = "[f64; 3]" }, { name = "arc_location", ty = "[f64; 3]" }]
op = "CreateDimensionAngular"
[[family.constructor]]
name = "create_dimension_angular2ln"
args = [{ name = "vertex", ty = "[f64; 3]" }, { name = "first_point", ty = "[f64; 3]" }, { name = "second_point", ty = "[f64; 3]" }, { name = "arc_location", ty = "[f64; 3]" }]
op = "CreateDimensionAngular2Ln"
[[family.method]]
name = "measurement"
kind = "query"
query = "GetDimensionMeasurement"
returns = "f64"
# ============================================================================
# CONTAINER FAMILY (phase 3) — block references
# ============================================================================
[[family]]
name = "Insert"
acadrust_variant = "Insert"
handle = "Entity"
collection = "entities"
description = "Block reference. Place an existing BlockRecord by name; transform moves its insert point."
[[family.constructor]]
name = "create_insert"
args = [{ name = "block_name", ty = "&str" }, { name = "insert_point", ty = "[f64; 3]" }, { name = "scale", ty = "f64" }, { name = "rotation", ty = "f64" }]
op = "CreateInsert"
[[family.method]]
name = "attributes"
kind = "query"
query = "GetAttributes"
returns = "Vec<(String, String)>"
[[family.method]]
name = "set_attribute"
kind = "op"
op = "SetAttribute"
args = [{ name = "tag", ty = "&str" }, { name = "value", ty = "&str" }]
returns = "()"
# ============================================================================
# ATTRIBUTE-DEFINITION FAMILY (phase 3-ii) — in-block attribute definitions
# ============================================================================
[[family]]
name = "AttributeDefinition"
acadrust_variant = "AttributeDefinition"
handle = "Entity"
collection = "entities"
description = "In-block attribute definition (ATTDEF): tag/prompt/default at an insertion point."
[[family.constructor]]
name = "create_attribute_definition"
args = [{ name = "tag", ty = "&str" }, { name = "prompt", ty = "&str" }, { name = "default_value", ty = "&str" }, { name = "insertion_point", ty = "[f64; 3]" }, { name = "height", ty = "f64" }, { name = "rotation", ty = "f64" }]
op = "CreateAttributeDefinition"
# ============================================================================
# PAPER-SPACE FAMILY (phase 4) — viewports
# ============================================================================
[[family]]
name = "Viewport"
acadrust_variant = "Viewport"
handle = "Entity"
collection = "entities"
description = "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."
[[family.constructor]]
name = "create_viewport"
args = [{ name = "center", ty = "[f64; 3]" }, { name = "width", ty = "f64" }, { name = "height", ty = "f64" }, { name = "view_target", ty = "[f64; 3]" }, { name = "view_height", ty = "f64" }]
op = "CreateViewport"
[[family.method]]
name = "viewport_view"
kind = "query"
query = "GetViewportView"
returns = "([f64; 3], f64)"
[[family.method]]
name = "set_view"
kind = "op"
op = "SetViewportView"
args = [{ name = "view_target", ty = "[f64; 3]" }, { name = "view_height", ty = "f64" }]
returns = "()"
# ============================================================================
# MEDIA & MISC (phase 5, read-mostly) — read-only EntityView, no typed create.
# These families report a real `kind` via GetEntity and coarse bounds where
# computable; they have no typed construction/geometric ops in v1.
# ============================================================================
[[family]]
name = "RasterImage"
acadrust_variant = "RasterImage"
handle = "Entity"
collection = "entities"
description = "Raster image: create_raster_image(file_path, insertion, u, v, size) places an image (host auto-registers the ImageDefinition); bounds (4-corner bracket); delete."
[[family.constructor]]
name = "create_raster_image"
args = [{ name = "file_path", ty = "&str" }, { name = "insertion_point", ty = "[f64; 3]" }, { name = "u_vector", ty = "[f64; 3]" }, { name = "v_vector", ty = "[f64; 3]" }, { name = "size", ty = "[f64; 2]" }]
op = "CreateRasterImage"
[[family]]
name = "Table"
acadrust_variant = "Table"
handle = "Entity"
collection = "entities"
description = "Table: create_table(insertion_point, data[row][col]) builds rows x columns of text cells; non-rectangular grid -> Validation; delete."
[[family.constructor]]
name = "create_table"
args = [{ name = "insertion_point", ty = "[f64; 3]" }, { name = "data", ty = "&[Vec<String>]" }]
op = "CreateTable"
# ============================================================================
# XDATA / XRECORD FAMILY — application-specific extended data roundtrip
# ============================================================================
[[family]]
name = "XRecord"
acadrust_variant = "XRecord"
handle = "XRecord"
collection = "entities"
description = "Extended record (XRecord): arbitrary DXF group-code/value pairs. Roundtripped verbatim as an XRecordSpec payload."
[[family.constructor]]
name = "create_xrecord"
args = [{ name = "spec", ty = "XRecordSpec" }]
op = "CreateXRecord"
returns = "Entity"
[[family.method]]
name = "payload"
kind = "query"
query = "GetXRecord"
returns = "XRecordSpec"
[[family.method]]
name = "set_payload"
kind = "op"
op = "SetXRecord"
args = [{ name = "spec", ty = "XRecordSpec" }]
returns = "()"
# Cross-cutting: every Entity handle can read/write its own XDATA.
[[family.method]]
name = "xdata"
kind = "query"
query = "GetXData"
args = [{ name = "application_name", ty = "&str" }]
returns = "Option<XDataRecord>"
[[family.method]]
name = "set_xdata"
kind = "op"
op = "SetXData"
args = [{ name = "application_name", ty = "&str" }, { name = "record", ty = "Option<XDataRecord>" }]
returns = "()"
# ============================================================================
# Cross-cutting ops (generic handles + bulk) — documented in build.rs
# ============================================================================
# - Generic handle methods on EVERY handle: bounds() -> Aabb, transform(placement),
# delete(), id() -> ObjectId. (transform is solids-only in v1.)
# - EntityCollection: get(id) -> Entity, delete(id), transform_many(&ids, pl),
# delete_many(&ids).
# - Bulk ops (CreateMany / TransformMany / DeleteMany): single op, all-or-nothing
# via upfront validation, item-capped (BULK_ITEM_CAP).
# - Read-only batching: query_batch(|q| ...) — one round-trip, no revision bump.
# - OpGroup: best-effort client-side failure cleanup (NOT a transaction).
# ============================================================================
# LAYER family (named drawing layers)
# ============================================================================
[[family]]
name = "Layer"
handle = "Layer"
collection = "layers"
description = "Named drawing layer (color, linetype, lineweight, visibility). Not an entity handle; accessed through Document::layers()."
[[family.method]]
name = "list"
kind = "query"
query = "ListLayers"
returns = "Vec<LayerInfo>"
[[family.method]]
name = "create"
kind = "op"
op = "CreateLayer"
args = [{ name = "info", ty = "LayerInfo" }]
returns = "()"
[[family.method]]
name = "update"
kind = "op"
op = "UpdateLayer"
args = [{ name = "name", ty = "String" }, { name = "info", ty = "LayerInfo" }]
returns = "()"
[[family.method]]
name = "delete"
kind = "op"
op = "DeleteLayer"
args = [{ name = "name", ty = "String" }]
returns = "()"
# ---- Kernel/op mapping (reference for the executor + docs) ----
[[kernel_map]]
op = "CreateSolid.Cuboid"
kernel = "cadkernel::brep::make::cuboid"
returns = "Option<Body>"
[[kernel_map]]
op = "CreateSolid.Sphere"
kernel = "cadkernel::brep::make::sphere"
returns = "Option<Body>"
[[kernel_map]]
op = "SolidBoolean"
kernel = "cadkernel::brep::combine"
returns = "Result<Body, Snag>"
[[kernel_map]]
op = "Transform"
kernel = "cadkernel::brep::transform"
returns = "Option<Body>"
[[kernel_map]]
op = "GetBounds"
kernel = "cadkernel::brep::body_bounds"
returns = "Option<Aabb>"
[[kernel_map]]
op = "GetVolume"
kernel = "cadkernel::brep::mesh_body + divergence"
returns = "computed"