# Creating Custom Slicer Profiles for the G-code Skill in text-to-cad

> Learn to create custom slicer profiles for text to cad G-code skill. Export configs from PrusaSlicer Cura or OrcaSlicer and use the --profile flag for optimized G-code generation.

- Repository: [earthtojake/text-to-cad](https://github.com/earthtojake/text-to-cad)
- Tags: how-to-guide
- Published: 2026-08-01

---

**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`](https://github.com/earthtojake/text-to-cad/blob/main/scripts/gcode_tool.py) and documented in [`skills/gcode/SKILL.md`](https://github.com/earthtojake/text-to-cad/blob/main/skills/gcode/SKILL.md):

1. **Backend Discovery** — The `discover` subcommand scans your system `PATH`, backend-specific environment variables, and common macOS application bundles (such as `/Applications/OrcaSlicer.app/Contents/MacOS/OrcaSlicer`) to locate installed slicer binaries.

2. **Slicing Driver** — The `slice` subcommand constructs CLI arguments that forward your mesh file, output path, and custom profile to the detected backend using the appropriate flag syntax.

3. **Validation and Hand-off** — After generation, the `validate` subcommand performs static analysis on the `.gcode` file before handing it to `$cad-viewer` for visual inspection of layer-colored ribbons and travel moves.

## Supported Slicers and Profile Formats

According to [`skills/gcode/references/slicer-backends.md`](https://github.com/earthtojake/text-to-cad/blob/main/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:

1. Export a base configuration from your slicer's GUI (PrusaSlicer, OrcaSlicer, or CuraEngine).
2. Edit parameters such as layer height, nozzle temperature, print speed, and infill density using a text editor.
3. 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`](https://github.com/earthtojake/text-to-cad/blob/main/skills/gcode/references/slicer-backends.md).

For PrusaSlicer or OrcaSlicer (`.ini` files):

```bash
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):

```bash
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.stl`
- `CuraEngine 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:

```bash
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:

```bash
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 `.ini` files for PrusaSlicer/OrcaSlicer or `.json` for 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 (`--load` or `-j`) based on the backend
- Run `scripts/gcode_tool.py discover` to verify backend detection before processing
- Validate output with `scripts/gcode_tool.py validate` before 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`](https://github.com/earthtojake/text-to-cad/blob/main/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.