Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
92 changes: 50 additions & 42 deletions data/materials.yaml
Original file line number Diff line number Diff line change
@@ -1,38 +1,4 @@
objects:
- name: MaterialType
enum_file: material_types.yaml
description:
- Entity grouping Materials based on the same core chemical compound.
- 'For example: PLA, PETG; PETG-CF would still be considered of the PETG MaterialType'
- MaterialType is a tightly controlled enum, all new MaterialTypes HAVE to be added to the Architecture first.

in_opt_db: true
fields:
- name: abbreviation
primary_key: true
type: string
example: PETG
max_length: 7
description:
- Short abbreviation of the material type name, no longer than 7 characters.
- Used for example in printer footers (to show what material is loaded).
- Also possibly used for checking filament type match between gcode and printer.
- The (class, abbreviation) pair forms an unique key.

required_in_opt_db: true

- name: id
type: int
description: Unique numerical identifier, alternative to the class+abbreviation pair

- name: name
type: string
example: Polyethylene Terephtalate Glycol
required_in_opt_db: true

- name: default_properties
type: MaterialProperties

- name: Material
in_opt_db: true
in_opt: true
Expand Down Expand Up @@ -64,12 +30,6 @@ objects:
required_in_opt_db: true
in_slx_workflow_db: false

- name: type
type: MaterialType
example: PETG
description: Type of the material. Can be null if the Material is not of any MaterialType in the list.
in_slx_workflow_db: false

- name: name
type: string
example: PETG Carbon Fiber Black
Expand All @@ -84,7 +44,7 @@ objects:
- Short abbreviation of the material type name, no longer than 7 characters.
- Used for example in printer footers (to show what material is loaded).
- Also possibly used for checking filament type match between gcode and printer.
- Inherited from `MaterialType` if not present.
- If the material has a `type` (`FFFMaterialType`), the abbreviation can be inherited from it if not present.

required_in_opt_db: true

Expand Down Expand Up @@ -147,6 +107,54 @@ objects:
description: Photos of the material
in_slx_workflow_db: false

- name: FFFMaterialType
enum_file: fff_material_types.yaml
description:
- Entity grouping FFF Materials based on the same core chemical compound.
- 'For example: PLA, PETG; PETG-CF would still be considered of the PETG FFFMaterialType'
- FFFMaterialType is a tightly controlled enum, all new FFFMaterialTypes HAVE to be added to the Architecture first.

in_opt_db: true
fields:
- name: abbreviation
primary_key: true
type: string
example: PETG
max_length: 7
description:
- Short abbreviation of the material type name, no longer than 7 characters.
- Used for example in printer footers (to show what material is loaded).
- Also possibly used for checking filament type match between gcode and printer.
- The (class, abbreviation) pair forms an unique key.

required_in_opt_db: true

- name: id
type: int
description: Unique numerical identifier, alternative to the class+abbreviation pair

- name: name
type: string
example: Polyethylene Terephtalate Glycol
required_in_opt_db: true

- name: default_properties
type: FFFMaterialProperties

- name: FFFMaterial
inherits: Material
in_opt_db: true
in_opt: true
description:
- Extension of `Material` for FFF materials (filaments).

fields:
- name: type
type: FFFMaterialType
example: PETG
description: Type of the material. Can be null if the Material is not of any FFFMaterialType in the list.
in_slx_workflow_db: false

- name: MaterialTag
in_opt_db: true
in_opt: true
Expand Down Expand Up @@ -233,7 +241,7 @@ objects:
in_opt: true
description:
- Properties for printing the material.
- The properties can be defined on multiple levels (`MaterialType`, `Material`), more specific levels override properties of more generic ones.
- The properties can be defined on multiple levels (`FFFMaterialType`, `Material`), more specific levels override properties of more generic ones.
- Different material classes have different property fields, those are split into subtypes of `MaterialProperties`.

fields:
Expand Down
2 changes: 1 addition & 1 deletion docs_src/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"brands",
"materials",
"material_tags",
"material_types",
"fff_material_types",
"material_certifications",
"packaging",
"uuid",
Expand Down
2 changes: 1 addition & 1 deletion docs_src/generate_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def gen_material_tag_table():

