> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.simplyprint.io/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# Advanced smart tagging: file metadata, filename rules & automation

# Advanced smart tagging: file metadata, filename rules & automation

SimplyPrint can automatically read metadata you embed in your GCode or 3MF files and use it to apply tags, set nozzle data, material info, bed type, and even fill in custom fields - all on upload. This is especially powerful for automated workflows where files are sliced and uploaded without manual interaction.

## Who is this for?

This feature is built for power users and automated setups that need more control than what regular auto-tagging offers. Some examples:

- **Automated slicing workflows** - if you use SimplyPrint's auto-slicing, slicer post-processing scripts, or CI/CD pipelines that upload files via the API, you can bake metadata directly into the files so everything is tagged correctly without anyone touching it
- **Print farms** that want files auto-tagged with client names, order numbers, or project IDs pulled from the filename or embedded in the file itself
- **Teams with naming conventions** - if your files always follow a pattern like `client-AcmeCorp-bracket-v2.gcode`, you can have SimplyPrint automatically extract the client name and fill it into a custom field
- **Organizations with custom tags** - regular auto-tagging handles nozzle size and material, but it can't apply your own custom tags like "Urgent", "QA Required", or "Client-A". Smart tagging can
- **Custom build plates** - this is the only way to automatically assign a specific bed type or custom build plate to a file on upload

The embedded metadata approach is especially well suited for automation. When files are sliced and uploaded automatically, there's no manual step to set tags or fill in fields. By embedding `; sp:` lines in your slicer's start GCode or injecting a metadata JSON into 3MF files, every file arrives in SimplyPrint fully tagged and ready to go.

## How is this different from regular auto-tagging?

Regular [auto-tagging](/en/article/auto-tagging-auto-printer-model-selection-e84r3k/) runs automatically on every file upload and sets **nozzle size** and **material** tags based on what the slicer puts in the GCode. It's fully automatic and works great for those two things.

Advanced smart tagging goes further. It lets you:

