diff --git a/data/material_types.yaml b/data/fff_material_types.yaml similarity index 100% rename from data/material_types.yaml rename to data/fff_material_types.yaml diff --git a/data/materials.yaml b/data/materials.yaml index 001f18d..208e644 100644 --- a/data/materials.yaml +++ b/data/materials.yaml @@ -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 @@ -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 @@ -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 @@ -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 @@ -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: diff --git a/docs_src/generate.py b/docs_src/generate.py index 25adc26..28f6275 100644 --- a/docs_src/generate.py +++ b/docs_src/generate.py @@ -14,7 +14,7 @@ "brands", "materials", "material_tags", - "material_types", + "fff_material_types", "material_certifications", "packaging", "uuid", diff --git a/docs_src/generate_common.py b/docs_src/generate_common.py index 15864eb..75a9e9e 100644 --- a/docs_src/generate_common.py +++ b/docs_src/generate_common.py @@ -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"), diff --git a/docs_src/markdown/_navbar.md b/docs_src/markdown/_navbar.md index b7facbb..f0f8259 100644 --- a/docs_src/markdown/_navbar.md +++ b/docs_src/markdown/_navbar.md @@ -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) diff --git a/docs_src/markdown/fff_material_types.md b/docs_src/markdown/fff_material_types.md new file mode 100644 index 0000000..dad4aee --- /dev/null +++ b/docs_src/markdown/fff_material_types.md @@ -0,0 +1,6 @@ +# FFF material types + +{{ class_documentation("materials.yaml", "FFFMaterialType") }} + +## Enum members +{{ enum_table("fff_material_types.yaml", fff_material_type_columns) }} diff --git a/docs_src/markdown/material_types.md b/docs_src/markdown/material_types.md deleted file mode 100644 index 6b2ec26..0000000 --- a/docs_src/markdown/material_types.md +++ /dev/null @@ -1,6 +0,0 @@ -# Material types - -{{ class_documentation("materials.yaml", "MaterialType") }} - -## Enum members -{{ enum_table("material_types.yaml", material_type_columns) }} diff --git a/docs_src/markdown/materials.md b/docs_src/markdown/materials.md index 60a7adf..55164eb 100644 --- a/docs_src/markdown/materials.md +++ b/docs_src/markdown/materials.md @@ -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) diff --git a/docs_src/plantuml/materials.plantuml b/docs_src/plantuml/materials.plantuml index 31755cb..b541107 100644 --- a/docs_src/plantuml/materials.plantuml +++ b/docs_src/plantuml/materials.plantuml @@ -15,8 +15,8 @@ package Packaging { {{ plantuml_entity("SLAMaterialProperties") }} -{{ plantuml_entity("MaterialType") }} -MaterialType -r- MaterialProperties +{{ plantuml_entity("FFFMaterialType") }} +FFFMaterialType -r- FFFMaterialProperties {{ plantuml_entity("MaterialTagCategory") }} @@ -29,7 +29,6 @@ MaterialTag -d- MaterialTagCategory {{ plantuml_entity("Material") }} Material -u-- Brand -Material -u- MaterialType Material -r- MaterialProperties Material -- MaterialTag Material -- MaterialCertification @@ -37,6 +36,9 @@ Material -- MaterialPhoto Material .u.. MaterialPackage +{{ plantuml_entity("FFFMaterial") }} +FFFMaterial -u- FFFMaterialType + {{ plantuml_entity("MaterialColor") }} MaterialColor .r. Material diff --git a/schema/generate_db_schema.py b/schema/generate_db_schema.py index 1a63a4e..9d90f32 100644 --- a/schema/generate_db_schema.py +++ b/schema/generate_db_schema.py @@ -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", @@ -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))) @@ -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"}}}, @@ -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), +) +generate_schema_file("material_type", entity_schema(entity_yaml(materials_yaml, "FFFMaterialType"))) generate_schema_file( "fff_material_properties", diff --git a/schema/generated/opt_db_schema/fff_material.schema.json b/schema/generated/opt_db_schema/fff_material.schema.json new file mode 100644 index 0000000..6d0bfed --- /dev/null +++ b/schema/generated/opt_db_schema/fff_material.schema.json @@ -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": [] +} diff --git a/schema/generated/opt_db_schema/material.schema.json b/schema/generated/opt_db_schema/material.schema.json index ad8d84b..a53a5ca 100644 --- a/schema/generated/opt_db_schema/material.schema.json +++ b/schema/generated/opt_db_schema/material.schema.json @@ -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", @@ -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", @@ -278,6 +228,7 @@ } }, "then": { + "$ref": "fff_material.schema.json", "properties": { "properties": { "$ref": "fff_material_properties.schema.json" diff --git a/schema/generated/opt_db_schema/material_type.schema.json b/schema/generated/opt_db_schema/material_type.schema.json index 27dc546..98c701c 100644 --- a/schema/generated/opt_db_schema/material_type.schema.json +++ b/schema/generated/opt_db_schema/material_type.schema.json @@ -2,7 +2,7 @@ "$id": "/material_type", "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", - "title": "MaterialType", + "title": "FFFMaterialType", "properties": { "abbreviation": { "type": "string", @@ -19,7 +19,7 @@ "x-example": "Polyethylene Terephtalate Glycol" }, "default_properties": { - "$ref": "material_properties.schema.json" + "$ref": "fff_material_properties.schema.json" } }, "required": [