mirror of
https://github.com/prusa3d/PrusaSlicer.git
synced 2026-11-26 23:29:07 +00:00
JSON schema for GCode Metadata and Preset YAMLs introduced
This commit is contained in:
parent
eeef94a438
commit
e881062829
5 changed files with 707 additions and 0 deletions
4
specs/README.md
Normal file
4
specs/README.md
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# Specifications
|
||||
|
||||
This directory contains specification resources like JSON schema for various formats.
|
||||
Each format in its own directory.
|
||||
25
specs/gcode_metadata/README.md
Normal file
25
specs/gcode_metadata/README.md
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# GCode Metadata specification
|
||||
|
||||
This directory contains:
|
||||
- [JSON schema](gcode_metadata.schema.json) for validating GCode Metadata embedded in ASCII and binary GCode files.
|
||||
|
||||
## GCode Metadata purpose
|
||||
|
||||
The purpose of GCode Metadata is to describe the specific state the Prusa SLicer created the GCode for, it describes
|
||||
(besides others) these things:
|
||||
- Printer HW Configuration:
|
||||
- including printer model identification (and its features)
|
||||
- attached printing tools (and its features like nozzle_diameter),
|
||||
- attached multimaterial units (aka feeders)
|
||||
- loaded material description
|
||||
- Preset settings for individual components (printer, print, tool, material)
|
||||
- Print statistics like time and filament usage
|
||||
|
||||
## Usages of GCode metadata
|
||||
|
||||
The GCode metadata are used in following cases:
|
||||
- in ASCII and binary GCode---to e.g. described the GCode requirements,
|
||||
- in Prusa Slicer 3MF as part of _config container_ description,
|
||||
- partially in Connect telemetry (provided to Slicer and as well as interchanged between Connect and printer firmware).
|
||||
In this case the data provided here is just subset of GCode metadata, and containing other telemetry related data
|
||||
fitted into same topology/terminology.
|
||||
295
specs/gcode_metadata/gcode_metadata.schema.json
Normal file
295
specs/gcode_metadata/gcode_metadata.schema.json
Normal file
|
|
@ -0,0 +1,295 @@
|
|||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"title": "PrusaSlicer Project Configuration",
|
||||
"description": "Schema for PrusaSlicer configuration and project files",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"config"
|
||||
],
|
||||
"properties": {
|
||||
"general": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"producer": {
|
||||
"type": "string"
|
||||
},
|
||||
"producer_version": {
|
||||
"type": "string"
|
||||
},
|
||||
"time": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
}
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"type": "object",
|
||||
"required": ["printer"],
|
||||
"properties": {
|
||||
"presets": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"vendor": {
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"type": "string"
|
||||
},
|
||||
"repo_id": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"printer": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"config_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"printer_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"vendor_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"repo_id": {
|
||||
"type": "string"
|
||||
},
|
||||
"repo_version": {
|
||||
"type": "string"
|
||||
},
|
||||
"config_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"technology": {
|
||||
"type": "string"
|
||||
},
|
||||
"model": {
|
||||
"type": "string"
|
||||
},
|
||||
"base_model": {
|
||||
"type": "string"
|
||||
},
|
||||
"tool_count": {
|
||||
"type": "integer"
|
||||
},
|
||||
"features": {
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": ["boolean", "string", "number", "array", "object"]
|
||||
}
|
||||
},
|
||||
"tools": {
|
||||
"type": "object",
|
||||
"patternProperties": {
|
||||
"^[0-9]+(\\.[0-9]+)*$": {
|
||||
"$ref": "#/$defs/toolDefinition"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"sheet": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"features": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"cold": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"bed_model": {
|
||||
"type": "string"
|
||||
},
|
||||
"bed_texture": {
|
||||
"type": "string"
|
||||
},
|
||||
"thumbnail": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"presets": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"printer_settings": {
|
||||
"type": "object"
|
||||
},
|
||||
"toolprint_settings": {
|
||||
"type": "object"
|
||||
},
|
||||
"print_settings": {
|
||||
"type": "object"
|
||||
},
|
||||
"filament_settings": {
|
||||
"type": "object"
|
||||
},
|
||||
"material": {
|
||||
"type": "object"
|
||||
},
|
||||
"tool_print": {
|
||||
"type": "object"
|
||||
},
|
||||
"project_settings": {
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"project": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"uuid": {
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"stats": {
|
||||
"type": [
|
||||
"null",
|
||||
"object"
|
||||
],
|
||||
"additionalProperties": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"$defs": {
|
||||
"toolDefinition": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"enum": [
|
||||
"print_head",
|
||||
"cutter",
|
||||
"marker"
|
||||
]
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"features": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"nozzle_diameter": {
|
||||
"type": "number"
|
||||
},
|
||||
"nozzle_high_flow": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"nozzle_hardened": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"blade_thickness": {
|
||||
"type": "number"
|
||||
},
|
||||
"tip_diameter": {
|
||||
"type": "number"
|
||||
}
|
||||
}
|
||||
},
|
||||
"slicer_material": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"features": {
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"material": {
|
||||
"description": "This structure follows MaterialDB's Material entity",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"properties": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"min_nozzle_diameter": {
|
||||
"type": "number"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"examples": [
|
||||
"abrasive",
|
||||
"contains_carbon_fiber"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"feeder": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"enum": [
|
||||
"mmu",
|
||||
"manual"
|
||||
]
|
||||
},
|
||||
"model": {
|
||||
"type": "string"
|
||||
},
|
||||
"base_model": {
|
||||
"type": "string"
|
||||
},
|
||||
"num_slots": {
|
||||
"type": "integer"
|
||||
},
|
||||
"in_slot": {
|
||||
"type": "integer"
|
||||
},
|
||||
"feeder": {
|
||||
"$ref": "#/$defs/toolDefinition"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"patternProperties": {
|
||||
"^[0-9]+(\\.[0-9]+)*$": {
|
||||
"$ref": "#/$defs/toolDefinition"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
83
specs/presets/preset-schema.json
Normal file
83
specs/presets/preset-schema.json
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://prusa3d.com/schemas/slicer-presets",
|
||||
"title": "Slicer Presets",
|
||||
"type": "object",
|
||||
"$defs": {
|
||||
"fragment": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": { "type": "string" },
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"values": {
|
||||
"type": "object"
|
||||
},
|
||||
"features": {
|
||||
"type": "object"
|
||||
},
|
||||
"variants": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/$defs/conditional-fragment"
|
||||
}
|
||||
},
|
||||
"inherits": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"unconditional_inherits": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"match_mode": {
|
||||
"enum": ["first_match","all_matches"]
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"conditional-fragment": {
|
||||
"type": "object",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/$defs/fragment"
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"condition": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"top-fragment": {
|
||||
"type": "object",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/$defs/conditional-fragment"
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"kind": {
|
||||
"enum": [
|
||||
"printer",
|
||||
"print",
|
||||
"tool_print",
|
||||
"material",
|
||||
"filament"
|
||||
]
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"kind"
|
||||
]
|
||||
}
|
||||
},
|
||||
"oneOf": [{"$ref": "#/$defs/top-fragment"}]
|
||||
}
|
||||
300
specs/presets/vendor-schema.json
Normal file
300
specs/presets/vendor-schema.json
Normal file
|
|
@ -0,0 +1,300 @@
|
|||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://prusa3d.com/schemas/slicer-presets-vendor",
|
||||
"title": "Slicer Presets Vendor",
|
||||
"type": "object",
|
||||
"$defs": {
|
||||
"value": {
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"type": "boolean"
|
||||
}
|
||||
]
|
||||
},
|
||||
"technology" : {
|
||||
"enum": ["FFF", "SLA"]
|
||||
},
|
||||
"feature-def": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"default": {
|
||||
"$ref": "#/$defs/value"
|
||||
},
|
||||
"user_editable": {"type": "boolean"},
|
||||
"allowed_values": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"oneOf": [{"type": "string"}, {"type": "number"}]
|
||||
}
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"required": ["default"]
|
||||
},
|
||||
"features-def": {
|
||||
"type": "object",
|
||||
"patternProperties": {
|
||||
".*": {
|
||||
"$ref": "#/$defs/feature-def"
|
||||
}
|
||||
}
|
||||
},
|
||||
"feature-vals": {
|
||||
"type": "object",
|
||||
"patternProperties": {
|
||||
".*": {
|
||||
"$ref": "#/$defs/value"
|
||||
}
|
||||
}
|
||||
},
|
||||
"vendor-def": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"kind": {"const": "vendor"},
|
||||
"id": {"type": "string"},
|
||||
"name": {"type": "string"},
|
||||
"version": {"type": "string"},
|
||||
"features": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"printer": {
|
||||
"$ref": "#/$defs/features-def"
|
||||
},
|
||||
"tool": {
|
||||
"$ref": "#/$defs/features-def"
|
||||
},
|
||||
"feeder": {
|
||||
"$ref": "#/$defs/features-def"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"model-def": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"base_model": {
|
||||
"type": "string"
|
||||
},
|
||||
"model": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["base_model", "model"]
|
||||
},
|
||||
"visual_def": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"bed_model": {
|
||||
"type": "string"
|
||||
},
|
||||
"bed_texture": {
|
||||
"type": "string"
|
||||
},
|
||||
"thumbnail": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"printer-def": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"kind": {"const": "printer"},
|
||||
"technology": {"$ref": "#/$defs/technology"},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"model": {
|
||||
"$ref": "#/$defs/model-def"
|
||||
},
|
||||
"tool_count": {
|
||||
"type": "number",
|
||||
"minimum": 1
|
||||
},
|
||||
"features": {
|
||||
"$ref": "#/$defs/features-def"
|
||||
},
|
||||
"visual": {"$ref": "#/$defs/visual_def"},
|
||||
"legacy_printer_model": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["kind", "name", "model", "tool_count", "technology"],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"tool-def": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"kind": {"const": "tool"},
|
||||
"technology": {"$ref": "#/$defs/technology"},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"condition": {
|
||||
"type": "string"
|
||||
},
|
||||
"features": {
|
||||
"$ref": "#/$defs/features-def"
|
||||
}
|
||||
},
|
||||
"required": ["kind", "name", "id"],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"feeder-def": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"kind": {"const": "feeder"},
|
||||
"technology": {"$ref": "#/$defs/technology"},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"condition": {
|
||||
"type": "string"
|
||||
},
|
||||
"model": {
|
||||
"$ref": "#/$defs/model-def"
|
||||
},
|
||||
"feeder_type": {
|
||||
"enum": ["mmu", "manual"]
|
||||
},
|
||||
"slot_count": {
|
||||
"type": "number",
|
||||
"minimum": 0
|
||||
},
|
||||
"features": {
|
||||
"$ref": "#/$defs/features-def"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"kind", "name", "id", "slot_count"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"sheet-def": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"kind": {"const": "sheet"},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"condition": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
},
|
||||
"features": {
|
||||
"$ref": "#/$defs/features-def"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"kind", "name", "id", "type"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"tool-config-template": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"tool": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": ["tool"]
|
||||
},
|
||||
"feeder-config-template": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"feeder": {
|
||||
"type": "string"
|
||||
},
|
||||
"address": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "number"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"printer-config-template": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"kind": {"const": "printer_config"},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"printer": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"tool_count": {
|
||||
"type": "number"
|
||||
},
|
||||
"tools": {
|
||||
"type": "array",
|
||||
"items": {"$ref": "#/$defs/tool-config-template"}
|
||||
},
|
||||
"feeders": {
|
||||
"type": "array",
|
||||
"items": {"$ref": "#/$defs/feeder-config-template"}
|
||||
},
|
||||
"sheet": {
|
||||
"type": "string"
|
||||
},
|
||||
"visual": {
|
||||
"$ref": "#/$defs/visual_def"
|
||||
},
|
||||
"legacy_printer_model": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["kind", "id", "printer", "name", "tools", "sheet"]
|
||||
}
|
||||
},
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/$defs/vendor-def"
|
||||
},
|
||||
{
|
||||
"$ref": "#/$defs/printer-def"
|
||||
},
|
||||
{
|
||||
"$ref": "#/$defs/tool-def"
|
||||
},
|
||||
{
|
||||
"$ref": "#/$defs/feeder-def"
|
||||
},
|
||||
{
|
||||
"$ref": "#/$defs/sheet-def"
|
||||
},
|
||||
{
|
||||
"$ref": "#/$defs/printer-config-template"
|
||||
}
|
||||
]
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue