Skip to content

Library

Christos Georgiou edited this page Nov 25, 2026 · 1 revision

Library

CgeoCAD comes with a library of OpenSCAD modules: the CgeoCAD library. With it, a model can name its parts, give a parts list, have units that you can change, and give warnings and notes.

The library has no effect on the shape of the model. It only adds names and facts that CgeoCAD reads.

Use the library

Write this line at the top of your model:

use <cgeocad/core.scad>

CgeoCAD finds the library itself. You do not install it. When a model calls a module of the library without this line, OpenSCAD ignores the module. The Model tab then shows a card with Add the line. A click writes the line at the top of the .scad file. This is the only change that CgeoCAD makes to the code of a model.

Modules

Module What it does
cgeocad_part(name, make) Names its children as one part. make is "buy", "cut", "print" or "own"
cgeocad_sheet([x, y, z], material) A flat part, for example a panel of plywood
cgeocad_bolt(d, l), cgeocad_nut(d), cgeocad_washer(d), cgeocad_screw(d, l) Small parts to buy, with a simple shape
cgeocad_hardware(key, name, qty) A row of the parts list without a shape
cgeocad_unit(id, fields) A part that you can click and change
cgeocad_value(id, key, default) A value of a unit
cgeocad_opening(size, mount), cgeocad_opening_get(key) The room inside a frame or a cabinet, for the parts that fill it
cgeocad_warn(code, text), cgeocad_note(code, text) A warning or a note in the Checks card

An example:

use <cgeocad/core.scad>

module shelf() cgeocad_unit("shelf", [["brackets", "2:1:4", 2]]) {
  n = cgeocad_value("shelf", "brackets", 2);
  for (i = [0 : n - 1]) translate([0, i * 200, 0])
    cgeocad_part("Bracket", make = "print") cube([100, 20, 5]);
  cgeocad_sheet([600, 200, 18], "ply-18");
  cgeocad_screw(4, 30);
}
shelf();

Call cgeocad_value inside a module. A value at the top level of the file does not get the value of the unit.

The full list

An AI assistant can read all modules with their values and an example with the tool list_library. See MCP reference.

Clone this wiki locally