env.globals["material_tag_table"] = gen_material_tag_table

env.globals["material_type_columns"] = [
env.globals["fff_material_type_columns"] = [
tables.Column(field="key", title="ID"),
tables.Column(field="abbreviation", title="Abbr.", transform=lambda x: f"`{x}`"),
tables.Column(field="name", title="Name"),
Expand Down
2 changes: 1 addition & 1 deletion docs_src/markdown/_navbar.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
- [Packaging](/packaging)
- [Materials](/materials)
- [Material tags](/material_tags)
- [Material types](/material_types)
- [FFF material types](/fff_material_types)
- [Material certifications](/material_certifications)
- [UUIDs](/uuid)
6 changes: 6 additions & 0 deletions docs_src/markdown/fff_material_types.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# FFF material types

{{ class_documentation("materials.yaml", "FFFMaterialType") }}

## Enum members
{{ enum_table("fff_material_types.yaml", fff_material_type_columns) }}
6 changes: 0 additions & 6 deletions docs_src/markdown/material_types.md

This file was deleted.

8 changes: 5 additions & 3 deletions docs_src/markdown/materials.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
## Entity diagram
{{ plantuml("materials.plantuml") }}

## MaterialType
See [Material types](/material_types)

{{ class_documentation("materials.yaml", "Material") }}

## FFFMaterialType
See [FFF material types](/fff_material_types)

{{ class_documentation("materials.yaml", "FFFMaterial") }}

{{ class_documentation("materials.yaml", "MaterialColor") }}

### List of standard tags (used in NFC)
Expand Down
8 changes: 5 additions & 3 deletions docs_src/plantuml/materials.plantuml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ package Packaging {

{{ plantuml_entity("SLAMaterialProperties") }}

{{ plantuml_entity("MaterialType") }}
MaterialType -r- MaterialProperties
{{ plantuml_entity("FFFMaterialType") }}
FFFMaterialType -r- FFFMaterialProperties

{{ plantuml_entity("MaterialTagCategory") }}

Expand All @@ -29,14 +29,16 @@ MaterialTag -d- MaterialTagCategory

{{ plantuml_entity("Material") }}
Material -u-- Brand
Material -u- MaterialType
Material -r- MaterialProperties
Material -- MaterialTag
Material -- MaterialCertification
Material -- MaterialPhoto

Material .u.. MaterialPackage

{{ plantuml_entity("FFFMaterial") }}
FFFMaterial -u- FFFMaterialType

{{ plantuml_entity("MaterialColor") }}
MaterialColor .r. Material

Expand Down
14 changes: 11 additions & 3 deletions schema/generate_db_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def add_slug_property(schema: dict):
register_type_schema("Brand", object_ref_or_link_schema("brand"))
register_type_schema("Material", object_ref_or_link_schema("material"))
register_type_schema("MaterialClass", material_class_schema)
register_type_schema("MaterialType", enum_schema(read_yaml("material_types"), name_item="abbreviation"))
register_type_schema("FFFMaterialType", enum_schema(read_yaml("fff_material_types"), name_item="abbreviation"))
register_type_schema("MaterialContainer", object_ref_or_link_schema("material_container"))
register_type_schema(
"SLAMaterialContainerConnector",
Expand All @@ -93,6 +93,7 @@ def add_slug_property(schema: dict):
array_schema(enum_schema(read_yaml("material_certifications"))),
)
register_type_schema("MaterialProperties", object_ref_schema("material_properties"))
register_type_schema("FFFMaterialProperties", object_ref_schema("fff_material_properties"))

register_type_schema("MaterialColor", object_ref_schema("material_color"))
register_type_schema("set(MaterialColor)", array_schema(type_schema("MaterialColor", None)))
Expand All @@ -104,7 +105,10 @@ def add_slug_property(schema: dict):
"allOf": [
{
"if": {"properties": {"class": {"const": "FFF"}}},
"then": {"properties": {"properties": {"$ref": "fff_material_properties.schema.json"}}},
"then": {
"$ref": "fff_material.schema.json",
"properties": {"properties": {"$ref": "fff_material_properties.schema.json"}},
},
},
{
"if": {"properties": {"class": {"const": "SLA"}}},
Expand All @@ -113,7 +117,11 @@ def add_slug_property(schema: dict):
],
},
)
generate_schema_file("material_type", entity_schema(entity_yaml(materials_yaml, "MaterialType")))
generate_schema_file(
"fff_material",
entity_schema(entity_yaml(materials_yaml, "FFFMaterial"), include_inherits=False),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: technically speaking, include_inherits = True would possibly be marginally safer if fff_material was referenced standalone somewhere. But possibly doesn't matter.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

other fff_/sla_ schemas are also diffs over their parent, so keeping fff_material as a diff seem more consistent with the rest to me

)
generate_schema_file("material_type", entity_schema(entity_yaml(materials_yaml, "FFFMaterialType")))

generate_schema_file(
"fff_material_properties",
Expand Down
59 changes: 59 additions & 0 deletions schema/generated/opt_db_schema/fff_material.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"$id": "/fff_material",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"title": "FFFMaterial",
"properties": {
"type": {
"type": "string",
"enum": [
"PLA",
"PETG",
"TPU",
"ABS",
"ASA",
"PC",
"PCTG",
"PP",
"PA6",
"PA11",
"PA12",
"PA612",
"PA66",
"CPE",
"TPE",
"HIPS",
"PHA",
"PET",
"PEI",
"PBT",
"PVB",
"PVA",
"PEKK",
"PEEK",
"BVOH",
"TPC",
"PPS",
"PPSU",
"PVC",
"PEBA",
"PVDF",
"PPA",
"PCL",
"PES",
"PMMA",
"POM",
"PPE",
"PS",
"PSU",
"TPI",
"SBS",
"OBC",
"EVA"
],
"x-example": "PETG",
"description": "Type of the material. Can be null if the Material is not of any FFFMaterialType in the list."
}
},
"required": []
}
53 changes: 2 additions & 51 deletions schema/generated/opt_db_schema/material.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,56 +36,6 @@
"x-example": "FFF",
"description": "FFF/SLA"
},
"type": {
"type": "string",
"enum": [
"PLA",
"PETG",
"TPU",
"ABS",
"ASA",
"PC",
"PCTG",
"PP",
"PA6",
"PA11",
"PA12",
"PA612",
"PA66",
"CPE",
"TPE",
"HIPS",
"PHA",
"PET",
"PEI",
"PBT",
"PVB",
"PVA",
"PEKK",
"PEEK",
"BVOH",
"TPC",
"PPS",
"PPSU",
"PVC",
"PEBA",
"PVDF",
"PPA",
"PCL",
"PES",
"PMMA",
"POM",
"PPE",
"PS",
"PSU",
"TPI",
"SBS",
"OBC",
"EVA"
],
"x-example": "PETG",
"description": "Type of the material. Can be null if the Material is not of any MaterialType in the list."
},
"name": {
"type": "string",
"x-example": "PETG Carbon Fiber Black",
Expand All @@ -95,7 +45,7 @@
"type": "string",
"maxLength": 7,
"x-example": "PETGCF",
"description": "Short abbreviation of the material type name, no longer than 7 characters.\nUsed for example in printer footers (to show what material is loaded).\nAlso possibly used for checking filament type match between gcode and printer.\nInherited from `MaterialType` if not present."
"description": "Short abbreviation of the material type name, no longer than 7 characters.\nUsed for example in printer footers (to show what material is loaded).\nAlso possibly used for checking filament type match between gcode and printer.\nIf the material has a `type` (`FFFMaterialType`), the abbreviation can be inherited from it if not present."
},
"url": {
"type": "string",
Expand Down Expand Up @@ -278,6 +228,7 @@
}
},
"then": {
"$ref": "fff_material.schema.json",
"properties": {
"properties": {
"$ref": "fff_material_properties.schema.json"
Expand Down
Loading