- Apply **custom tags** (ones you've created yourself)
- Set the **bed type / build plate**
- Fill in **custom field values** (like order numbers, client names, departments)
- Use **regex-based filename rules** to match patterns in filenames and extract data
- Embed metadata **directly in your GCode or 3MF files** for full control

Smart tagging runs *after* regular auto-tagging and can override or add to its results. If you're happy with just nozzle and material tags, you don't need this. But if you want more - custom tags, custom fields, bed types, or filename-based automation - this is where you set it up.

## What you can set

With embedded metadata, you can control the following properties per file:

| Property | Description | Example |
| -------- | ----------- | ------- |
| Custom tags | Tag names (comma-separated) | `Urgent, Client-A` |
| Bed type | Bed plate name | `Textured PEI Plate` |
| Nozzle size | Per extruder, in mm | `0.6` |
| Nozzle type | Per extruder | `hardened_steel` |
| Nozzle volume type | Per extruder | `standard`, `high_flow` |
| Material type | Per extruder | `PLA`, `PETG`, `ABS` |
| Material color | Per extruder (name or hex) | `Red`, `#FF0000` |
| Material width | Per extruder, in mm | `1.75` |
| Custom fields | By field ID | Any value matching field type |

## How it works

SimplyPrint metadata is processed automatically on file upload. It layers on top of the standard GCode analysis auto-tagging in this order:

1. **GCode analysis** - nozzle, bed, and material data detected from slicer output (existing behavior)
2. **SimplyPrint metadata** - values from `; sp:` comments or 3MF metadata files (overrides step 1)
3. **Filename rules** - regex-based rules you configure in settings (overrides steps 1-2)
4. **Manual tags** - anything you set by hand at upload time (final override)

Each step can override or add to the previous one. Custom tags are always additive - they stack up from all sources.

## GCode format

Add comment lines starting with `; sp:` to the top of your GCode file (within the first 150 lines). Each line follows this format:

`; sp:key = value`

Here's a full example with all supported keys:

`; sp:version = 1`
`; sp:tags = BedTextured, Urgent, Client-A`
`; sp:bed_type = Textured PEI Plate`
`; sp:nozzle.0.size = 0.6`
`; sp:nozzle.0.type = hardened_steel`
`; sp:nozzle.0.volume_type = high_flow`
`; sp:material.0.type = PLA`
`; sp:material.0.color = Red`
`; sp:material.0.hex = #FF0000`
`; sp:material.0.width = 1.75`
`; sp:field.order_number = ORD-12345`
`; sp:field.department = Engineering`

### Key reference

| Key | Type | Notes |
| --- | ---- | ----- |
| `version` | Number | Always `1` (for future compatibility) |
| `tags` | Comma-separated | Tag names, resolved per your organization |
| `bed_type` | String | Must match a known bed type name |
| `nozzle.N.size` | Number | Nozzle diameter in mm. N = extruder index (0-based) |
| `nozzle.N.type` | String | e.g. `brass`, `hardened_steel`, `stainless_steel` |
| `nozzle.N.volume_type` | String | e.g. `standard`, `high_flow` |
| `material.N.type` | String | Material profile name like `PLA`, `PETG`, `ABS` |
| `material.N.color` | String | Color name (e.g. `Red`) |
| `material.N.hex` | String | Hex color code (e.g. `#FF0000`) |
| `material.N.width` | Number | Filament diameter in mm |
| `field.FIELD_ID` | Any | Custom field value, where FIELD_ID is the field's identifier |

### Multi-extruder support

Use the extruder index (0-based) in the dot notation to set values per extruder:

`; sp:nozzle.0.size = 0.4`
`; sp:nozzle.1.size = 0.6`
`; sp:material.0.type = PLA`
`; sp:material.1.type = PETG`

### Adding to your slicer start GCode

You can add `; sp:` lines to your slicer's start GCode or custom header section. This is the recommended approach for automated slicing workflows - once set up, every file sliced with that profile will include the metadata automatically.

**PrusaSlicer / OrcaSlicer / BambuStudio:**
Go to Printer Settings > Custom G-code > Start G-code and add your `; sp:` lines at the very top, before any other commands.

**Cura:**
Go to Settings > Printer > Machine Settings > Start G-code and add your `; sp:` lines at the top.

| Keep `; sp:` lines within the first 150 lines of the file. Lines after that won't be scanned.

## 3MF format

For 3MF files, there are two ways to include SimplyPrint metadata. JSON is the primary method and takes priority if both are present.

### JSON method (recommended)

Add a file called `simplyprint-metadata.json` to the root of your 3MF ZIP archive:

The JSON structure looks like this:

| Since the helpdesk doesn't support code blocks, see the reference below as a structured list.

**JSON fields:**
- `version` - Always `1`
- `tags` - Array of tag name strings
- `bed_type` - Bed type name string
- `nozzle` - Array of objects with `i` (index), `size`, `type`, `volume_type`
- `material` - Array of objects with `ext` (extruder index), `type`, `color`, `hex`, `width`
- `fields` - Object mapping field IDs to values

**Example nozzle entry:** `{"i": 0, "size": 0.6, "type": "hardened_steel", "volume_type": "high_flow"}`

**Example material entry:** `{"ext": 0, "type": "PLA", "color": "Red", "hex": "#FF0000", "width": 1.75}`

### XML method (fallback)

If you can't easily add a JSON file to the ZIP, you can add metadata nodes to the `3D/3dmodel.model` XML file inside the 3MF. Add nodes like these inside the `<model>` element:

`<metadata name="SimplyPrint:Version">1</metadata>`
`<metadata name="SimplyPrint:Tags">BedTextured, Urgent</metadata>`
`<metadata name="SimplyPrint:BedType">Textured PEI Plate</metadata>`
`<metadata name="SimplyPrint:Nozzle.0.Size">0.6</metadata>`
`<metadata name="SimplyPrint:Material.0.Type">PLA</metadata>`
`<metadata name="SimplyPrint:Field.order_number">ORD-12345</metadata>`

The naming convention uses PascalCase after the `SimplyPrint:` prefix. Dot notation works the same way as in GCode.

|| If both JSON and XML metadata are present in a 3MF file, the JSON version takes priority.

### Injecting metadata into a 3MF file via command line

Since 3MF files are just ZIP archives, you can inject metadata with standard tools:

On macOS/Linux, create your `simplyprint-metadata.json` file, then run:
`zip -j my-file.3mf simplyprint-metadata.json`

On Windows with PowerShell, you can use the .NET ZipFile class or any ZIP utility.

## Filename tag rules

In addition to embedded metadata, you can set up regex-based rules that automatically match filenames and apply tags, bed types, and custom field values. This is great if you follow a naming convention for your files and want SimplyPrint to pick up on it automatically.

||| Filename tag rules use regular expressions (regex). Misconfigured patterns may match unintended files. If you're not familiar with regex, the settings page has a built-in AI prompt you can copy and paste into ChatGPT or Claude to get help writing your patterns.

### Where to find it

Go to **Settings** > **Tagging**, scroll down to **Advanced smart tagging**. You'll see the **Filename tag rules** section at the bottom.

### How rules work

Each rule has a **regex pattern** that gets tested against the full filename (e.g. `bracket-textured-plate.gcode`). When the pattern matches, the configured actions are applied. You can set:

- **Custom tags** - one or more tags to apply
- **Bed type** - a build plate to set on the file
- **Custom field values** - static values or values extracted from the filename using capture groups

Rules are checked in order, and multiple rules can match the same file - their results stack.

![Example of a filename tag rule with pattern, tags, bed type, and custom field mapping](https://storage.crisp.chat/users/helpdesk/website/-/f/f/2/2/ff22a914001c1000/smart-tagging-file-metadata-na_q852kg.png)

### Setting up a rule

1. Go to **Settings** > **Tagging** in your SimplyPrint panel
2. Scroll to the **Advanced smart tagging** section
3. Under **Filename tag rules**, click **Add rule**
4. Enter a regex pattern (the input shows it between `/` slashes)
5. Optionally change the flags - the default `i` makes it case-insensitive
6. Choose which tags, bed type, and/or custom field values to apply
7. Use the **Test filename** input to verify your pattern matches correctly
8. Click **Save** at the bottom of the settings page

### Example rules

Here are some common patterns to help you get started.

**Match keywords for tagging:**

Pattern: `urgent` or `rush` (use the pipe character between them)
Matches filenames containing "urgent" or "rush", e.g. `rush-order-bracket.gcode`
Use case: Apply an "Urgent" custom tag

Pattern: `textured` or `smooth` or `satin` (use pipe characters between them)
Matches filenames with bed surface keywords, e.g. `bracket-textured-plate.gcode`
Use case: Set the correct build plate automatically

Pattern: `prototype`
Matches any filename with "prototype" in it, e.g. `prototype-v3-bracket.3mf`
Use case: Apply "Proto" and "Draft" tags

| In regex, the pipe character means "or" - so `urgent` pipe `rush` matches either word. You type the pipe character between the words in the pattern input field.

**Extract values with capture groups:**

Capture groups are parentheses `()` in your regex. They let you extract parts of the filename and use them as custom field values.

Pattern: `ORD-([a-zA-Z0-9_-]+)`
Example filename: `bracket-ORD-521-v2.gcode`
Captures: `$1` = `521-v2`

Pattern: `client-([a-zA-Z0-9_-]+)`
Example filename: `bracket-client-AcmeCorp.gcode`
Captures: `$1` = `AcmeCorp`

Pattern: `(PLA|PETG|ABS)-(textured|smooth)`
Example filename: `housing-PLA-textured-final.gcode`
Captures: `$1` = `PLA`, `$2` = `textured`

### Using capture groups as custom field values

When you add a custom field mapping to a rule, the value field supports capture group references:

- `$1` - replaced with the first captured group
- `$2` - replaced with the second captured group
- `Project-$1` - you can mix static text with captured values
- `hello` - or just use a plain static value (no substitution)

So if your pattern is `ORD-([a-zA-Z0-9_-]+)` and the filename is `bracket-ORD-521-v2.gcode`, setting the value to `$1` gives you `521-v2`, while `Order $1` gives you `Order 521-v2`.

### Testing your patterns

Every rule has a built-in **test filename** field. Type a sample filename to instantly see:
- Whether your pattern matches
- Which capture groups were found and what they contain

The test value is not saved - it's purely for verification. The settings page also shows clickable sample filenames you can try.

### Auto-create tags

Each rule has an **"Auto-create tags if they don't exist"** checkbox. When enabled, tags referenced in the rule that don't exist yet will be created automatically. Useful if you're just getting started and haven't created all your tags yet.

### Tips for writing patterns

- The default `i` flag makes matching case-insensitive - usually what you want
- Use the pipe character to match multiple alternatives, e.g. urgent or rush or priority
- Use `[a-zA-Z0-9_-]+` if your values can contain hyphens (e.g. order numbers like `521-v2`)
- You don't need to match the entire filename - the pattern just needs to appear somewhere in it
- Keep patterns simple. If you need complex logic, split it into multiple rules
- Multiple rules can match the same file. Tags are additive; bed type and custom fields use the last match

|| **Not sure how to write regex?** The settings page has a "copy AI prompt" button in the examples section. Copy it and paste it into any AI assistant (like ChatGPT or Claude) along with a few example filenames, and it will help you create the right patterns.

## Settings

### Parse SimplyPrint metadata from files

When enabled (on by default), SimplyPrint will scan uploaded files for embedded metadata. Turn this off if you don't use this feature and want to skip the scanning step.

### Auto-create tags from metadata

When enabled, tag names referenced in file metadata or filename rules will be automatically created as custom tags in your organization if they don't already exist. This is off by default to prevent unexpected tag creation.

| Be careful with auto-create - it will create tags for any name found in your metadata, even typos.

## Custom fields

You can set custom field values via metadata using the `field.FIELD_ID` key in GCode or the `fields` object in 3MF JSON. The field ID is the identifier you assigned when creating the custom field in SimplyPrint.

To find a custom field's ID, go to **Settings** > **Custom fields** and check the field configuration.

## Tips for automation workflows

Embedded metadata really shines in automated setups. Here are some ideas:

- **Auto-slicing** - If you use SimplyPrint's auto-slicing feature, add `; sp:` lines to your slicer profile's start GCode. Every file that gets auto-sliced will automatically carry the right metadata, so when it lands in the queue it's already tagged with the correct bed type, custom tags, and field values.
- **CI/CD integration** - Add a post-processing step that injects `; sp:` lines into your GCode files before uploading via the SimplyPrint API.
- **Slicer profiles per project** - Create different slicer profiles with different `; sp:` lines for different projects or clients. When a file is sliced with that profile, it arrives pre-tagged.
- **Batch processing** - Use a script to inject `simplyprint-metadata.json` into multiple 3MF files at once for bulk uploads.
- **Filename conventions** - Combine filename rules with a consistent naming convention (e.g. always include the client name and order number in filenames) for automatic tagging without modifying file contents.
