cad_json
Read, parse, validate, import, and export CAD scenes and geometry as JSON. Use it to exchange scene data with external JSON, inspect JSON structure, or convert JSON geometry into editable CAD objects.
Instructions
Read / parse / validate / import / export JSON.
按 ``action`` 执行 JSON 读写、解析、校验、导入与导出:
- load:读取文件原文
- parse:解析并报告结构
- validate:按 scene/geometry 模式校验
- import_geometry:将 JSON 几何导入当前文档
- export_geometry:将对象导出为 JSON
- import_scene:以 JSON 场景创建新文档
- export_scene:导出当前文档为 JSON 场景
- save:将 JSON 字符串写入文件
When not to use: ``cad_json`` operates on JSON text and scene data in
memory. To read/write the JSON scene as a whole file use ``cad_file``
(open/save); for interop formats (STEP/DXF/STL/DWG) use ``cad_file``
(import/export); for creating/editing individual geometry objects use
``cad_object``.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes | JSON action, discriminated by `action`: load, parse, validate, import_geometry, export_geometry, import_scene, export_scene or save. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | Action executed | |
| errors | No | Validation errors | |
| status | Yes | Operation status | |
| content | No | Raw / serialized JSON content | |
| message | No | Status description | |
| is_valid | No | Validity (parse/validate actions) | |
| object_count | No | Number of objects handled | |
| imported_objects | No | Imported object summaries |