Repository navigation
Project file
Advanced topic. This page is for persons who write project files or tools for them.
The crate libs/scene reads and writes this format. The command line uses it: see Projects and Command line. The window does not open project files yet.
A project is a folder with a .cgeocad file. The file is YAML. It lists the objects of the project, their places and values, the scenes and the saved views. The objects are OpenSCAD models, mesh files and boxes.
# yaml-language-server: $schema=https://cad.cgeosoft.com/schema/project-1.json
cgeocad_project: 1
title: Storage room
length_unit: mm
plugins:
slotted-angle: "^0.1"
cabinet: "^0.1"
settings:
slotted-angle: { kerf: 1 }
materials:
steel: { color: "#5f636a", roughness: 0.6, metal: 0.15 }
objects:
- id: wall
name: Wall rack
type: scad
file: wall-rack.scad
material: steel
values: { length: 2400, height: 2000 }
place: { at: [0, 0, 0], turn: [0, 0, 0] }
units: { bay_1: { levels: 5 } }
- id: bench
type: scad
file: workbench.scad
set: wide
place: { at: [2600, 0, 0], turn: [0, 0, 90] }
- id: printer
type: mesh
file: models/printer.stl
place: { at: [2700, 100, 990] }
- id: crate
type: box
size: [400, 300, 200]
scenes:
- id: room
show: [wall, bench, printer, crate]
- id: bed
show: [bench]
values: { bench: { mode: bed } }
views:
- { name: Front, yaw: -1.571, pitch: 0, fit: true }| Key | Value |
|---|---|
cgeocad_project |
The version of the format: 1. This key is necessary. CgeoCAD does not read a file with a newer version. |
title |
The name of the project. |
length_unit |
The unit that the window shows for lengths: mm, cm, m or in. Default: mm. The file always holds millimeters. |
plugins |
Plugin id and version range. See Plugins and the lock file. |
settings |
Plugin settings of the project: plugin id to a mapping of settings. |
materials |
Material name to a material. See Materials. |
objects |
The list of objects. See Objects. |
scenes |
The list of scenes. See Scenes. |
views |
The list of saved cameras. See Views. |
x-... |
A key for other tools. CgeoCAD keeps it but does not read it. |
| Key | Value |
|---|---|
id |
The unique id of the object. Letters, digits, _ and -. Scenes use it. Necessary. |
name |
The name that CgeoCAD shows. Default: the id. |
type |
scad (an OpenSCAD model), mesh (an STL or 3MF file) or box. Necessary. |
file |
The .scad or mesh file. Necessary for scad and mesh. |
size |
Width, depth and height of a box in mm. Necessary for box. One corner of the box is at the origin of the object. |
material |
The name of a material of the project. |
set |
The name of a parameter set in the model definition of the model. |
values |
Parameter values. They win over the set. |
place |
The fixed place. See Places. |
units |
Unit values: unit id to a mapping of values. They win over the units of the model definition. |
settings |
Plugin settings of this object. They win over the settings of the project. |
- Paths are relative to the project file. An absolute path gives a warning, because the project then does not work on other computers.
- A new object gets its id from its name:
Wall rackgiveswall_rack. When the id is used, CgeoCAD adds_2,_3and so on. The id does not change when the name changes, so the scenes keep their objects. - Two objects with the same id are an error.
place: { at: [2600, 0, 0], turn: [0, 0, 90] }-
atis the move in mm: x, y and z. Default:[0, 0, 0]. -
turnis the turn in degrees: first about x, then about y, then about z, about the fixed axes. This is the order ofrotate([x, y, z])in OpenSCAD. Default:[0, 0, 0]. - The turn is done first, then the move.
- A place is a number. It does not follow another object. What must move together is in one
.scadfile.
| Key | Value |
|---|---|
color |
#RRGGBB or #RRGGBBAA. Use quotes: without them, # starts a comment. Default: #cccccc. |
roughness |
0 (smooth) to 1 (rough). Default: 0.5. |
metal |
0 (not metal) to 1 (metal). Default: 0. |
The view and the GLB export use the materials.
| Key | Value |
|---|---|
id |
The unique id of the scene. Necessary. |
name |
The name that CgeoCAD shows. Default: the id. |
show |
The ids of the visible objects, in order. |
values |
Values for each object: object id to a mapping of values. They win over the values of the object. |
One .scad file can show two forms of one object, for example a bench and a bed with a value mode. Two scenes show the two forms. CgeoCAD compares the parts of the two scenes and gives a warning when they are different.
| Key | Value |
|---|---|
name |
The unique name of the view. Necessary. |
yaw |
The turn about the vertical axis, in radians. Default: 0. |
pitch |
The angle above the horizontal, in radians. Default: 0. |
fit |
true: the camera fits the visible objects. Default: false. |
distance |
The distance from the camera to the target, in mm. Optional. |
target |
The point that the camera looks at, in mm. Optional. |
fov |
The vertical field of view, in degrees. Optional. |
ortho |
true: orthographic projection. Optional. |
A value of an object comes from the first of these that has it:
- The
valuesof the scene for the object. - The
valuesof the object. - The set of the object in the model definition.
- The default in the
.scadfile.
A plugin setting comes from the first of these that has it:
- The
settingsof the object. - The
settingsof the project. - The
settingsof the model definition. - The settings of the user.
- The default of the plugin.
plugins gives a version range for each plugin:
-
^0.1: 0.1.0 and newer, below 0.2.0. -
^1.2: 1.2.0 and newer, below 2.0.0. -
^0.0.3: only 0.0.3. -
0.1.0: only this version.
Use quotes. Without them, YAML reads 0.1 as a number.
CgeoCAD writes the exact versions to <name>.cgeocad.lock next to the project file, for example room.cgeocad.lock. The lock file is YAML:
# CgeoCAD writes this file. Do not change it.
cgeocad_lock: 1
plugins:
cabinet: { version: "0.1.2", sha256: "<64 hex digits>" }
slotted-angle: { version: "0.1.0", sha256: "<64 hex digits>" }-
sha256is the SHA-256 of the plugin package, in 64 lower case hex digits. - The plugins are sorted by id.
- CgeoCAD tells when a version in the lock file is not in the range of the project, or when a plugin of the project is not in the lock file.
- For a plugin that is part of CgeoCAD,
sha256is the SHA-256 of its manifest and its SCAD library files. - CgeoCAD writes the lock file when it saves a project with included plugins.
- Opening a project never installs a plugin. CgeoCAD includes the plugins of a project only when the user accepts them. In the command line, this is the option
--include-plugins. The lock file does not accept plugins.
A save writes only the blocks that changed. In plugins, settings, materials, objects, scenes and views, it writes only the entries that changed. Comments and the order of the other blocks and entries stay. A changed entry keeps the comments above it, but not the comments in it.
- These problems stop the read, with the line number where it is known: text that is not YAML, no
cgeocad_projectkey, a newer version, an object or a scene without a correctid, two objects or two scenes with the same id, an object without a correcttype,fileorsize. - These problems give a warning: an unknown
length_unit, a wrong version range, a wrong material value, a material that does not exist, an absolute path, a wrongplace, an object id in a scene that does not exist. CgeoCAD skips or changes the bad item. - An unknown key gives a note. CgeoCAD keeps it in the file. Keys that start with
x-give no note.
Export > Package writes the project folder as one zip:
- The project file and its lock file.
- The files of the objects, at their paths relative to the project file. For a
scadobject, also its.ymland.jsonfiles, if they exist. - Files outside the project folder in
external/, with a warning. - The SCAD libraries that the models use in
libraries/, at their include paths, for examplelibraries/BOSL2/std.scad.
The GLB export writes the visible objects of a scene as a binary glTF 2.0 file, in meters with y up. Each different shape is in the file one time. Each copy is a node.
The JSON Schema of the format is at https://cad.cgeosoft.com/schema/project-1.json. The first line of the example tells the YAML extension of VS Code and other editors to use it.
Home · Glossary · Problems and answers · Download · Website
The source of these pages is the docs/wiki/ folder of the repository. Changes that you make on the wiki website are lost at the next update.
Start
Look at the model
Furniture
Projects
More
Advanced