cloudcad-api
Skill11 starsChanged 32 days agoMITView on GitHub
Use when generating or saving a 2D engineering drawing through the SkyCiv CloudCAD API — building the cad_data JSON for cloudcad.model.create and saving it with cloudcad.file.save. Covers canvases, lines, polylines (circles/arcs), linear/angle/radius dimensions, leader and multi-leader text, text, tables, axes/gridlines, construction lines, revision clouds, hatches, images, layers, blocks (blockReferences/block_instances), attributeStyles sizing, pdfExport pages and the default A2 page + title block, units (canvasLengthUnits) and the y-negative-up coordinate system. Trigger even without the word SkyCiv or CAD, e.g. 'draft a plan/elevation/section of this', 'produce a drawing sheet with a title block', 'dimension this truss', 'turn this S3D model into a drawing', 'add a revision cloud', 'export a drawing from my app'. Not for 3D structural models or analysis (use s3d-api), not for 3D visualisation (use renderer), and not for reading a floor-plan image (use schema-agent).
In this repository17 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- analysis-resultsSkill
- baseplateSkill
- build-quick-design-calculatorSkill
- foundation-apiSkill
- load-combinationsSkill
- load-gen-apiSkill
- qa-engineerSkill
- rendererSkill
- run-quick-designSkill
- s3d-apiSkill
- s3d-appsSkill
- schema-agentSkill
- section-selectorSkill
- skill-writerSkill
- skyciv-api-v3Skill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 18
Units: every coordinate and every length setting is real-world millimetres, whatever settings.canvasLengthUnits says.
- Very specific: line 27
Pick a plot scale and size the
attributeStylesfor it: Every length-valued style setting is *printed mm × scale*, e.g. - Distinctive: line 124
No origin boundary; negative coordinates are fine.
- Distinctive: line 147
When a generator switches plot scale, it rescales the style (and any page furniture) by the same factor and leaves the geometry at true …
- Distinctive: line 166
All of these were verified against the live API on 2026-09-22.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CloudCAD API — 2D drawings
Build a CloudCAD drawing as a JSON object (cad_data), send it with cloudcad.model.create, then
store it with cloudcad.file.save. This skill covers the cad_data schema and the
cloudcad.model / cloudcad.file namespaces.
Prerequisite: auth,
optionsand the{ auth, options, functions }envelope are inskyciv-api-v3. NoS3D.session.startis needed.cloudcad.model.createopens its own CloudCAD session (verified: without it, create returns "CloudCAD session successfully created." and a followingsaveworks). AddingS3D.session.startfirst does no harm but adds about 6 s.
Units: every coordinate and every length setting is real-world millimetres, whatever
settings.canvasLengthUnits says. That setting ("mm", "cm", "m", "ft", "in") only
changes how dimension labels are displayed. Verified: a 7315.2 mm line with
canvasLengthUnits: "ft" is labelled 24.0 ft.
Workflow
- Draw at true size, in mm, with y negative going up (see Coordinates). Never scale geometry to fit a page.
- Pick a plot scale and size the
attributeStylesfor it. Every length-valued style setting is printed mm × scale, e.g.dimensionTextSize: 378at 1:100 prints at 3.78 mm (see Sizing). - Wrap the drawing in the default page + title block, unless the user asked for bare
geometry. Translate the content into the template's safe zone; do not scale it. See
references/pages-and-title-blocks.md. - Lint, then send
cloudcad.model.create+cloudcad.file.savein one request.createaccepts anything and returnsstatus: 0, even{}or{"canvases": "nope"}, so astatus: 0proves nothing. Run the linter (Bundled tools) and look at a render (Verifying). - Give the user the
dataURL returned bysave.
In Node, scripts/cad_helpers.js does steps 2–4: emptyCanvas, text, hatch,
rectCloud/revisionCloud, attributeStyle(plotScale),
wrapInTitleBlock({ canvas, plotScale }) and lint(cad_data). Opt-in structural data uses
s3dMember, s3dSupport, s3dColumn, s3dPlate and s3dRoot.
cad_data structure
{
"settings": { "canvasLengthUnits": "mm" },
"attributeStyles": [ { "id": "as-default", "name": "Default", "settings": { } } ],
"blockReferences": [ ],
"pdfExport": { "pdfPages": [ ] },
"s3d": { },
"canvases": [ { "name": "Plan", "lines": [ ], "dimensions": [ ], "texts": [ ] } ]
}| Key | Required | What it is |
canvases | yes | Array of drawing sheets. Each canvas holds the element arrays: points, lines, polylines, dimensions, angleDimensions, radiusDimensions, leaderTexts, multiLeaderTexts, texts, tables, axes, constructionLines, revisionClouds, hatches, images, block_instances, layers. |
attributeStyles | effectively yes | Named sizing styles for annotations; elements point to one with attributeStyleId. |
settings | no | Display/snap/colour settings, plus canvasLengthUnits. Every field is optional. |
blockReferences | no | Block definitions: top-level and camelCase. Canvases only place them, via block_instances. |
pdfExport | no | Printed page frames. |
s3d | no | Opt-in. Settings for turning the drawing into an S3D model. The structural data itself goes on each element (lines[].s3d, points[].s3d, hatches[].s3d). See references/s3d-mapping.md. |
Verified minimum: {"canvases":[{"lines":[...]}]} renders. Missing element arrays,
version/schema/drawing_type/is_base are all optional. Real platform exports omit
drawing_type and is_base. Including every array as [] is still the safe default
(emptyCanvas() does this), because the editor expects them.
Field-by-field schema for every element type (settings keys, style keys, lines, polylines,
the three dimension types, leaders, text, tables, axes, construction lines, revision clouds,
hatches, images, layers, blocks): read
references/elements.md before writing an element type you haven't
written in this session.
Minimal working example
Verified live: this renders a 6 m × 4 m rectangle with a dimension and a label, then saves it.
{
"auth": { "username": "user@example.com", "key": "YOUR_KEY" },
"functions": [
{ "function": "cloudcad.model.create", "arguments": { "cad_data": {
"settings": { "canvasLengthUnits": "mm" },
"attributeStyles": [ { "id": "as-default", "name": "Default", "settings": {
"dimensionTextSize": 378, "linearArrowShape": "arrow", "linearArrowLength": 216, "linearArrowWidth": 216,
"leaderTextSize": 378, "leaderArrowLength": 216, "leaderArrowWidth": 216,
"axisTextSize": 324, "axisCircleDiameter": 1080, "axisDashLength": 216, "axisDashGap": 108,
"textSizeInput": 14, "textSizeOverride": false, "fontFamily": "monospace", "tableFontSize": 400 } } ],
"canvases": [ {
"name": "Ground Floor",
"lines": [
{ "p1": { "x": 0, "y": 0 }, "p2": { "x": 6000, "y": 0 } },
{ "p1": { "x": 6000, "y": 0 }, "p2": { "x": 6000, "y": -4000 } },
{ "p1": { "x": 6000, "y": -4000 }, "p2": { "x": 0, "y": -4000 } },
{ "p1": { "x": 0, "y": -4000 }, "p2": { "x": 0, "y": 0 } }
],
"dimensions": [ { "p1": { "x": 0, "y": 0 }, "p2": { "x": 6000, "y": 0 },
"offsetPoint": { "x": 3000, "y": 800 }, "projectionType": "horizontal", "attributeStyleId": "as-default" } ],
"texts": [ { "position": { "x": 3000, "y": -2000 }, "text": "GROUND FLOOR", "size": 20,
"color": "#ffffff", "alignment": "center", "textPosition": "middle-center", "attributeStyleId": "as-default" } ]
} ]
} } },
{ "function": "cloudcad.file.save", "arguments": { "name": "ground-floor", "path": "projects/cad/" } }
]
}Functions
| Function | Arguments | Returns (verified) |
cloudcad.model.create | cad_data (object) | {status: 0, msg: "CloudCAD session successfully created.", data: ""}, plus a new session_id. The docs' msg text is out of date. |
cloudcad.file.save | name, path (strings); public_share, return_uid_url (booleans) | data is always https://platform.skyciv.com/cad?u=<uid>. No public_link is returned, whatever public_share / return_uid_url are set to. |
cloudcad.file.open | name + path, or uid | {status: 0, msg: "", data: ""}, even for a file that doesn't exist, and nothing appears in the session. Don't build on it (see Gotchas). |
There is no cloudcad.model.get/set/export function: the API can't read a drawing's JSON back
or export a PDF/DXF. Calling one returns "The function '...' could not be found".
Coordinates
- 2D only.
yis negative going up the screen/sheet. To draw something upward, subtract from y. Mapping an S3D model (y up) needsy_cad = -y_model. - No origin boundary; negative coordinates are fine.
- Rotation units differ by element, and every one of these was verified by render:
| Field | Unit | Positive direction on screen |
texts[].rotation, images[].rotation | degrees | clockwise |
block_instances[].rotation | radians (90 renders at 90 rad ≈ 116.6°) | clockwise |
constructionLines[].angle | degrees | counter-clockwise (30 rises to the right) |
Sizing: one rule
Pick the plot scale S (100 for 1:100). Every length-valued style setting is
printed mm × S:
| Style setting | Printed size | At 1:100 | At 1:50 |
dimensionTextSize, angle/radiusDimensionTextSize, leaderTextSize | 3.78 mm | 378 | 189 |
linearArrowLength / Width (and angle/radius/leader) | 2.16 mm | 216 | 108 |
axisCircleDiameter / axisTextSize | 10.8 / 3.24 mm | 1080 / 324 | 540 / 162 |
axisDashLength / axisDashGap | 2.16 / 1.08 mm | 216 / 108 | 108 / 54 |
tableFontSize | 4 mm | 400 | 200 |
attributeStyle(S) in the helper builds this. Don't scale textSizeInput, which is not a length.
When a generator switches plot scale, it rescales the style (and any page furniture) by the
same factor and leaves the geometry at true size.
Plain texts do not use the style for size. size is a unitless factor that renders at
roughly 16 mm of character width per unit (monospace), verified across zoom levels: a
17-character string at size: 14 was about 3.9 m wide. So size: 14 suits a building-scale plan
at 1:100. For a 1:10 detail, divide it by about 10.
Verifying a drawing (you can't open the viewer)
Undocumented, but useful: when any call in a request fails, the response's top-level
response.screenshot holds an 800×600 base64 PNG of the headless CloudCAD editor, showing the
model built so far. To see your drawing, append a deliberately unknown call after create, such as
{"function": "cloudcad.model.get", "arguments": {}}, then decode response.screenshot. It costs
one credit and the view is not always zoomed to your content. This is a debugging aid for
checking a new generator's output, not something to leave in production code.
Gotchas
All of these were verified against the live API on 2026-09-22.
createnever validates. Empty, garbage or brokencad_datareturnsstatus: 0, andvalidate_inputhas no effect on it. Lint the payload and check a render.- Never scale geometry to fit a page. Dimensions measure the real distance between their
points, so scaling corrupts every label: a 24 ft span once read
40000mm. Translate only. If the drawing doesn't fit, change the plot scale or sheet. - Never pre-convert coordinates for
canvasLengthUnits. Dividing coordinates by 304.8 and setting"ft"converts twice (24 ft became0.08 ft). - Hatch segments need
start/end. Segments with onlyp1/p2makecreatehang until it times out (about 43 s, reproduced twice). Real exports carry both field pairs. - Revision clouds need a precomputed
arcsarray. Witharcs: [], or noarcs, the cloud is accepted but draws nothing. The platform doesn't generate the scallops. Build them withrectCloud()/revisionCloud(). - Linear dimensions: omit
projectionTypeto get an aligned, true-length dimension (a 3-4-5 diagonal reads5000.0 mm)."horizontal"/"vertical"give that projection (the same diagonal reads 3000 / 4000). Any other value, including"aligned", is treated as a projection rather than aligned. - Text needs a light
color. The canvas is dark, and a text with nocolorrenders near-black and invisible. Use#ffffff/#e2e8f0/#94a3b8. PDF output colours are unverified. textPositionon every text. Rendering works without it, but the editor is reported to crash when the user selects such a text.alignmentanchors the text atpositionas you'd expect (centercentres it on x,rightends it at x), so don't also pre-shiftposition.- Missing or unknown
attributeStyleIdfails silently. The element falls back to the built-in style (grey labels, default sizes). - Images don't render inside a block definition. Tables, axes, text, linear and radius
dimensions do. Put
logos on the canvas
imagesarray. An image'sx/yis its top-left corner and it extends toward +y (down the screen). cloudcad.file.opengives no signal. It returnsstatus: 0for files that don't exist and loads nothing observable, so "open → edit → save" doesn't work. To change a drawing, regenerate the fullcad_data, thencreate+saveit with the samename/path.- Structural (
s3d) data is opt-in, and it lives on the elements. Leave it out unless the user explicitly asks for the drawing to carry S3D data. When they do, the roots3dblock alone does nothing: a line only becomes a member if it carriess3d: { member: {...} }. The same goes for supports onpointsand plates onhatches.wrapInTitleBlockdrops the root block unless you passs3d. Per-elements3dsurvivescreate+save(verified 2026-09-25). Shapes and helpers are inreferences/s3d-mapping.md. - Don't paste the asset JSON into a prompt.
assets/title-block-a2.jsonis about 50 KB and the two example exports are about 125 KB each. Load them in code (fs.readFileSync) and copy the pieces.
Bundled tools and assets
| File | Load / run when |
references/elements.md | Writing any element type: field tables, verified behaviour, settings and style keys. |
references/pages-and-title-blocks.md | Adding a page frame or title block, placing blocks, or computing where content goes on the sheet. |
references/s3d-mapping.md | Drawing from an S3D model, launching CAD from inside the SkyCiv platform, or, only when asked, attaching structural s3d data (members, supports, plates). |
scripts/cad_helpers.js | Building cad_data in Node. Also node scripts/cad_helpers.js lint <file.json> to lint any payload (a bare cad_data or a full request) before sending it. |
assets/title-block-a2.json | The default A2 1:100 page + title block, with measured zones. Load it in code. |
assets/all-elements.json | A real platform export containing one of almost every element. Grep it for a field's real shape; don't read it whole. |
assets/Title-Block-Example.json | The original export title-block-a2.json was derived from. Kept because the prototypes load it by path. |
assets/images/dimension-linear.svg, assets/images/dimension-angle.svg, assets/images/axis-dashdot.svg, assets/images/revision-clouds.svg, assets/images/block-transform.svg | Anatomy diagrams embedded in the reference files. |
Related skills
skyciv-api-v3: auth, envelope,options.s3d-api: thes3d_modelwhose nodes/members you'd draw.s3d-apps: in-app code, whereSKYCIV_UTILS.exportToCad(cad_data)opens a drawing directly.schema-agent: reading a floor plan before drawing it.renderer: 3D visualisation (not 2D drawings).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

