Skip to content

Commit f26dafe

Browse files
committed
add override restore feature feedrate value as config option
1 parent 14279c0 commit f26dafe

File tree

10 files changed

+66
-10
lines changed

10 files changed

+66
-10
lines changed

mfm-configuration-options-setup.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ A map processed with this set of options will have the following appearance:
9494
| -------- | ------- | ------- | ------- |
9595
| `extraPurgePreviousColors` | `[int]` | ≥0 | Tool indices to add extra purging to when that tool is the previous tool in a toolchange. |
9696

97+
### Misc Options
98+
99+
| Key | Value | Cardinality | Description |
100+
| -------- | ------- | ------- | ------- |
101+
| `restorePositionFeedrate` | `int` or `-1` | 1 | The feedrate to use when resuming between features. No value or `-1` will use the existing printing state feedrate when resuming. A high feedrate should be used for multi-nozzle printers. Feedrate is in mm/min. |
102+
97103
### Feature Types (Extrusion Roles)
98104

99105
3D printed Feature Types are different categories used to define printing order and settings of printing travel and extrusion movements.

minimal_toolchanges/prusa-xl-series.gcode

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
; MFM MINIMAL XL TOOLCHANGE START
2-
G1 E-15.37656 F2100
3-
; Filament-specific end gcode
42
M104 S70 TYY ; set temperature ;cooldown
3+
M104 S170 TXX ; start heating up new nozzle
54

6-
; Change ToolYY -> ToolXX (layer 0)
5+
G1 E-20 F2100 ; retract
6+
7+
; Change ToolYY -> ToolXX (MFM inserted)
78
G1 F21000
8-
P0 S1 L2 D0
9+
P0 S1 M1 L2 D0 ; Park tool. Remove M1 to use tool mapping
910
;
1011
M109 S240 TXX ; YOUR PRINTING TEMP HERE
11-
TXX S1 L0 D0
12+
TXX M1 S1 L0 D0 ; Toolchange Remove M1 to use tool mapping
1213

1314

1415
M900 K0.05 ; Filament gcode ; YOUR CUSTOM LINEAR ADVANCE K VALUE HERE

premade_options/1to1-multinozzle.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"modelToRealWorldDefaultUnits": 1,
3+
"modelOneToNVerticalScale": 1,
4+
"modelSeaLevelBaseThickness": 0,
5+
"realWorldIsolineElevationInterval": 10,
6+
"realWorldIsolineElevationStart": 5,
7+
"realWorldIsolineElevationEnd": 50,
8+
"modelIsolineHeight": 1,
9+
"isolineColorIndex": 2,
10+
"isolineColorFeatureTypes": ["Outer wall", "External perimeter"],
11+
"realWorldElevationReplacementColorStart": 30,
12+
"realWorldElevationReplacementColorEnd": 60,
13+
"replacementColorIndex": 3,
14+
"replacementOriginalColorIndex": 0,
15+
"extraPurgePreviousColors": [],
16+
"restorePositionFeedrate": 24000
17+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"modelToRealWorldDefaultUnits": 1000,
3+
"modelOneToNVerticalScale": 500000,
4+
"modelSeaLevelBaseThickness": 0.1,
5+
"realWorldIsolineElevationInterval": 500,
6+
"realWorldIsolineElevationStart": 200,
7+
"realWorldIsolineElevationEnd": 5000,
8+
"modelIsolineHeight": 0.5,
9+
"isolineColorIndex": 2,
10+
"isolineColorFeatureTypes": ["Outer wall", "Inner wall", "External perimeter", "Perimeter"],
11+
"realWorldElevationReplacementColorStart": 3650,
12+
"realWorldElevationReplacementColorEnd": 9000,
13+
"replacementColorIndex": 3,
14+
"replacementOriginalColorIndex": 0,
15+
"extraPurgePreviousColors": [2],
16+
"restorePositionFeedrate": 24000
17+
}

src/gui.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,11 @@ def postProcessTask():
314314
mfmConfig[CONFIG_REPLACEMENT_COLORS] = replacementColors
315315
mfmConfig[CONFIG_EXTRA_PURGE_COLORS] = extraPurgePrevColors
316316
mfmConfig[CONFIG_LINE_ENDING] = lineEndingFlavor.value
317+
try:
318+
mfmConfig[CONFIG_RESTORE_POSITION_FEEDRATE] = int(userOptions[RESTORE_POSITION_FEEDRATE])
319+
except (KeyError, ValueError) as e:
320+
print(f"No RESTORE_POSITION_FEEDRATE found in config.")
321+
mfmConfig[CONFIG_RESTORE_POSITION_FEEDRATE] = -1
317322
mfmConfig[CONFIG_APP_NAME] = APP_NAME
318323
mfmConfig[CONFIG_APP_VERSION] = APP_VERSION
319324

src/mfm/app_constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
APP_NAME_ABBREVIATION = 'MFM'
22
APP_NAME = f'3D G-code Map Feature Modifier ({APP_NAME_ABBREVIATION})'
3-
APP_VERSION = '1.6.8'
3+
APP_VERSION = '1.6.9'

