CLI Options

Complete reference for all command-line flags and options available in the crystal-render command.

Basic Usage

crystal-render [OPTIONS] <CDL_EXPRESSION> [OUTPUT_FILE]

Input Options

Option Description Default
CDL_EXPRESSION CDL expression to render (positional argument) Required
-p, --preset NAME Use a preset from mineral database instead of CDL -
-f, --file PATH Read CDL expression from file -
--list-presets List all available mineral presets -

Output Options

Option Description Default
OUTPUT_FILE Output file path (positional argument) crystal.svg
--format FORMAT Output format: svg, stl, gltf, gemcad Inferred from extension
--stdout Write output to stdout instead of file false

View Options

Option Description Default
--elevation DEGREES View elevation angle (0-90) 30
--azimuth DEGREES View azimuth angle (-180 to 180) -45
--zoom FACTOR Zoom factor (0.5-5.0) 1.0
--ortho Use orthographic projection true
--perspective Use perspective projection false

SVG Options

Option Description Default
--width PIXELS SVG width 400
--height PIXELS SVG height 400
--face-color COLOR Face fill color (hex or name) #0ea5e9
--edge-color COLOR Edge stroke color #0369a1
--edge-width PIXELS Edge stroke width 1.5
--opacity VALUE Face opacity (0.0-1.0) 0.85
--gradient Apply lighting gradient to faces true
--no-gradient Use flat shading -

Display Options

Option Description Default
--axes Show crystallographic axes false
--grid Show reference grid false
--labels Show face labels (Miller indices) false
--title TEXT Add title below crystal -

3D Export Options

Option Description Default
--scale FACTOR Scale factor for STL/glTF output 10.0
--units UNIT STL units: mm, cm, in mm
--binary Use binary STL format true
--ascii Use ASCII STL format false

Examples

Basic rendering

# Render octahedron to SVG
crystal-render "cubic[m3m]:{111}" diamond.svg

# Render preset to SVG
crystal-render --preset quartz quartz.svg

Custom styling

# Purple garnet with larger size
crystal-render "cubic[m3m]:{110}@1.0 + {211}@1.2" garnet.svg \
  --width 600 --height 600 \
  --face-color "#8b5cf6" --edge-color "#6d28d9"

# With crystallographic axes
crystal-render --preset beryl beryl.svg --axes --labels

3D export

# Export for 3D printing (20mm scale)
crystal-render --preset diamond diamond.stl --scale 20 --units mm

# Export for web visualization
crystal-render --preset zircon zircon.gltf

View angles

# Top-down view
crystal-render --preset quartz quartz-top.svg --elevation 90 --azimuth 0

# Side view
crystal-render --preset quartz quartz-side.svg --elevation 0 --azimuth 0

# Isometric view
crystal-render --preset quartz quartz-iso.svg --elevation 35 --azimuth -45

Batch processing

# Render all presets
crystal-render --list-presets | while read name; do
  crystal-render --preset "$name" "output/$name.svg"
done