The command-line converter
Convert STEP files to GLB without opening the viewer. How to run step2glb.py, and what every option does.
The converter is a Python script, step2glb.py. The app runs it for you when you drop a STEP file on the window. You can also run it yourself in a terminal, for example to convert many files, or to use options the import window does not show.
You never need this page to use the app. It is here for when you want more control.
Before you start
- Start the app once with its launcher, so the Python environment exists. See Start it the first time.
- Open a terminal in the app folder. On Windows: open the folder in File Explorer, click the address bar, type
cmdand press Enter. On macOS: open Terminal, typecdand a space, drag the app folder onto the window, and press Enter. - Switch on the app’s Python environment. This makes the command
pythonuse the add-ons the launcher installed. On Windows, type the first command below. On macOS, type the second.
.venv\Scripts\activatesource .venv/bin/activateConvert a file
python step2glb.py input.stepReplace input.step with the path of your file. The result is written next to it, with the same name and the ending .glb. The terminal prints what the converter is doing.
Examples
python step2glb.py input.step --quality 0.2 --min-size 0.5- A finer tessellation, and parts smaller than 0.5% of the model left out.
python step2glb.py input.step --relative- Quality as a fraction of the model’s size, so it does not depend on the file’s units.
python step2glb.py input.step --meshopt- Compress the result with gltfpack.
python step2glb.py input.step --simplify 0.5- Also halve the triangle count. Lossy.
python step2glb.py input.step --no-colors --no-instance- The plain reader: no colours, no instancing.
python step2glb.py input.step --out small.glb --target-tris 200000- Adjust the quality automatically until the result has at most 200,000 triangles.
python step2glb.py a.step b.step c.step- Convert several files, one after the other.
Input and output
input- One or more STEP files.
--out,-o- The file to write. Only with a single input file. Without it, the GLB is written next to the input.
--force- Convert again even if an output that is newer than the input already exists. Without it, the converter skips a file that was already converted with the same settings.
Mesh quality
--quality,-q- How closely the triangles follow the true surface (the linear deflection). Smaller is finer and heavier. The default is 0.5, in the units of the file, normally millimetres.
--relative- Reads
--qualityas a fraction of the model’s bounding-box diagonal instead of an absolute distance. --angular- The angular deflection, in radians: a second limit on how coarsely curved surfaces are cut into triangles. The default is 0.5, about 28.6°.
--min-size- Leave out parts whose size is below this percentage of the model’s diagonal. The default, 0, keeps everything.
Budgets
--target-tris- Adjust
--qualityautomatically to land at or under this triangle count. The conversion is run again up to five times. --target-size-mb- The same, for the size of the output file in megabytes. With both set, the tighter one wins.
Repeated parts
--no-instance- Do not collapse identical shapes into instances. According to the README, it only has an effect together with
--no-colors. --pca-instances- An experimental, more aggressive way to find repeated shapes. It can turn symmetric parts the wrong way.
Colours, names and the tree
--no-colors- Use the plain reader: geometry only, no colours, names or hierarchy. The fastest.
--force-colors- Always read colours, names and the hierarchy. Without this option, the converter skips them for files over 1 GB.
--no-shuo- Skip per-instance colour overrides. A big saving in time on assemblies with many repeated parts.
--no-layers- Skip CAD layer information.
--no-materials- Skip material information.
--no-step-names- Skip product names. Parts get generic names in the tree.
--no-step-props- Skip validation properties such as mass and area.
--props- Work out the volume and surface area of every solid. Slow on big files.
Compression and reduction
These options use gltfpack, a separate free tool that has to be installed and on your PATH. Without it they are skipped, with a warning.
--meshopt- Compress the GLB with Meshopt, for files roughly ten times smaller. This is on by default whenever gltfpack is found.
--no-meshopt- Switch that default off.
--quantize- Store positions, normals and texture coordinates as smaller numbers.
--simplify- Keep this fraction of the triangles, between 0 and 1. 0.5 halves the count. Sharp edges are preserved. Lossy. It switches Meshopt on.
Speed
--parallel- Use this many worker processes for building the meshes. The default, 0, does one at a time.
Without typing
The folder also holds step2glb.bat (Windows) and step2glb.command (macOS). Drag a STEP file onto one of them to convert it with the default settings, without opening the viewer.
Options of the server
The launcher starts serve.py. Started by hand, it takes these options:
--tab- Open the app in an ordinary browser tab instead of a window of its own.
--no-browser- Start the server and open nothing. Type the printed address into a browser yourself.
--open,-o- Open this file at start. Accepts STEP, GLB and glTF files. For a STEP file it asks about quality first.
--port- Use this port instead of 4242.