Skip to content

Commit

Permalink
Merge branch 'main' into PP-480-Fix-generic-profiles-factor-4
Browse files Browse the repository at this point in the history
  • Loading branch information
wawanbreton authored Jul 2, 2024
2 parents e466241 + 1ff17e6 commit 268266a
Show file tree
Hide file tree
Showing 162 changed files with 1,356 additions and 44,291 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ on:
options:
- self-hosted-X64
- self-hosted-ARM64
- macos-11
- macos-12

jobs:
Expand All @@ -53,4 +52,4 @@ jobs:
staging: ${{ inputs.staging }}
architecture: ${{ inputs.architecture }}
operating_system: ${{ inputs.operating_system }}
secrets: inherit
secrets: inherit
1 change: 1 addition & 0 deletions .printer-linter
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ checks:
diagnostic-mesh-file-extension: true
diagnostic-mesh-file-size: true
diagnostic-definition-redundant-override: true
diagnostic-definition-experimental-setting: true
diagnostic-resources-macos-app-directory-name: true
diagnostic-incorrect-formula: true
diagnostic-resource-file-deleted: true
Expand Down
3 changes: 1 addition & 2 deletions conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ requirements:
- "curaengine/(latest)@ultimaker/testing"
- "cura_binary_data/(latest)@ultimaker/testing"
- "fdm_materials/(latest)@ultimaker/testing"
- "curaengine_plugin_gradual_flow/0.1.0-beta.3"
- "curaengine_plugin_gradual_flow/0.1.1-beta.3"
- "dulcificum/latest@ultimaker/testing"
- "pysavitar/5.3.0"
- "pynest2d/5.3.0"
- "curaengine_grpc_definitions/0.2.0"
- "native_cad_plugin/2.0.0"
requirements_internal:
- "fdm_materials/(latest)@internal/testing"
Expand Down
1 change: 0 additions & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,6 @@ def configure(self):
self.options["cpython"].shared = True
self.options["boost"].header_only = True
if self.settings.os == "Linux":
self.options["curaengine_grpc_definitions"].shared = True
self.options["openssl"].shared = True
if self.conf.get("user.curaengine:sentry_url", "", check_type=str) != "":
self.options["curaengine"].enable_sentry = True
Expand Down
4 changes: 4 additions & 0 deletions cura/Machines/Models/IntentTranslations.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
"name": catalog.i18nc("@label", "Draft"),
"description": catalog.i18nc("@text", "The draft profile is designed to print initial prototypes and concept validation with the intent of significant print time reduction.")
}
intent_translations["annealing"] = {
"name": catalog.i18nc("@label", "Annealing"),
"description": catalog.i18nc("@text", "The annealing profile requires post-processing in an oven after the print is finished. This profile retains the dimensional accuracy of the printed part after annealing and improves strength, stiffness, and thermal resistance.")
}
intent_translations["solid"] = {
"name": catalog.i18nc("@label", "Solid"),
"description": catalog.i18nc("@text",
Expand Down
4 changes: 2 additions & 2 deletions printer-linter/src/printerlinter/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ def getLinter(file: Path, settings: dict) -> Optional[List[Linter]]:
if not file.exists():
return [Directory(file, settings)]

if ".inst" in file.suffixes and ".cfg" in file.suffixes:
if ".inst" in file.suffixes and file.suffixes[-1] == ".cfg":
return [Directory(file, settings), Profile(file, settings), Formulas(file, settings)]

if ".def" in file.suffixes and ".json" in file.suffixes:
if ".def" in file.suffixes and file.suffixes[-1] == ".json":
if file.stem in ("fdmprinter.def", "fdmextruder.def"):
return [Formulas(file, settings)]
return [Directory(file, settings), Definition(file, settings), Formulas(file, settings)]
Expand Down
42 changes: 36 additions & 6 deletions printer-linter/src/printerlinter/linters/defintion.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ class Definition(Linter):
def __init__(self, file: Path, settings: dict) -> None:
super().__init__(file, settings)
self._definitions = {}
self._definition_name = None
self._experimental_settings = []
self._loadDefinitionFiles(file)
self._content = self._file.read_text()
self._loadExperimentalSettings()
self._loadBasePrinterSettings()

@property
Expand All @@ -32,6 +35,10 @@ def check(self) -> Iterator[Diagnostic]:
for check in self.checkMaterialTemperature():
yield check

if self._settings["checks"].get("diagnostic-definition-experimental-setting", False):
for check in self.checkExperimentalSetting():
yield check

# Add other which will yield Diagnostic's
# TODO: A check to determine if the user set value is with the min and max value defined in the parent and doesn't trigger a warning
# TODO: A check if the key exist in the first place
Expand All @@ -41,9 +48,8 @@ def check(self) -> Iterator[Diagnostic]:

def checkRedefineOverride(self) -> Iterator[Diagnostic]:
""" Checks if definition file overrides its parents settings with the same value. """
definition_name = list(self._definitions.keys())[0]
definition = self._definitions[definition_name]
if "overrides" in definition and definition_name not in ("fdmprinter", "fdmextruder"):
definition = self._definitions[self._definition_name]
if "overrides" in definition and self._definition_name not in ("fdmprinter", "fdmextruder"):
for key, value_dict in definition["overrides"].items():
is_redefined, child_key, child_value, parent, inherited_by= self._isDefinedInParent(key, value_dict, definition['inherits'])
if is_redefined:
Expand Down Expand Up @@ -71,9 +77,8 @@ def checkRedefineOverride(self) -> Iterator[Diagnostic]:

def checkMaterialTemperature(self) -> Iterator[Diagnostic]:
"""Checks if definition file has material tremperature defined within them"""
definition_name = list(self._definitions.keys())[0]
definition = self._definitions[definition_name]
if "overrides" in definition and definition_name not in ("fdmprinter", "fdmextruder"):
definition = self._definitions[self._definition_name]
if "overrides" in definition and self._definition_name not in ("fdmprinter", "fdmextruder"):
for key, value_dict in definition["overrides"].items():
if "temperature" in key and "material" in key:

Expand All @@ -97,13 +102,32 @@ def checkMaterialTemperature(self) -> Iterator[Diagnostic]:
replacements=replacements
)

def checkExperimentalSetting(self) -> Iterator[Diagnostic]:
"""Checks if definition uses experimental settings"""
definition = self._definitions[self._definition_name]
if "overrides" in definition and self._definition_name not in ("fdmprinter", "fdmextruder"):
for setting in definition["overrides"]:
if setting in self._experimental_settings:
redefined = re.compile(setting)
found = redefined.search(self._content)
yield Diagnostic(
file=self._file,
diagnostic_name="diagnostic-definition-experimental-setting",
message=f"Setting {setting} is still experimental and should not be used in default profiles",
level="Warning",
offset=found.span(0)[0]
)

def _loadDefinitionFiles(self, definition_file) -> None:
""" Loads definition file contents into self._definitions. Also load parent definition if it exists. """
definition_name = Path(definition_file.stem).stem

if not definition_file.exists() or definition_name in self._definitions:
return

if self._definition_name is None:
self._definition_name = definition_name

# Load definition file into dictionary
self._definitions[definition_name] = json.loads(definition_file.read_text())

Expand Down Expand Up @@ -152,6 +176,12 @@ def _isDefinedInParent(self, key, value_dict, inherits_from):
return self._isDefinedInParent(key, value_dict, parent["inherits"])
return False, None, None, None, None

def _loadExperimentalSettings(self):
try:
self._experimental_settings = self._definitions[self.base_def]["settings"]["experimental"]["children"].keys()
except:
pass

def _loadBasePrinterSettings(self):
settings = {}
for k, v in self._definitions[self.base_def]["settings"].items():
Expand Down
23 changes: 16 additions & 7 deletions printer-linter/src/printerlinter/linters/formulas.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,17 @@ def __init__(self, file: Path, settings: dict) -> None:
self._definition = {}

def getCuraSettingList(self) -> list:
settings_list = []

with open(os.path.join(os.path.dirname(__file__), "..", "..", "..", "..", "resources", "definitions", "fdmprinter.def.json")) as data:
json_data = json.load(data)
return self.extractKeys(json_data)
settings_list += self.extractKeys(json_data)

with open(os.path.join(os.path.dirname(__file__), "..", "..", "..", "..", "resources", "definitions", "fdmextruder.def.json")) as data:
json_data = json.load(data)
settings_list += self.extractKeys(json_data)

return settings_list

def extractKeys(self, json_obj, parent_key=''):
keys_with_value = []
Expand Down Expand Up @@ -146,12 +154,13 @@ def _parseCfg(self, file_path:Path) -> dict:

available_sections = ["values"]
for section in available_sections:
options = config.options(section)
for option in options:
values ={}
values["value"] = config.get(section, option)
overrides[option] = values
file_data["overrides"]= overrides# Process the value here
if config.has_section(section):
options = config.options(section)
for option in options:
values ={}
values["value"] = config.get(section, option)
overrides[option] = values
file_data["overrides"]= overrides# Process the value here

return file_data

Expand Down
2 changes: 1 addition & 1 deletion printer-linter/src/printerlinter/linters/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ def _getprofileName(self) -> Tuple[str, bool]:
config = ConfigParser()
config.read([self._file])
name_of_profile = config.get("general", "name")
redefined = re.compile(name_of_profile)
redefined = re.compile(re.escape(name_of_profile))
found = redefined.search(self._content)
return name_of_profile, found
19 changes: 19 additions & 0 deletions resources/bundled_packages/cura.json
Original file line number Diff line number Diff line change
Expand Up @@ -1914,6 +1914,25 @@
}
}
},
"UltimakerPPSCF": {
"package_info": {
"package_id": "UltimakerPPSCF",
"package_type": "material",
"display_name": "Ultimaker PPS-CF",
"description": "Example package for material and quality profiles for Ultimaker materials.",
"package_version": "1.0.0",
"sdk_version": "8.6.0",
"website": "https://ultimaker.com/materials/factor-series-pps-carbon-fiber/",
"author": {
"author_id": "UltimakerPackages",
"display_name": "UltiMaker",
"email": "materials@ultimaker.com",
"website": "https://ultimaker.com",
"description": "Professional 3D printing made accessible.",
"support_website": "https://support.ultimaker.com/s/article/How-to-print-with-UltiMaker-PPS-CF"
}
}
},
"ULTIMAKERBASCFMETHOD": {
"package_info": {
"package_id": "ULTIMAKERBASCFMETHOD",
Expand Down
59 changes: 59 additions & 0 deletions resources/definitions/creality_ender3v3ke.def.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"version": 2,
"name": "Creality Ender-3 V3 KE",
"inherits": "creality_base",
"metadata":
{
"visible": true,
"manufacturer": "Creality3D",
"file_formats": "text/x-gcode",
"platform": "creality_ender3.3mf",
"first_start_actions": [ "MachineSettingsAction" ],
"has_machine_quality": true,
"has_materials": true,
"has_variants": true,
"machine_extruder_trains": { "0": "creality_base_extruder_0" },
"preferred_material": "generic_pla",
"preferred_quality_type": "standard",
"preferred_variant_name": "0.4mm Nozzle",
"quality_definition": "creality_base",
"variants_name": "Nozzle Size"
},
"overrides":
{
"gantry_height": { "value": 38 },
"machine_depth": { "default_value": 220 },
"machine_end_gcode": { "default_value": "G91 ;Relative positionning\nG1 E-2 F2700 ;Retract a bit\nG1 E-2 Z0.2 F2400 ;Retract and raise Z\nG1 X5 Y5 F3000 ;Wipe out\nG1 Z5 ;Raise Z more\nG90 ;Absolute positionning\n\nG1 X2 Y218 F3000 ;Present print\nM106 S0 ;Turn-off fan\nM104 S0 ;Turn-off hotend\nM140 S0 ;Turn-off bed\n\nM84 X Y E ;Disable all steppers but Z" },
"machine_head_with_fans_polygon":
{
"default_value": [
[-20, 10],
[10, 10],
[10, -10],
[-20, -10]
]
},
"machine_heated_bed": { "default_value": true },
"machine_height": { "default_value": 240 },
"machine_max_acceleration_e": { "value": 5000 },
"machine_max_acceleration_x": { "value": 8000.0 },
"machine_max_acceleration_y": { "value": 8000.0 },
"machine_max_acceleration_z": { "value": 500.0 },
"machine_max_feedrate_e": { "value": 100 },
"machine_max_feedrate_x": { "value": 500 },
"machine_max_feedrate_y": { "value": 500 },
"machine_max_feedrate_z": { "value": 30 },
"machine_name": { "default_value": "Creality Ender-3 V3 KE" },
"machine_start_gcode": { "default_value": "M220 S100 ;Reset Feedrate\nM221 S100 ;Reset Flowrate\n\nG28 ;Home\n\nG92 E0 ;Reset Extruder\nG1 Z2.0 F3000 ;Move Z Axis up\nG1 X-2.0 Y20 Z0.28 F5000.0 ;Move to start position\nM109 S{material_print_temperature_layer_0}\nG1 X-2.0 Y145.0 Z0.28 F1500.0 E15 ;Draw the first line\nG1 X-1.7 Y145.0 Z0.28 F5000.0 ;Move to side a little\nG1 X-1.7 Y20 Z0.28 F1500.0 E30 ;Draw the second line\nG92 E0 ;Reset Extruder\nG1 E-1 F1800 ;Retract a bit\nG1 Z2.0 F3000 ;Move Z Axis up\nG1 E0 F1800" },
"machine_width": { "default_value": 220 },
"material_print_temp_wait": { "default_value": false },
"retraction_amount": { "default_value": 0.8 },
"retraction_combing": { "value": "no_outer_surfaces" },
"retraction_combing_max_distance": { "value": 5.0 },
"retraction_extrusion_window": { "value": "retraction_amount" },
"retraction_min_travel": { "value": 2.0 },
"retraction_speed": { "default_value": 40 },
"speed_layer_0": { "value": 100 },
"speed_print": { "value": 300 }
}
}
Loading

0 comments on commit 268266a

Please sign in to comment.