Draftsperson Agent Skill (CAD API)
You are an agent that creates and manages SkyCiv CloudCAD drawings via the SkyCiv API. This skill covers the full CAD JSON schema and the cloudcad.model and cloudcad.file API namespaces.
Prerequisite: Always begin a session with
S3D.session.startas the first function. See theskyciv-coreskill for auth, options, and the request/response envelope.
CAD Data Format Overview#
A CAD model is a JSON object with this top-level structure:
This object is passed to cloudcad.model.create as cad_data.
settings#
Controls display, units, snapping, and colors. All fields optional โ defaults applied for any omitted values.
| Key | Type | Description |
|---|---|---|
canvasLengthUnits | string | "mm", "cm", "m", "ft", "in" |
gridSize | string | Grid spacing value |
snapToGrid | bool | Snap to grid |
snapToPoint | bool | Snap to existing points |
snapToLineEnds | bool | Snap to line endpoints |
snapToLineMid | bool | Snap to line midpoints |
snapToAlign | bool | Alignment guide snapping |
snapToAxis | bool | Axis snapping |
showGrid | bool | Show background grid |
showAxis | bool | Show axis lines |
showVertices | bool | Show vertex markers |
showCreatedDimensions | bool | Show user-created dimensions |
showSelectionDimensions | bool | Show dimensions on selection |
canvasBackgroundColor | string | Hex background color |
lineColor | string | Default line color |
pointColor | string | Default point color |
dimensionsColor | string | Dimension label color |
selectionColor | string | Selected item color |
highlightColor | string | Hover/highlight color |
dimensionTextSize | string | Font size for dimension labels |
globalDimsScale | string | Global dimension display scale |
globalTextScale | string | Global text display scale |
arcSegments | string | Segment count for arc rendering |
circleSegments | string | Segment count for circle rendering |
s3d (Structural 3D Mapping)#
Optional. Use when the CAD drawing maps to a structural model.
canvases#
An array of canvas (drawing sheet) objects. Each canvas is a self-contained drawing.
drawing_type: "Plan", "Elevation", etc.
All array fields must be present (use [] if empty).
Canvas Element Types#
Points#
id is optional โ auto-generated if omitted.
Lines#
A straight segment between two points.
To form a closed polygon, give multiple lines the same
groupIdand ensure their endpoints connect.
Polylines#
Circle#
Arc#
Defined by start, end, and a control point on the arc.
Dimensions (Linear)#
projectionType: "vertical", "horizontal", or omit for auto.
Leader Texts#
An arrow pointing from a location to a text label.
Multi-Leader Texts#
Text annotation with multiple arrow leaders.
Texts#
alignment: "left", "center", "right".
backgroundColorOpacity: 0 = transparent, 1 = opaque.
Tables#
Axes (Gridlines)#
A labeled reference axis/gridline between two points.
Construction Lines#
Infinite reference lines defined by a point and angle.
angle is in degrees.
Revision Clouds#
Rectangular#
Circular#
Provide the bounding box and
arcRadius; the renderer computes thearcsarray automatically. Passarcs: []when creating programmatically.
Hatches#
A filled region defined by one or more closed loops. Each loop is an array of segments.
Segment types: "line" or "arc". Loops must be closed (last segment endpoint = first segment start point).
Blocks#
Reusable drawing element groups.
Block References (Definitions)#
Supported item types inside blocks: point, line, arc, dimension, multiLeaderText, hatch.
Block Instances#
Place a block on the canvas.
Layers#
Assign elements to layers for color, visibility, and line-type control.
lineType: "solid", "dashed", etc.
cloudcad.model Functions#
cloudcad.model.create#
Creates a new CAD model from a cad_data object. Must be called before cloudcad.file.save.
Response:
cloudcad.file Functions#
cloudcad.file.save#
Save the current CAD model to cloud storage. Requires cloudcad.model.create earlier in the session.
| Key | Type | Description |
|---|---|---|
name | string | File name |
path | string | Cloud storage path |
public_share | boolean | Also return a public view-only link |
return_uid_url | boolean | Return a UID-based URL (?u=) instead of name/path URL |
Response:
cloudcad.file.open#
Load a CAD model from cloud storage.
| Key | Type | Description |
|---|---|---|
name | string | File name |
path | string | Cloud storage path |
uid | string | File UID (alternative to name/path) |
Response:
Full Example โ Create and Save a CAD Drawing#
Coordinate System#
- All coordinates are 2D:
x(horizontal) andy(vertical) on the canvas. - Units are controlled by
settings.canvasLengthUnits. - There is no Z axis on a single canvas; elevation is represented by using multiple canvases at different elevations (configured in
s3d.elevations). - Coordinates can be any number including negative โ the canvas has no fixed origin boundary.
Key Patterns#
Closed polygon from lines: Share the same groupId across connected line segments.
Reusable details: Define in block_references once, place many times via block_instances with different position, rotation, and scale.
Organised drawings: Assign elements to layers by referencing their type and id. Enable displayColorByLayers in settings to inherit layer colors.
Opening a previously saved drawing for editing: Use cloudcad.file.open to load it into the session, modify via API, then cloudcad.file.save with the same name/path to overwrite.