You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The T filter is only applied to M620, M621, TXXX, M104, and M109 commands.
533
+
534
+
This function can be used in 2 modes, if previous color index is not specified, it always applies the 'new' color which can be either a color swap or color replacement depending on how `newColorIndex` is set.
535
+
536
+
If `previousColorIndex` is supplied and the input string is a M104/M109 tagged as a cooldown, the previous color index is substituted. This should be used for color swap.
537
+
538
+
`previousColorIndex` should not be supplied for color replacement.
539
+
540
+
:param cl: Input string
541
+
:type cl: str
542
+
:param newColorIndex: New color index
543
+
:type newColorIndex: int
544
+
:param previousColorIndex: Previous color index
545
+
:type previousColorIndex: int
546
+
547
+
:return: String after substitution
548
+
:rtype: str
549
+
"""
550
+
526
551
cl=re.sub(M620, f"M620 S{newColorIndex}A", cl)
527
-
cl=re.sub(TOOLCHANGE_T, f"T{newColorIndex}", cl)
552
+
553
+
# substitute the prev color if previousColorIndex specified and line is a M104/M109 command tagged with ;cooldown
Copy file name to clipboardExpand all lines: src/mfm/printing_constants.py
+3Lines changed: 3 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -60,6 +60,9 @@
60
60
# Toolchange
61
61
M620='^M620 S(\d*)A'
62
62
TOOLCHANGE_T='^\s*T(?!255$|1000|1100$)(\d+)'# Do not match T255,T1000,T1100 which are nonstandard by Bambu. We do not change tabbed T commands. There is a bug where the file pointer will jump to the beginning. This regex needs to handle whitespace in beginning to get the initial AMS toolchange
63
+
TOOL_T='T(?!255$|1000|1100$)(\d+)'# Tool parameter. Check if line begins with ;(comment) or (M104/M109) beforehand.
64
+
M104M109='^M10[49].*;cooldown$'# M104 or M109 tagged as ;cooldown
65
+
M104M109_COOLDOWN='^M10[49].*;cooldown$'# M104 or M109 tagged as ;cooldown
0 commit comments