[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot]
2025-04-13 23:21:28 +00:00
parent 5f2792968b
commit 3cd0a7d2ff

View File

@@ -63,7 +63,7 @@ SNAPMAKER_MACHINES = dict(
name="Snapmaker Original",
boundaries_table=[
# https://forum.snapmaker.com/t/cnc-work-area-size/5178
dict( boundaries=dict(X=125, Y=125, Z=50), toolhead="Original_CNC", mods=set() ),
dict(boundaries=dict(X=125, Y=125, Z=50), toolhead="Original_CNC", mods=set()),
],
lead=dict(X=8, Y=8, Z=8), # Linear module screw pitch (mm/turn)
),
@@ -72,7 +72,7 @@ SNAPMAKER_MACHINES = dict(
name="Snapmaker Original with Z extension",
boundaries_table=[
# https://forum.snapmaker.com/t/cnc-work-area-size/5178
dict( boundaries=dict(X=125, Y=125, Z=146), toolhead="Original_CNC", mods=set() ),
dict(boundaries=dict(X=125, Y=125, Z=146), toolhead="Original_CNC", mods=set()),
],
lead=dict(X=8, Y=8, Z=8), # Linear module screw pitch (mm/turn)
),
@@ -81,8 +81,8 @@ SNAPMAKER_MACHINES = dict(
name="Snapmaker 2 A150",
boundaries_table=[
# [1] https://support.snapmaker.com/hc/en-us/articles/20786910972311-FAQ-for-Bracing-Kit-for-Snapmaker-2-0-Linear-Modules#h_01HN4Z7S9WJE5BRT492WR0CKH1
dict( boundaries=dict(X=145, Y=160, Z=90), toolhead="50W_CNC", mods=set() ),
dict( boundaries=dict(X=145, Y=148, Z=90), toolhead="50W_CNC", mods={"BK"} ),
dict(boundaries=dict(X=145, Y=160, Z=90), toolhead="50W_CNC", mods=set()),
dict(boundaries=dict(X=145, Y=148, Z=90), toolhead="50W_CNC", mods={"BK"}),
],
lead=dict(X=8, Y=8, Z=8), # Linear module screw pitch (mm/turn)
),
@@ -91,12 +91,12 @@ SNAPMAKER_MACHINES = dict(
name="Snapmaker 2 A250",
boundaries_table=[
# [1] https://support.snapmaker.com/hc/en-us/articles/20786910972311-FAQ-for-Bracing-Kit-for-Snapmaker-2-0-Linear-Modules#h_01HN4Z7S9WJE5BRT492WR0CKH1
dict( boundaries=dict(X=230, Y=250, Z=180), toolhead="50W_CNC", mods=set() ),
dict( boundaries=dict(X=230, Y=238, Z=180), toolhead="50W_CNC", mods={"BK"} ),
dict( boundaries=dict(X=230, Y=235, Z=180), toolhead="50W_CNC", mods={"QS"} ),
dict( boundaries=dict(X=230, Y=223, Z=180), toolhead="50W_CNC", mods={"BK","QS"} ),
dict( boundaries=dict(X=230, Y=225, Z=180), toolhead="200W_CNC", mods={"BK"} ),
dict( boundaries=dict(X=230, Y=210, Z=180), toolhead="200W_CNC", mods={"BK","QS"} ),
dict(boundaries=dict(X=230, Y=250, Z=180), toolhead="50W_CNC", mods=set()),
dict(boundaries=dict(X=230, Y=238, Z=180), toolhead="50W_CNC", mods={"BK"}),
dict(boundaries=dict(X=230, Y=235, Z=180), toolhead="50W_CNC", mods={"QS"}),
dict(boundaries=dict(X=230, Y=223, Z=180), toolhead="50W_CNC", mods={"BK", "QS"}),
dict(boundaries=dict(X=230, Y=225, Z=180), toolhead="200W_CNC", mods={"BK"}),
dict(boundaries=dict(X=230, Y=210, Z=180), toolhead="200W_CNC", mods={"BK", "QS"}),
],
lead=dict(X=8, Y=8, Z=8), # Linear module screw pitch (mm/turn)
),
@@ -105,12 +105,12 @@ SNAPMAKER_MACHINES = dict(
name="Snapmaker 2 A250T",
boundaries_table=[
# [1] https://support.snapmaker.com/hc/en-us/articles/20786910972311-FAQ-for-Bracing-Kit-for-Snapmaker-2-0-Linear-Modules#h_01HN4Z7S9WJE5BRT492WR0CKH1
dict( boundaries=dict(X=230, Y=250, Z=180), toolhead="50W_CNC", mods=set() ),
dict( boundaries=dict(X=230, Y=238, Z=180), toolhead="50W_CNC", mods={"BK"} ),
dict( boundaries=dict(X=230, Y=235, Z=180), toolhead="50W_CNC", mods={"QS"} ),
dict( boundaries=dict(X=230, Y=223, Z=180), toolhead="50W_CNC", mods={"BK","QS"} ),
dict( boundaries=dict(X=230, Y=225, Z=180), toolhead="200W_CNC", mods={"BK"} ),
dict( boundaries=dict(X=230, Y=210, Z=180), toolhead="200W_CNC", mods={"BK","QS"} ),
dict(boundaries=dict(X=230, Y=250, Z=180), toolhead="50W_CNC", mods=set()),
dict(boundaries=dict(X=230, Y=238, Z=180), toolhead="50W_CNC", mods={"BK"}),
dict(boundaries=dict(X=230, Y=235, Z=180), toolhead="50W_CNC", mods={"QS"}),
dict(boundaries=dict(X=230, Y=223, Z=180), toolhead="50W_CNC", mods={"BK", "QS"}),
dict(boundaries=dict(X=230, Y=225, Z=180), toolhead="200W_CNC", mods={"BK"}),
dict(boundaries=dict(X=230, Y=210, Z=180), toolhead="200W_CNC", mods={"BK", "QS"}),
],
lead=dict(X=20, Y=20, Z=8), # Linear module screw pitch (mm/turn)
),
@@ -119,12 +119,12 @@ SNAPMAKER_MACHINES = dict(
name="Snapmaker 2 A350",
boundaries_table=[
# [1] https://support.snapmaker.com/hc/en-us/articles/20786910972311-FAQ-for-Bracing-Kit-for-Snapmaker-2-0-Linear-Modules#h_01HN4Z7S9WJE5BRT492WR0CKH1
dict( boundaries=dict(X=320, Y=350, Z=275), toolhead="50W_CNC", mods=set() ),
dict( boundaries=dict(X=320, Y=338, Z=275), toolhead="50W_CNC", mods={"BK"} ),
dict( boundaries=dict(X=320, Y=335, Z=275), toolhead="50W_CNC", mods={"QS"} ),
dict( boundaries=dict(X=320, Y=323, Z=275), toolhead="50W_CNC", mods={"BK","QS"} ),
dict( boundaries=dict(X=320, Y=325, Z=275), toolhead="200W_CNC", mods={"BK"} ),
dict( boundaries=dict(X=320, Y=310, Z=275), toolhead="200W_CNC", mods={"BK","QS"} ),
dict(boundaries=dict(X=320, Y=350, Z=275), toolhead="50W_CNC", mods=set()),
dict(boundaries=dict(X=320, Y=338, Z=275), toolhead="50W_CNC", mods={"BK"}),
dict(boundaries=dict(X=320, Y=335, Z=275), toolhead="50W_CNC", mods={"QS"}),
dict(boundaries=dict(X=320, Y=323, Z=275), toolhead="50W_CNC", mods={"BK", "QS"}),
dict(boundaries=dict(X=320, Y=325, Z=275), toolhead="200W_CNC", mods={"BK"}),
dict(boundaries=dict(X=320, Y=310, Z=275), toolhead="200W_CNC", mods={"BK", "QS"}),
],
lead=dict(X=8, Y=8, Z=8), # Linear module screw pitch (mm/turn)
),
@@ -133,12 +133,12 @@ SNAPMAKER_MACHINES = dict(
name="Snapmaker 2 A350T",
boundaries_table=[
# [1] https://support.snapmaker.com/hc/en-us/articles/20786910972311-FAQ-for-Bracing-Kit-for-Snapmaker-2-0-Linear-Modules#h_01HN4Z7S9WJE5BRT492WR0CKH1
dict( boundaries=dict(X=320, Y=350, Z=275), toolhead="50W_CNC", mods=set() ),
dict( boundaries=dict(X=320, Y=338, Z=275), toolhead="50W_CNC", mods={"BK"} ),
dict( boundaries=dict(X=320, Y=335, Z=275), toolhead="50W_CNC", mods={"QS"} ),
dict( boundaries=dict(X=320, Y=323, Z=275), toolhead="50W_CNC", mods={"BK","QS"} ),
dict( boundaries=dict(X=320, Y=325, Z=275), toolhead="200W_CNC", mods={"BK"} ),
dict( boundaries=dict(X=320, Y=310, Z=275), toolhead="200W_CNC", mods={"BK","QS"} ),
dict(boundaries=dict(X=320, Y=350, Z=275), toolhead="50W_CNC", mods=set()),
dict(boundaries=dict(X=320, Y=338, Z=275), toolhead="50W_CNC", mods={"BK"}),
dict(boundaries=dict(X=320, Y=335, Z=275), toolhead="50W_CNC", mods={"QS"}),
dict(boundaries=dict(X=320, Y=323, Z=275), toolhead="50W_CNC", mods={"BK", "QS"}),
dict(boundaries=dict(X=320, Y=325, Z=275), toolhead="200W_CNC", mods={"BK"}),
dict(boundaries=dict(X=320, Y=310, Z=275), toolhead="200W_CNC", mods={"BK", "QS"}),
],
lead=dict(X=20, Y=20, Z=8), # Linear module screw pitch (mm/turn)
),
@@ -146,7 +146,7 @@ SNAPMAKER_MACHINES = dict(
key="Artisan",
name="Snapmaker Artisan",
boundaries_table=[
dict( boundaries=dict(X=400, Y=400, Z=400), toolhead="200W_CNC", mods=set() ),
dict(boundaries=dict(X=400, Y=400, Z=400), toolhead="200W_CNC", mods=set()),
],
lead=dict(X=40, Y=40, Z=8), # Linear module screw pitch (mm/turn)
),
@@ -489,7 +489,7 @@ class Snapmaker(Path.Post.Processor.PostProcessor):
self.values["MACHINE_KEY"] = machine["key"]
self.values["MACHINE_NAME"] = machine["name"]
compatible_toolheads = { bt["toolhead"] for bt in machine["boundaries_table"] }
compatible_toolheads = {bt["toolhead"] for bt in machine["boundaries_table"]}
if args.toolhead:
if args.toolhead not in compatible_toolheads:
@@ -546,28 +546,36 @@ class Snapmaker(Path.Post.Processor.PostProcessor):
self.values["BOUNDARIES"] = args.boundaries
self.values["MACHINE_NAME"] += " Boundaries overide=" + str(args.boundaries)
else:
compatible_modkit_combos = [ bt["mods"] for bt in machine["boundaries_table"] if toolhead["key"] == bt["toolhead"] ]
compatible_modkit_combos = [
bt["mods"]
for bt in machine["boundaries_table"]
if toolhead["key"] == bt["toolhead"]
]
configured_modkits = set()
# Determine which mod kits are requested from the options
for mod_kit in self.values["MOD_KITS_ALL"].values():
if getattr(args, convert_option_to_attr(mod_kit["option_name"])):
configured_modkits.add( mod_kit["key"] )
configured_modkits.add(mod_kit["key"])
self.values["MACHINE_NAME"] += " " + mod_kit["name"]
self.values["MOD_KITS_INSTALLED"].append(mod_kit["key"])
if configured_modkits not in compatible_modkit_combos:
FreeCAD.Console.PrintError(
f"Machine {machine['name']} with toolhead {toolhead['name']}"
+f" is not compatible with modkit {configured_modkits if configured_modkits else None}.\n"
+f" Choose from {compatible_modkit_combos}."
+ f" is not compatible with modkit {configured_modkits if configured_modkits else None}.\n"
+ f" Choose from {compatible_modkit_combos}."
)
flag = False
return (flag, args)
# Update machine dimensions based on installed toolhead and mod kits
boundaries_table_entry_l = [ bt for bt in machine["boundaries_table"] if bt["toolhead"] == toolhead["key"] and bt["mods"] == configured_modkits ]
assert(len(boundaries_table_entry_l) == 1)
boundaries_table_entry_l = [
bt
for bt in machine["boundaries_table"]
if bt["toolhead"] == toolhead["key"] and bt["mods"] == configured_modkits
]
assert len(boundaries_table_entry_l) == 1
boundaries_table_entry = boundaries_table_entry_l[0]
# The deepcopy is necessary to avoid modifying the boundaries in the MACHINES dict.