Skip to content

Commit

Permalink
Make acceleration/jerk_enabled control bead modes as well
Browse files Browse the repository at this point in the history
This fits more with the parenting structure
  • Loading branch information
shirleydu committed Jan 16, 2025
1 parent e75c696 commit 5b61a3e
Showing 1 changed file with 29 additions and 26 deletions.
55 changes: 29 additions & 26 deletions plugins/MakerbotWriter/MakerbotWriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,37 +258,42 @@ def _getMeta(self, root_nodes: List[SceneNode]) -> Tuple[Dict[str, any], str]:
accel_overrides = meta["accel_overrides"] = {}
bead_mode_overrides = accel_overrides["bead_mode"] = {}

if global_stack.getProperty('acceleration_enabled', 'value'):
accel_enabled = global_stack.getProperty('acceleration_enabled', 'value')

if accel_enabled:
global_accel_setting = global_stack.getProperty('acceleration_print', 'value')
accel_overrides["rate_mm_per_s_sq"] = {
"x": global_accel_setting,
"y": global_accel_setting
}
if global_stack.getProperty('acceleration_travel_enabled', 'value'):
travel_accel_setting = global_stack.getProperty('acceleration_travel', 'value')
bead_mode_overrides['Travel Move'] = {
"rate_mm_per_s_sq": {
"x": travel_accel_setting,
"y": travel_accel_setting

if global_stack.getProperty('acceleration_travel_enabled', 'value'):
travel_accel_setting = global_stack.getProperty('acceleration_travel', 'value')
bead_mode_overrides['Travel Move'] = {
"rate_mm_per_s_sq": {
"x": travel_accel_setting,
"y": travel_accel_setting
}
}
}

if global_stack.getProperty('jerk_enabled', 'value'):
jerk_enabled = global_stack.getProperty('jerk_enabled', 'value')
if jerk_enabled:
global_jerk_setting = global_stack.getProperty('jerk_print', 'value')
accel_overrides["max_speed_change_mm_per_s"] = {
"x": global_jerk_setting,
"y": global_jerk_setting
}
if global_stack.getProperty('jerk_travel_enabled', 'value'):
travel_jerk_setting = global_stack.getProperty('jerk_travel', 'value')
if 'Travel Move' not in bead_mode_overrides:
bead_mode_overrides['Travel Move' ] = {}
bead_mode_overrides['Travel Move'].update({
"max_speed_change_mm_per_s": {
"x": travel_jerk_setting,
"y": travel_jerk_setting
}
})

if global_stack.getProperty('jerk_travel_enabled', 'value'):
travel_jerk_setting = global_stack.getProperty('jerk_travel', 'value')
if 'Travel Move' not in bead_mode_overrides:
bead_mode_overrides['Travel Move' ] = {}
bead_mode_overrides['Travel Move'].update({
"max_speed_change_mm_per_s": {
"x": travel_jerk_setting,
"y": travel_jerk_setting
}
})


# Get bead mode settings per extruder
Expand All @@ -304,20 +309,18 @@ def _getMeta(self, root_nodes: List[SceneNode]) -> Tuple[Dict[str, any], str]:
}
for idx, extruder in enumerate(extruders):
for bead_mode_setting, bead_mode_tag in available_bead_modes.items():
if bead_mode_tag == "":
continue
ext_specific_tag = "%s_%s" % (bead_mode_tag, idx)
accel_val = extruder.getProperty('acceleration_%s' % bead_mode_setting, 'value')
jerk_val = extruder.getProperty('jerk_%s' % bead_mode_setting, 'value')
if accel_val != 0 or jerk_val != 0:
if accel_enabled or jerk_enabled:
bead_mode_overrides[ext_specific_tag] = {}

if accel_val != 0:
if accel_enabled:
accel_val = extruder.getProperty('acceleration_%s' % bead_mode_setting, 'value')
bead_mode_overrides[ext_specific_tag]["rate_mm_per_s_sq"] = {
"x": accel_val,
"y": accel_val
}
if jerk_val != 0:
if jerk_enabled:
jerk_val = extruder.getProperty('jerk_%s' % bead_mode_setting, 'value')
bead_mode_overrides[ext_specific_tag][ "max_speed_change_mm_per_s"] = {
"x": jerk_val,
"y": jerk_val
Expand Down

0 comments on commit 5b61a3e

Please sign in to comment.