Skip to content

Commit 3373cdf

Browse files
committed
feat: add setting for layer start randomization
1 parent b0891b2 commit 3373cdf

File tree

3 files changed

+33
-9
lines changed

3 files changed

+33
-9
lines changed

settings.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ slicing:
109109
originz: 0.0
110110
overlapping_infill_percentage: 100.0
111111
overlapping_infill_lid_percentage: 60.0
112+
random_layer_start: false
112113
planes_contact_with_nozzle: ""
113114
print_speed: 50
114115
print_speed_layer1: 50

src/locales.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ class Locale:
9191
GCodeLoadingProgress = "GCode loading is in progress..."
9292
SupportsSettings = "Supports settings"
9393
MaterialShrinkage = "Material shrinkage, %:"
94+
RandomLayerStart = "Random layer start"
9495
FlowRate = "Flow rate, %:"
9596
PressureAdvance = "Pressure advance"
9697
PressureAdvanceValue = "Pressure advance value"
@@ -255,6 +256,7 @@ def __init__(self, **entries):
255256
GCodeLoadingProgress="Загрузка GCode в прогрессе...",
256257
SupportsSettings="Настройки поддержек",
257258
MaterialShrinkage="Величина усадки материала, %:",
259+
RandomLayerStart="Спрятать шов",
258260
FlowRate="Коэффициент потока расплава, %:",
259261
PressureAdvance="Управление давлением расплава",
260262
PressureAdvanceValue="Коэффициент управления давлением",

src/settings_widget.py

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ class SettingsWidget(QWidget):
6262
"flow_rate", # Коэффициент потока расплава
6363
"pressure_advance_on",
6464
"pressure_advance_rate",
65+
"random_layer_start",
6566
# TODO: add separate dummy setting to mark the beginning of supports settings
6667
"supports_on",
6768
"support_density",
@@ -127,6 +128,7 @@ def __init__(self, parent=None, settings_provider: callable = None):
127128
"retraction_speed": self.locale.RetractionSpeed,
128129
"retraction_compensation": self.locale.RetractCompensationAmount,
129130
"material_shrinkage": self.locale.MaterialShrinkage,
131+
"random_layer_start": self.locale.RandomLayerStart,
130132
# TODO: add separate dummy setting to mark the beginning of supports settings
131133
"supports_on": self.locale.SupportsOn,
132134
"support_density": self.locale.SupportDensity,
@@ -888,21 +890,21 @@ def on_change():
888890
elif name == "retraction_on":
889891
self.ensure_sett("slicing.retraction_on")
890892

891-
retraction_on_label = QLabel(self.locale.Retraction)
892-
retraction_on_box = QCheckBox()
893+
rls_on_label = QLabel(self.locale.Retraction)
894+
rls_on_box = QCheckBox()
893895
if self.sett().slicing.retraction_on:
894-
retraction_on_box.setCheckState(QtCore.Qt.Checked)
895-
self.panel.addWidget(retraction_on_label, self.next_row, 1)
896-
self.panel.addWidget(retraction_on_box, self.cur_row, 2, 1, self.col2_cells)
896+
rls_on_box.setCheckState(QtCore.Qt.Checked)
897+
self.panel.addWidget(rls_on_label, self.next_row, 1)
898+
self.panel.addWidget(rls_on_box, self.cur_row, 2, 1, self.col2_cells)
897899

898900
def on_change():
899-
self.sett().slicing.retraction_on = retraction_on_box.isChecked()
901+
self.sett().slicing.retraction_on = rls_on_box.isChecked()
900902

901-
retraction_on_box.stateChanged.connect(on_change)
903+
rls_on_box.stateChanged.connect(on_change)
902904

903905
self.__elements[name] = {
904-
"label": retraction_on_label,
905-
"checkbox": retraction_on_box,
906+
"label": rls_on_label,
907+
"checkbox": rls_on_box,
906908
}
907909

908910
elif name == "retraction_distance":
@@ -1005,6 +1007,25 @@ def on_change():
10051007
"edit": material_shrinkage_value,
10061008
}
10071009

1010+
elif name == "random_layer_start":
1011+
self.ensure_sett("slicing.random_layer_start")
1012+
1013+
rls_on_label = QLabel(self.locale.RandomLayerStart)
1014+
rls_on_box = QCheckBox()
1015+
if self.sett().slicing.random_layer_start:
1016+
rls_on_box.setCheckState(QtCore.Qt.Checked)
1017+
self.panel.addWidget(rls_on_label, self.next_row, 1)
1018+
self.panel.addWidget(rls_on_box, self.cur_row, 2, 1, self.col2_cells)
1019+
1020+
def on_change():
1021+
self.sett().slicing.random_layer_start = rls_on_box.isChecked()
1022+
1023+
rls_on_box.stateChanged.connect(on_change)
1024+
1025+
self.__elements[name] = {
1026+
"label": rls_on_label,
1027+
"checkbox": rls_on_box,
1028+
}
10081029
elif name == "flow_rate":
10091030
self.ensure_sett("slicing.flow_rate")
10101031

0 commit comments

Comments
 (0)