# pcb-rnd - user manual

## 7.2 Export plugins

### 7.2.1 export_openscad

The openscad exporter generates the 3D model of the board in form of an openscad script.

The main entry point of the script is pcb_board(). All coordinates are in mm. The in x and y directions the 0;0 point of the board is the 0;0 point on screen in pcb-rnd, to make it easy to wrap the board in a translate() after measuring the coords of a point in pcb-rnd. The vertical origin is the middle of the board's FR4.

Supported features:

- arbitrary shaped outline
- top/bottom copper (optional)
- top/bottom mask (optional)
- top/bottom silk (optional)
- holes (optional)
- subcircuit (3d) models (optional)

Subcircuit models are loaded from external files referenced from the subcircuit in the pcb-rnd board file. Model files are searched recursively under the footprint library search path.

The subcircuit (footprint instance) can have the following openscad related attributes, all optional:

attrib | meaning
--- | ---
openscad=filename | file name of the .scad script (3d subcircuit model)
openscad-transformation=script | apply the specified transformation on the model instance
openscad-param=p1,p2,p3... | parameters to pass on to the model

If the openscad attribute is not present, no 3d model is inserted.

If openscad-transformation is specified, it is inserted before the model call; it typically contains a transform() and/or a rotate() to modify the placement of the model. The 0;0;0 point of the placement is the origin of the subcircuit in pcb-rnd, on the surface of the board. (Note: it is used to match the model to the footprint; subcircuit rotation and translation are automatically inserted by pcb-rnd on top of this. This attribute is empty or not present when the model lines up with the neutral state of the footprint.)

If openscad-param is specified, the module is called with this parameter list, else the model is called with empty parameter list.

A model file shall contain a single module, with "module" and the arbitrary module name in the same line, { in the following line. One instance of each model is copied into the output file so that the resulting openscad script has no external reference and is self-contained.