Command Line Interface
Generate crystal visualizations directly from your terminal using the
gemmology CLI tool.
Installation
pip install gemmology-plugin This installs the gemmology command along with all required packages.
Basic Usage
# Generate from CDL
gemmology --cdl "cubic[m3m]:{111}" -o octahedron.svg
# Use a preset
gemmology --preset diamond -o diamond.svg
# Generate twin
gemmology --twin japan -o japan_twin.svg Options
Input Options
| Option | Description |
|---|---|
--cdl <expr> | CDL expression to render |
--preset <name> | Use a mineral preset from the database |
--twin <law> | Generate a twin using specified twin law |
--habit <name> | Use a named crystal habit |
Output Options
| Option | Description |
|---|---|
-o, --output <file> | Output file path |
--format <fmt> | Output format: svg, stl, gltf, gemcad |
--size <px> | SVG size in pixels (default: 400) |
View Options
| Option | Description |
|---|---|
--elev <deg> | Elevation angle in degrees (default: 30) |
--azim <deg> | Azimuth angle in degrees (default: -45) |
--no-grid | Disable grid background |
--no-axes | Disable crystallographic axes |
Info Panel Options
| Option | Description |
|---|---|
--info-fga | Add FGA-style info panel with properties |
--info-basic | Add basic info panel (name, system, CDL) |
Examples
Generate Diamond Preset
gemmology --preset diamond -o diamond.svg Custom CDL with View Angles
gemmology --cdl "cubic[m3m]:{111}@1.0 + {100}@1.3" \
--elev 45 --azim -30 -o truncated.svg Export to STL for 3D Printing
gemmology --preset quartz --format stl -o quartz.stl Generate with FGA Info Panel
gemmology --preset ruby --info-fga --no-grid -o ruby.svg Generate Japan Law Twin
gemmology --twin japan --elev 20 --azim -60 -o japan_twin.svg Available Presets
List all available presets:
gemmology --list-presets Get details about a specific preset:
gemmology --preset-info diamond Available Twin Laws
List all available twin laws:
gemmology --list-twins spinel_lawjapanbrazildauphinecarlsbadmanebachbavenoalbitepericlineiron_crossstaurolite_60staurolite_90fluoritegypsum_swallowchrysoberylrutile_geniculated Programmatic Usage
The CLI is a thin wrapper around the Python packages. For programmatic use:
from cdl_parser import parse_cdl
from crystal_geometry import cdl_to_geometry
from crystal_renderer import generate_svg
from mineral_database import get_preset
# From CDL
desc = parse_cdl("cubic[m3m]:{111}")
geom = cdl_to_geometry(desc)
svg = generate_svg(geom, elevation=30, azimuth=-45)
# From preset
preset = get_preset("diamond")
desc = parse_cdl(preset.cdl)
geom = cdl_to_geometry(desc)
svg = generate_svg(geom) Need help?
gemmology --help