src/mfm/configuration.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626

2727
EXTRA_PURGE_PREV_COLORS = 'extraPurgePreviousColors'
2828

29+
RESTORE_POSITION_FEEDRATE = 'restorePositionFeedrate'
30+
2931
periodicColorRequiredOptions = [
3032
MODEL_TO_REAL_WORLD_DEFAULT_UNITS,
3133
MODEL_ONE_TO_N_VERTICAL_SCALE,

src/mfm/map_post_process.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ def substituteNewColor(cl, newColorIndex: int):
529529
return cl
530530

531531
# Write out a new feature
532-
def startNewFeature(gf: str, ps: PrintState, f: typing.TextIO, out: typing.TextIO, cl: str, toolchangeBareFile: str, pcs: list[PeriodicColor], curFeature: Feature, curFeatureIdx: int):
532+
def startNewFeature(gf: str, ps: PrintState, f: typing.TextIO, out: typing.TextIO, cl: str, toolchangeBareFile: str, pcs: list[PeriodicColor], curFeature: Feature, curFeatureIdx: int, resFeedrate: int):
533533
# remember if last line from last feature was supposed to be skipped
534534
prevFeatureSkip = False
535535
if ps.skipWrite:
@@ -572,8 +572,10 @@ def startNewFeature(gf: str, ps: PrintState, f: typing.TextIO, out: typing.TextI
572572
restoreCmd += f" Y{curFeature.startPosition.Y}"
573573
getattr(curFeature.startPosition, "Z")
574574
restoreCmd += f" Z{curFeature.startPosition.Z}"
575-
getattr(curFeature.startPosition, "F")
576-
restoreCmd += f" F{curFeature.startPosition.FTravel}"
575+
if resFeedrate == -1:
576+
getattr(curFeature.startPosition, "F")
577+
resFeedrate = curFeature.startPosition.FTravel
578+
restoreCmd += f" F{resFeedrate}"
577579
except AttributeError as e:
578580
print(f"Restore position did not find axis {e} yet")
579581
if len(restoreCmd) > len(MOVEMENT_G0):
@@ -775,7 +777,7 @@ def process(configuration: MFMConfiguration, inputFP: typing.TextIO, outputFP: t
775777
statusQueue.put(item=item)
776778

777779
f.seek(curFeature.start, os.SEEK_SET) # Seek to the start of top feature in the feature list
778-
startNewFeature(configuration[CONFIG_GCODE_FLAVOR], currentPrint, f, out, cl, configuration[CONFIG_TOOLCHANGE_MINIMAL_FILE], configuration[CONFIG_PERIODIC_COLORS], curFeature, curFeatureIdx)
780+
startNewFeature(configuration[CONFIG_GCODE_FLAVOR], currentPrint, f, out, cl, configuration[CONFIG_TOOLCHANGE_MINIMAL_FILE], configuration[CONFIG_PERIODIC_COLORS], curFeature, curFeatureIdx, configuration[CONFIG_RESTORE_POSITION_FEEDRATE])
779781

780782
# Start skip if feature.toolchange is reached and we marked feature as needing original toolchange skipped
781783
if curFeature and curFeature.skipType == SkipType.FEATURE_ORIG_TOOLCHANGE_AND_WIPE_END:

src/mfm/printing_constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
CONFIG_REPLACEMENT_COLORS = 'CONFIG_REPLACEMENT_COLORS'
88
CONFIG_EXTRA_PURGE_COLORS = 'CONFIG_EXTRA_PURGE_COLORS'
99
CONFIG_LINE_ENDING = 'CONFIG_LINE_ENDING'
10+
CONFIG_RESTORE_POSITION_FEEDRATE = 'CONFIG_RESTORE_POSITION_FEEDRATE'
1011
CONFIG_APP_NAME = 'CONFIG_APP_NAME'
1112
CONFIG_APP_VERSION = 'CONFIG_APP_VERSION'
1213

src/mfm_cmd.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,11 @@ def worker():
171171
mfmConfig[CONFIG_REPLACEMENT_COLORS] = replacementColors
172172
mfmConfig[CONFIG_EXTRA_PURGE_COLORS] = extraPurgePrevColors
173173
mfmConfig[CONFIG_LINE_ENDING] = lineEndingFlavor.value
174+
try:
175+
mfmConfig[CONFIG_RESTORE_POSITION_FEEDRATE] = int(userOptions[RESTORE_POSITION_FEEDRATE])
176+
except (KeyError, ValueError) as e:
177+
print(f"No RESTORE_POSITION_FEEDRATE found in config.")
178+
mfmConfig[CONFIG_RESTORE_POSITION_FEEDRATE] = -1
174179
mfmConfig[CONFIG_APP_NAME] = APP_NAME
175180
mfmConfig[CONFIG_APP_VERSION] = APP_VERSION
176181

0 commit comments

Comments
 (0)