Creating Custom Slicer Profiles for the G-code Skill in text-to-cad
You can create custom slicer profiles by exporting .ini or .json configuration files from PrusaSlicer, CuraEngine, or OrcaSlicer, then passing the absolute path to scripts/gcode_tool.py slice using the --profile flag to generate optimized FDM G-code.
The G-code skill in the earthtojake/text-to-cad repository transforms 3D mesh files into printer-ready FDM instructions by driving real slicer command-line interfaces. Creating custom slicer profiles allows you to define precise print parameters—such as layer height, nozzle temperature, and infill patterns—without modifying the core skill logic or default configurations.
How the G-code Skill Architecture Works
The G-code skill operates through three distinct layers implemented in scripts/gcode_tool.py and documented in skills/gcode/SKILL.md:
-
Backend Discovery — The
discoversubcommand scans your systemPATH, backend-specific environment variables, and common macOS application bundles (such as/Applications/OrcaSlicer.app/Contents/MacOS/OrcaSlicer) to locate installed slicer binaries. -
Slicing Driver — The
slicesubcommand constructs CLI arguments that forward your mesh file, output path, and custom profile to the detected backend using the appropriate flag syntax. -
Validation and Hand-off — After generation, the
validatesubcommand performs static analysis on the.gcodefile before handing it to$cad-viewerfor visual inspection of layer-colored ribbons and travel moves.
Supported Slicers and Profile Formats
According to skills/gcode/references/slicer-backends.md, the skill supports specific configuration file types for each backend:
| Slicer | Profile File Type | CLI Flag Used by Skill |
|---|---|---|
| PrusaSlicer | .ini |
--load <profile.ini> |
| OrcaSlicer | .ini |
--load <profile.ini> |
| CuraEngine | .json |
-j <profile.json> |
| Bambu Studio | Not supported | Excluded from default selection due to limited CLI functionality |
Creating Your Custom Profile
To create a custom profile compatible with the G-code skill:
- Export a base configuration from your slicer's GUI (PrusaSlicer, OrcaSlicer, or CuraEngine).
- Edit parameters such as layer height, nozzle temperature, print speed, and infill density using a text editor.
- Save the file to any accessible directory on your system.
The skill requires only the full absolute path to the profile file when invoking the slice command; no specific directory structure is enforced.
Slicing with Custom Profiles
Pass your custom profile to the slicing command using the --profile flag. The skill automatically translates this argument into the backend-specific CLI flag documented in skills/gcode/references/slicer-backends.md.
For PrusaSlicer or OrcaSlicer (.ini files):
python scripts/gcode_tool.py slice \
--backend prusa-slicer \
--profile /home/user/profiles/high-quality.ini \
--output /tmp/part.gcode \
/path/to/part.stl
For CuraEngine (.json files):
python scripts/gcode_tool.py slice \
--backend cura-engine \
--profile /home/user/profiles/draft-print.json \
--output /tmp/part.gcode \
/path/to/part.stl
Internally, these commands map to native CLI invocations:
prusa-slicer --load profile.ini --export-gcode --output output.gcode input.stlCuraEngine slice -j profile.json -l input.stl -o output.gcode
Discovering Available Backends
Before slicing with a custom profile, verify your slicer installation is properly detected:
python scripts/gcode_tool.py discover
This outputs each detected backend alongside its resolved filesystem path, confirming that the skill can locate the binary required to process your configuration.
Validating and Previewing Output
After generating G-code with your custom profile, validate the syntax and structure:
python scripts/gcode_tool.py validate --gcode /tmp/part.gcode
The validator performs static checks including syntax validation and warning detection, though it does not simulate extrusion physics or thermal behavior. Upon successful validation, the skill hands the file to $cad-viewer for visual verification of toolpaths.
Summary
- Export
.inifiles for PrusaSlicer/OrcaSlicer or.jsonfor CuraEngine from your slicer GUI to create custom slicer profiles - Store profiles anywhere accessible; the skill only requires the full file path when invoking the slice command
- Use
scripts/gcode_tool.py slice --profile <path>to apply configurations, with the skill automatically selecting the correct CLI flag (--loador-j) based on the backend - Run
scripts/gcode_tool.py discoverto verify backend detection before processing - Validate output with
scripts/gcode_tool.py validatebefore visualizing in$cad-viewer
Frequently Asked Questions
Can I use Bambu Studio with custom profiles?
No. According to the source code in skills/gcode/references/slicer-backends.md, Bambu Studio is intentionally excluded from default backend selection because its command-line interface is not recommended for automated slicing workflows. Use PrusaSlicer, OrcaSlicer, or CuraEngine instead to utilize custom slicer profiles.
Where should I store my custom profile files?
You can save custom slicer profiles in any directory on your system. The G-code skill does not enforce a specific location or require registration in a configuration file; you simply provide the absolute path using the --profile argument when calling scripts/gcode_tool.py slice.
Does the validator check for print quality or just syntax?
The validate subcommand performs static analysis including syntax checks and warning detection on the generated .gcode file. It does not simulate extrusion physics, thermal dynamics, or predict print quality outcomes such as stringing or layer adhesion.
How do I know if my slicer is properly detected?
Run python scripts/gcode_tool.py discover to list all detected backends. The output displays each slicer name alongside its resolved path (such as /Applications/OrcaSlicer.app/Contents/MacOS/OrcaSlicer on macOS), allowing you to confirm the skill can access the binary before attempting to use a custom profile.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →