change default tool change methods for fdm

This commit is contained in:
Stewart Allen 2025-02-18 18:37:02 -05:00
commit a7363732ac
43 changed files with 150 additions and 270 deletions

View file

@ -34,6 +34,7 @@
* `B` multi-extruder rendering of raft fails to offset the rest of the print
* `B` multi-extruder purge blocks fail to generate properly for rafts
* `F` add scarf seams
* `F` add 'random' and 'seam' start point options
* `F` convert ranges to z offsets while continuing to show layer #
* `F` support pillar top/bottom should conform to part
@ -46,7 +47,7 @@
* `F` calculate filament use per extruder per print
* `F` expand internal supporting flats / solids before projection (threshold)
* `P` reduce fan speed and extrusion factor for bridges
* `P` reduce fan speed, feed rate, and extrusion factor for bridges
* `P` auto purge pillars when quick layers are detected for extra cooling
* `P` extruder + filament max flow rate cap in planner
* `P` solid fill the tops of supports for down facing flats
@ -70,15 +71,13 @@
* `B` roughing leave stock should also increase Z slightly (sqrt(2) * leave)
* `B` rapid moves should be max of terrain zmax and last cut layer height (roughing)
* `B` in indexed stock mode, stock should rotate with indexing
* `B` feed rate for next tool set before tool change (push/pop feed rates?)
* `B` tab cuts cause loss of direction, parenting, depth, and it's hard to fix
* `B` tabs do not properly track widget mirror events
* `B` tabs are not cut to exact height
* `B` first rough step too far down in certain circumstances?
* `B` need to force cut line at synthetic z bottom (midlines, etc)
* `B` contour does not honor clip to stock
* `F` add lathe step down to eliminate the need for roughing
* `F` allow import, rotation, scaling of stock
* `F` get gcode coordinates off a part with point/click or hover?
* `F` include tools in default devices (Carvera)
@ -86,17 +85,13 @@
* `F` add {progress} substitution and maybe {time-remaining} if can be calc'd
* `F` import and follow 2D paths (conformed like pocket contours)
* `F` add user-defined origin (issue #28)
* `F` add custom gcode operation for things like injecting pauses
* `F` all ops should allow limit and milling direction / ease down overrides
* `F` drill op should allow selecting holes >= current tool
* `F` intelligently turn circle hole pocket clear into spiral down
* `F` add option for op-major ordering (instead of part major)
* `F` add `plunge max` to contouring that can override z feed limit
* `F` add lead-in milling (requires adding clamp / no go areas)
* `F` add linear clearing strategy
* `F` add adaptive clearing strategy
* `F` add ease-down support to trace op
* `F` add climb/conventional into each operation
* `F` add support for tapered ball mills
* `F` change color of line selection in trace op when not a closed poly
* `F` limit cut depth to flute length of selected tool (or warn)

View file

@ -28,14 +28,12 @@
"nozzle": 0.4,
"filament": 1.75,
"offset_x": 0,
"offset_y": 0,
"select": [ "T0" ]
"offset_y": 0
},{
"nozzle": 0.4,
"filament": 1.75,
"offset_x": 30,
"offset_y": 0,
"select": [ "T1" ]
"offset_y": 0
}
],
"cmd":{

View file

@ -28,14 +28,12 @@
"nozzle": 0.4,
"filament": 1.75,
"offset_x": 0,
"offset_y": 0,
"select": [ "T0" ]
"offset_y": 0
},{
"nozzle": 0.4,
"filament": 1.75,
"offset_x": 30,
"offset_y": 0,
"select": [ "T1" ]
"offset_y": 0
}
],
"cmd":{

View file

@ -38,8 +38,7 @@
"nozzle": 0.4,
"filament": 1.75,
"offset_x": 0,
"offset_y": 0,
"select": [ "T0" ]
"offset_y": 0
}
],
"cmd":{

View file

@ -58,10 +58,6 @@
{
"extFilament": 1.75,
"extNozzle": 0.4,
"extSelect": [
"T0"
],
"extDeselect": [],
"extOffsetX": 0,
"extOffsetY": 0
}

View file

@ -68,10 +68,6 @@
{
"extFilament": 1.75,
"extNozzle": 0.4,
"extSelect": [
"T0"
],
"extDeselect": [],
"extOffsetX": 0,
"extOffsetY": 0
}

View file

@ -39,8 +39,7 @@
"nozzle": 0.4,
"filament": 1.75,
"offset_x": 0,
"offset_y": 0,
"select": [ "T0" ]
"offset_y": 0
}
],
"cmd":{

View file

@ -35,8 +35,7 @@
"nozzle": 0.4,
"filament": 1.75,
"offset_x": 0,
"offset_y": 0,
"select": [ "T0" ]
"offset_y": 0
}
],
"cmd":{

View file

@ -31,6 +31,7 @@
],
"gcodePre": [
"; total layer number: {layers}",
"; model label id: {model_labels}",
";; PREAMBLE",
";; DEFINE BAMBU-AMS 0,1,2,3",
"; ===== HEADER ====================================",
@ -602,94 +603,85 @@
"M18 X Y Z ; Disable motors",
"M73 P100 R0 ; Set progress to 100%"
],
"gcodeChange": [
"; BEGIN tool change from {last_tool} to {tool}",
"M620 S{tool}A ; prepare tool change",
"M204 S9000 ; Set acceleration to 9000 mm/s^2",
"M620.11 S0 ; Reset filament retraction state",
"M400 ; wait for moves to complete",
"M620.1 E F187 T240 ; set purge rate 187 temp 240",
"T{tool} ; initiate tool change",
"M620.1 E F374 T240 ; set purge rate 374 temp 240",
"M620.11 S0 ; Reset filament retraction state",
"G92 E0 ; reset extruder position",
"M400 ; wait for moves to complete",
" ; -- PURGE --",
"M109 S240 ; Set nozzle temperature to 240°C",
"G1 E23.7 F187 ; Extrude 23.7mm of filament at flowrate 187",
"G1 E0.914611 F50 ; Pulsatile extrusion",
"G1 E10.518 F187 ; Continue extrusion at flowrate 187",
"G1 E0.914611 F50 ; Pulsatile extrusion",
"G1 E10.518 F374 ; Continue extrusion at flowrate 374",
"G1 E0.914611 F50 ; Pulsatile extrusion",
"G1 E10.518 F374 ; Continue extrusion at flowrate 374",
"G1 E0.914611 F50 ; Pulsatile extrusion",
"G1 E10.518 F374 ; Continue extrusion at flowrate 374",
"G1 E-2 F1800 ; Retract filament by 2mm",
"G1 E2 F300 ; Recover retraction slowly",
"M400 ; Wait for all movements to complete",
"M109 S{temp} ; Set nozzle temperature back to print temp",
" ; -- SHAKE --",
"M106 P1 S255 ; Turn on nozzle cooling fan to full speed",
"M400 S3 ; Wait for all movements to complete",
"G1 X70 F5000 ; Move to X70",
"G1 X90 F3000 ; Move to X90",
"G1 Y255 F4000 ; Move to Y255",
"G1 X105 F5000 ; Move to X105",
"G1 Y265 ; Move to Y265",
"G1 X70 F10000 ; Rapid move to X70",
"G1 X100 F5000 ; Move to X100",
"G1 X70 F10000 ; Rapid move back to X70",
"G1 X100 F5000 ; Move to X100",
"G1 X70 F10000 ; Shake filament residue",
"G1 X80 F15000",
"G1 X60",
"G1 X80",
"G1 X60",
"G1 X80 ; Shake to put down garbage",
"G1 X100 F5000 ; Move to X100",
"G1 X165 F15000 ; Wipe and shake",
"G1 Y256 ; Move Y aside to prevent collision",
"M400 ; Wait for all movements to complete",
"M204 S10000 ; Set acceleration to 10000 mm/s^2",
"M621 S{tool}A ; complete tool change",
"; END tool change"
],
"gcodeProc": "",
"gcodeFExt": "gcode",
"extruders": [
{
"extFilament": 1.75,
"extNozzle": 0.4,
"extSelect": [
"; BEGIN tool change from {last_tool} to {tool}",
"M620 S{tool}A ; prepare tool change",
"M204 S9000 ; Set acceleration to 9000 mm/s^2",
"M620.11 S0 ; Reset filament retraction state",
"M400 ; wait for moves to complete",
"M620.1 E F187 T240 ; set purge rate 187 temp 240",
"T{tool} ; initiate tool change",
"M620.1 E F374 T240 ; set purge rate 374 temp 240",
"M620.11 S0 ; Reset filament retraction state",
"G92 E0 ; reset extruder position",
"M400 ; wait for moves to complete",
" ; -- PURGE --",
"M109 S240 ; Set nozzle temperature to 240°C",
"G1 E23.7 F187 ; Extrude 23.7mm of filament at flowrate 187",
"G1 E0.914611 F50 ; Pulsatile extrusion",
"G1 E10.518 F187 ; Continue extrusion at flowrate 187",
"G1 E0.914611 F50 ; Pulsatile extrusion",
"G1 E10.518 F374 ; Continue extrusion at flowrate 374",
"G1 E0.914611 F50 ; Pulsatile extrusion",
"G1 E10.518 F374 ; Continue extrusion at flowrate 374",
"G1 E0.914611 F50 ; Pulsatile extrusion",
"G1 E10.518 F374 ; Continue extrusion at flowrate 374",
"G1 E-2 F1800 ; Retract filament by 2mm",
"G1 E2 F300 ; Recover retraction slowly",
"M400 ; Wait for all movements to complete",
"M109 S{temp} ; Set nozzle temperature back to print temp",
" ; -- SHAKE --",
"M106 P1 S255 ; Turn on nozzle cooling fan to full speed",
"M400 S3 ; Wait for all movements to complete",
"G1 X70 F5000 ; Move to X70",
"G1 X90 F3000 ; Move to X90",
"G1 Y255 F4000 ; Move to Y255",
"G1 X105 F5000 ; Move to X105",
"G1 Y265 ; Move to Y265",
"G1 X70 F10000 ; Rapid move to X70",
"G1 X100 F5000 ; Move to X100",
"G1 X70 F10000 ; Rapid move back to X70",
"G1 X100 F5000 ; Move to X100",
"G1 X70 F10000 ; Shake filament residue",
"G1 X80 F15000",
"G1 X60",
"G1 X80",
"G1 X60",
"G1 X80 ; Shake to put down garbage",
"G1 X100 F5000 ; Move to X100",
"G1 X165 F15000 ; Wipe and shake",
"G1 Y256 ; Move Y aside to prevent collision",
"M400 ; Wait for all movements to complete",
"M204 S10000 ; Set acceleration to 10000 mm/s^2",
"M621 S{tool}A ; complete tool change",
"; END tool change"
],
"extOffsetX": 0,
"extOffsetY": 0,
"extDeselect": []
"extOffsetY": 0
},
{
"extFilament": 1.75,
"extNozzle": 0.4,
"extSelect": [],
"extOffsetX": 0,
"extOffsetY": 0,
"extDeselect": []
"extOffsetY": 0
},
{
"extFilament": 1.75,
"extNozzle": 0.4,
"extSelect": [],
"extOffsetX": 0,
"extOffsetY": 0,
"extDeselect": []
"extOffsetY": 0
},
{
"extFilament": 1.75,
"extNozzle": 0.4,
"extSelect": [
"T3"
],
"extOffsetX": 0,
"extOffsetY": 0,
"extDeselect": []
"extOffsetY": 0
}
],
"new": false,

View file

@ -31,6 +31,7 @@
],
"gcodePre": [
"; total layer number: {layers}",
"; model label id: {model_labels}",
";; PREAMBLE",
";; DEFINE BAMBU-AMS 0,1,2,3",
"; ===== HEADER ====================================",
@ -313,92 +314,85 @@
"M17 X0.8 Y0.8 Z0.5 ; Lower motor current to 45% power",
"M73 P100 R0 ; Set progress to 100% with 0 remaining time"
],
"gcodeChange": [
"; BEGIN tool change from {last_tool} to {tool}",
"M620 S{tool}A ; prepare tool change",
"M204 S9000 ; Set acceleration to 9000 mm/s^2",
"M620.11 S0 ; Reset filament retraction state",
"M400 ; wait for moves to complete",
"M620.1 E F187 T240 ; set purge rate 187 temp 240",
"T{tool} ; initiate tool change",
"M620.1 E F374 T240 ; set purge rate 374 temp 240",
"M620.11 S0 ; Reset filament retraction state",
"G92 E0 ; reset extruder position",
"M400 ; wait for moves to complete",
" ; -- PURGE --",
"M109 S240 ; Set nozzle temperature to 240°C",
"G1 E23.7 F187 ; Extrude 23.7mm of filament at flowrate 187",
"G1 E0.914611 F50 ; Pulsatile extrusion",
"G1 E10.518 F187 ; Continue extrusion at flowrate 187",
"G1 E0.914611 F50 ; Pulsatile extrusion",
"G1 E10.518 F374 ; Continue extrusion at flowrate 374",
"G1 E0.914611 F50 ; Pulsatile extrusion",
"G1 E10.518 F374 ; Continue extrusion at flowrate 374",
"G1 E0.914611 F50 ; Pulsatile extrusion",
"G1 E10.518 F374 ; Continue extrusion at flowrate 374",
"G1 E-2 F1800 ; Retract filament by 2mm",
"G1 E2 F300 ; Recover retraction slowly",
"M400 ; Wait for all movements to complete",
"M109 S{temp} ; Set nozzle temperature back to print temp",
" ; -- SHAKE --",
"M106 P1 S255 ; Turn on nozzle cooling fan to full speed",
"M400 S3 ; Wait for all movements to complete",
"G1 X70 F5000 ; Move to X70",
"G1 X90 F3000 ; Move to X90",
"G1 Y255 F4000 ; Move to Y255",
"G1 X105 F5000 ; Move to X105",
"G1 Y265 ; Move to Y265",
"G1 X70 F10000 ; Rapid move to X70",
"G1 X100 F5000 ; Move to X100",
"G1 X70 F10000 ; Rapid move back to X70",
"G1 X100 F5000 ; Move to X100",
"G1 X70 F10000 ; Shake filament residue",
"G1 X80 F15000",
"G1 X60",
"G1 X80",
"G1 X60",
"G1 X80 ; Shake to put down garbage",
"G1 X100 F5000 ; Move to X100",
"G1 X165 F15000 ; Wipe and shake",
"G1 Y256 ; Move Y aside to prevent collision",
"M400 ; Wait for all movements to complete",
"M204 S10000 ; Set acceleration to 10000 mm/s^2",
"M621 S{tool}A ; complete tool change",
"; END tool change"
],
"gcodeProc": "",
"gcodeFExt": "gcode",
"extruders": [
{
"extFilament": 1.75,
"extNozzle": 0.4,
"extSelect": [
"; BEGIN tool change from {last_tool} to {tool}",
"M620 S{tool}A ; prepare tool change",
"M204 S9000 ; Set acceleration to 9000 mm/s^2",
"M620.11 S0 ; Reset filament retraction state",
"M400 ; wait for moves to complete",
"M620.1 E F187 T240 ; set purge rate 187 temp 240",
"T{tool} ; initiate tool change",
"M620.1 E F374 T240 ; set purge rate 374 temp 240",
"M620.11 S0 ; Reset filament retraction state",
"G92 E0 ; reset extruder position",
"M400 ; wait for moves to complete",
" ; -- PURGE --",
"M109 S240 ; Set nozzle temperature to 240°C",
"G1 E23.7 F187 ; Extrude 23.7mm of filament at flowrate 187",
"G1 E0.914611 F50 ; Pulsatile extrusion",
"G1 E10.518 F187 ; Continue extrusion at flowrate 187",
"G1 E0.914611 F50 ; Pulsatile extrusion",
"G1 E10.518 F374 ; Continue extrusion at flowrate 374",
"G1 E0.914611 F50 ; Pulsatile extrusion",
"G1 E10.518 F374 ; Continue extrusion at flowrate 374",
"G1 E0.914611 F50 ; Pulsatile extrusion",
"G1 E10.518 F374 ; Continue extrusion at flowrate 374",
"G1 E-2 F1800 ; Retract filament by 2mm",
"G1 E2 F300 ; Recover retraction slowly",
"M400 ; Wait for all movements to complete",
"M109 S{temp} ; Set nozzle temperature back to print temp",
" ; -- SHAKE --",
"M106 P1 S255 ; Turn on nozzle cooling fan to full speed",
"M400 S3 ; Wait for all movements to complete",
"G1 X70 F5000 ; Move to X70",
"G1 X90 F3000 ; Move to X90",
"G1 Y255 F4000 ; Move to Y255",
"G1 X105 F5000 ; Move to X105",
"G1 Y265 ; Move to Y265",
"G1 X70 F10000 ; Rapid move to X70",
"G1 X100 F5000 ; Move to X100",
"G1 X70 F10000 ; Rapid move back to X70",
"G1 X100 F5000 ; Move to X100",
"G1 X70 F10000 ; Shake filament residue",
"G1 X80 F15000",
"G1 X60",
"G1 X80",
"G1 X60",
"G1 X80 ; Shake to put down garbage",
"G1 X100 F5000 ; Move to X100",
"G1 X165 F15000 ; Wipe and shake",
"G1 Y256 ; Move Y aside to prevent collision",
"M400 ; Wait for all movements to complete",
"M204 S10000 ; Set acceleration to 10000 mm/s^2",
"M621 S{tool}A ; complete tool change",
"; END tool change"
],
"extOffsetX": 0,
"extOffsetY": 0,
"extDeselect": []
"extOffsetY": 0
},
{
"extFilament": 1.75,
"extNozzle": 0.4,
"extSelect": [],
"extOffsetX": 0,
"extOffsetY": 0,
"extDeselect": []
"extOffsetY": 0
},
{
"extFilament": 1.75,
"extNozzle": 0.4,
"extSelect": [],
"extOffsetX": 0,
"extOffsetY": 0,
"extDeselect": []
"extOffsetY": 0
},
{
"extFilament": 1.75,
"extNozzle": 0.4,
"extSelect": [],
"extOffsetX": 0,
"extOffsetY": 0,
"extDeselect": []
"extOffsetY": 0
}
],
"new": false,

View file

@ -34,8 +34,7 @@
"nozzle": 0.4,
"filament": 1.75,
"offset_x": 0,
"offset_y": 0,
"select": [ "T0" ]
"offset_y": 0
}
],
"cmd":{

View file

@ -35,8 +35,7 @@
"nozzle": 0.4,
"filament": 1.75,
"offset_x": 0,
"offset_y": 0,
"select": [ "T0" ]
"offset_y": 0
}
],
"cmd":{

View file

@ -36,8 +36,7 @@
"nozzle": 0.4,
"filament": 1.75,
"offset_x": 0,
"offset_y": 0,
"select": [ "T0" ]
"offset_y": 0
}
],
"cmd":{

View file

@ -62,10 +62,6 @@
{
"extFilament": 1.75,
"extNozzle": 0.4,
"extSelect": [
"T0"
],
"extDeselect": [],
"extOffsetX": 0,
"extOffsetY": 0
}

View file

@ -22,8 +22,7 @@
"nozzle": 0.4,
"filament": 1.75,
"offset_x": 0,
"offset_y": 0,
"select": [ "T0" ]
"offset_y": 0
}
],
"cmd":{

View file

@ -22,8 +22,7 @@
"nozzle": 0.4,
"filament": 1.75,
"offset_x": 0,
"offset_y": 0,
"select": [ "T0" ]
"offset_y": 0
}
],
"cmd":{

View file

@ -38,10 +38,6 @@
{
"extFilament": 1.75,
"extNozzle": 0.4,
"extSelect": [
"T0"
],
"extDeselect": [],
"extOffsetX": 0,
"extOffsetY": 0
}

View file

@ -22,8 +22,7 @@
"nozzle": 0.4,
"filament": 1.75,
"offset_x": 0,
"offset_y": 0,
"select": [ "T0" ]
"offset_y": 0
}
],
"cmd":{

View file

@ -51,10 +51,6 @@
{
"extFilament": 1.75,
"extNozzle": 0.4,
"extSelect": [
"T0"
],
"extDeselect": [],
"extOffsetX": 0,
"extOffsetY": 0
}

View file

@ -85,10 +85,6 @@
{
"extFilament": 1.75,
"extNozzle": 0.4,
"extSelect": [
"T0"
],
"extDeselect": [],
"extOffsetX": 0,
"extOffsetY": 0
}

View file

@ -85,10 +85,6 @@
{
"extFilament": 1.75,
"extNozzle": 0.4,
"extSelect": [
"T0"
],
"extDeselect": [],
"extOffsetX": 0,
"extOffsetY": 0
}

View file

@ -86,10 +86,6 @@
{
"extFilament": 1.75,
"extNozzle": 0.4,
"extSelect": [
"T0"
],
"extDeselect": [],
"extOffsetX": 0,
"extOffsetY": 0
}

View file

@ -86,10 +86,6 @@
{
"extFilament": 1.75,
"extNozzle": 0.4,
"extSelect": [
"T0"
],
"extDeselect": [],
"extOffsetX": 0,
"extOffsetY": 0
}

View file

@ -91,10 +91,6 @@
{
"extFilament": 1.75,
"extNozzle": 0.6,
"extSelect": [
"T0"
],
"extDeselect": [],
"extOffsetX": 0,
"extOffsetY": 0
}

View file

@ -63,10 +63,6 @@
{
"extFilament": 1.75,
"extNozzle": 0.45,
"extSelect": [
"T0"
],
"extDeselect": [],
"extOffsetX": 0,
"extOffsetY": 0
}

View file

@ -71,10 +71,6 @@
{
"extFilament": 1.75,
"extNozzle": 0.45,
"extSelect": [
"T0"
],
"extDeselect": [],
"extOffsetX": 0,
"extOffsetY": 0
}

View file

@ -59,10 +59,6 @@
{
"extFilament": 1.75,
"extNozzle": 0.4,
"extSelect": [
"T0"
],
"extDeselect": [],
"extOffsetX": 0,
"extOffsetY": 0
}

View file

@ -32,10 +32,6 @@
{
"extFilament": 1.75,
"extNozzle": 0.4,
"extSelect": [
"T0"
],
"extDeselect": [],
"extOffsetX": 0,
"extOffsetY": 0
}

View file

@ -36,8 +36,7 @@
"nozzle": 0.4,
"filament": 1.75,
"offset_x": 0,
"offset_y": 0,
"select": [ "T0" ]
"offset_y": 0
}
],
"cmd":{

View file

@ -56,20 +56,12 @@
{
"extFilament": 1.75,
"extNozzle": 0.4,
"extSelect": [
"T0"
],
"extDeselect": [],
"extOffsetX": 0,
"extOffsetY": 0
},
{
"extFilament": 1.75,
"extNozzle": 0.4,
"extSelect": [
"T1"
],
"extDeselect": [],
"extOffsetX": 0,
"extOffsetY": 0
}

View file

@ -44,10 +44,6 @@
{
"extFilament": 1.75,
"extNozzle": 0.4,
"extSelect": [
"T0"
],
"extDeselect": [],
"extOffsetX": 0,
"extOffsetY": 0
}

View file

@ -44,10 +44,6 @@
{
"extFilament": 1.75,
"extNozzle": 0.4,
"extSelect": [
"T0"
],
"extDeselect": [],
"extOffsetX": 0,
"extOffsetY": 0
}

View file

@ -27,8 +27,7 @@
"nozzle": 0.4,
"filament": 2.85,
"offset_x": 0,
"offset_y": 0,
"select": [ "T0" ]
"offset_y": 0
}
],
"settings":{

View file

@ -18,7 +18,7 @@ FDM.export = function(print, online, ondone, ondebug) {
const { bounds, controller, device, process, filter, mode } = settings;
const { extruders, fwRetract } = device;
const { bedWidth, bedDepth, bedRound, bedBelt, maxHeight } = device;
const { gcodeFan, gcodeLayer, gcodeTrack, gcodePause, gcodeFeature } = device;
const { gcodeFan, gcodeLayer, gcodeTrack, gcodePause, gcodeFeature, gcodeChange } = device;
let model_labels = [];
for (let widget of widgets) {
@ -642,10 +642,7 @@ FDM.export = function(print, online, ondone, ondebug) {
// look for extruder change, run scripts, recalc emit factor
if (out.tool !== undefined && out.tool != tool) {
let macro_deselect = extruder.extDeselect.length ? extruder.extDeselect : extruders[0].extDeselect;
let macro_select = extruder.extSelect.length ? extruder.extSelect : extruders[0].extSelect;
segments.push({emitted, tool});
appendAllSub(macro_deselect);
subst.last_tool = tool;
tool = out.tool;
subst.nozzle = subst.tool = tool;
@ -657,7 +654,7 @@ FDM.export = function(print, online, ondone, ondebug) {
extruder.extFilament,
path.layer === 0 ?
(process.firstSliceHeight || process.sliceHeight) : path.height);
appendAllSub(macro_select);
appendAllSub(gcodeChange ?? [ "T{tool}" ]);
}
// if no point in output, it's a dwell command

View file

@ -264,7 +264,7 @@ FDM.prepare = async function(widgets, settings, update) {
// find max layers (for updates)
// generate list of used extruders for purge blocks
for (let widget of widgets) {
let extruder = widget.anno.extruder || 0;
let extruder = widget.anno.extruder ?? 0;
if (!extruders[extruder]) {
extruders[extruder] = {};
extcount++;

View file

@ -890,7 +890,7 @@ FDM.slice = function(settings, widget, onupdate, ondone) {
}
nu.push(nuSlice);
let ti = 0;
for (let top of slice.tops) {
for (let top of slice.tops || []) {
let nuTop = nuSlice.tops[ti++];
nuTop.shells = [];
top.shells = top.shells.filter((s,i) => {
@ -907,7 +907,7 @@ FDM.slice = function(settings, widget, onupdate, ondone) {
cap.z += (slice.height * 0.75);
cap.height = (slice.height / 2);
nu.push(cap);
cap.tops.forEach((top, i) => {
cap.tops?.forEach((top, i) => {
top.shells = nuSlice.tops[i].shells.clone();
});
}

View file

@ -139,8 +139,6 @@ function device_from_code(code,mode) {
if (rec.filament) e.extFilament = rec.filament;
if (rec.offset_x) e.extOffsetX = rec.offset_x;
if (rec.offset_y) e.extOffsetY = rec.offset_y;
if (rec.select) e.extSelect = rec.select;
if (rec.deselect) e.extDeselect = rec.deselect;
device.extruders.push(e);
});
} else {
@ -248,6 +246,7 @@ const conf = exports({
deviceZMax: 0,
maxHeight: 150,
gcodeTime: 1,
gcodeChange: ["T{tool}"],
gcodePre: [],
gcodePost: [],
gcodeProc: "",
@ -259,8 +258,6 @@ const conf = exports({
extruders:[{
extFilament: 1.75,
extNozzle: 0.4,
extSelect: ["T0"],
extDeselect: [],
extOffsetX: 0,
extOffsetY: 0
}],
@ -347,7 +344,6 @@ const conf = exports({
outputAvoidGaps: true,
outputAlternating: false,
outputLayerRetract: false,
outputNozzle: 0,
outputLoops: 0,
outputInvertX: false,
outputInvertY: false,

View file

@ -215,9 +215,7 @@ gapp.register("kiri.devices", (root, exports) => {
ui.extAdd,
ui.extDel,
ui.extOffsetX,
ui.extOffsetY,
ui.extSelect,
ui.extDeselect
ui.extOffsetY
].forEach(function(e) {
e.disabled = !local;
});

View file

@ -994,17 +994,14 @@ gapp.register("kiri.init", (root, exports) => {
extNozzle: newInput(LANG.dv_nozl_s, {title:LANG.dv_nozl_l, convert:toFloat, modes:FDM}),
extOffsetX: newInput(LANG.dv_exox_s, {title:LANG.dv_exox_l, convert:toFloat, modes:FDM}),
extOffsetY: newInput(LANG.dv_exoy_s, {title:LANG.dv_exoy_l, convert:toFloat, modes:FDM}),
_____: newDiv({ class: "f-col t-body t-inset", addto: $('dev-config'), set:true, modes:FDM_CAM }),
_____: newGroup(LANG.dv_gr_too, null, {group:"dext", inline}),
extSelect: newText(LANG.dv_exts_s, {title:LANG.dv_exts_l, size:14, height:3, area:gcode}),
extDeselect: newText(LANG.dv_dext_s, {title:LANG.dv_dext_l, size:14, height:3, area:gcode}),
extPad: newBlank({class:"grow", modes:FDM}),
separator: newBlank({class:"pop-sep", modes:FDM, driven}),
extActions: newRow([
ui.extPrev = newButton(undefined, undefined, {icon:'<i class="fas fa-less-than"></i>'}),
ui.extAdd = newButton(undefined, undefined, {icon:'<i class="fas fa-plus"></i>'}),
ui.extDel = newButton(undefined, undefined, {icon:'<i class="fas fa-minus"></i>'}),
ui.extNext = newButton(undefined, undefined, {icon:'<i class="fas fa-greater-than"></i>'})
], {class:"dev-buttons ext-buttons", modes:FDM}),
], {class:"dev-buttons ext-buttons var-row", modes:FDM}),
_____: newDiv({ class: "f-col t-body t-inset", addto: $('dev-config'), set:true, modes:CAM_LZR }),
_____: newGroup(LANG.dv_gr_out, null, {group:"dgco", inline}),
gcodeStrip: newBoolean(LANG.dv_strc_s, onBooleanClick, {title:LANG.dv_strc_l, modes:CAM}),
@ -1026,7 +1023,7 @@ gapp.register("kiri.init", (root, exports) => {
(ui.gcodeWaterOff = newGCode(LANG.dv_waof_s, {title:LANG.dv_waof_l, modes:WJET, area:gcode})).button,
(ui.gcodeKnifeDn = newGCode(LANG.dv_dkon_s, {title:LANG.dv_dkon_l, modes:DRAG, area:gcode})).button,
(ui.gcodeKnifeUp = newGCode(LANG.dv_dkof_s, {title:LANG.dv_dkof_l, modes:DRAG, area:gcode})).button,
(ui.gcodeChange = newGCode(LANG.dv_tool_s, {title:LANG.dv_tool_l, modes:CAM, area:gcode})).button,
(ui.gcodeChange = newGCode(LANG.dv_tool_s, {title:LANG.dv_tool_l, modes:FDM_CAM, area:gcode})).button,
(ui.gcodeDwell = newGCode(LANG.dv_dwll_s, {title:LANG.dv_dwll_l, modes:CAM, area:gcode})).button,
(ui.gcodeSpindle = newGCode(LANG.dv_sspd_s, {title:LANG.dv_sspd_l, modes:CAM, area:gcode, show:() => ui.spindleMax.value > 0})).button
], {class:"ext-buttons f-row gcode-macros"}),
@ -1172,9 +1169,8 @@ gapp.register("kiri.init", (root, exports) => {
sliceLayerStart: newSelect(LANG.sl_strt_s, {title:LANG.sl_strt_l}, "start"),
outputLayerRetract: newBoolean(LANG.ad_lret_s, onBooleanClick, {title:LANG.ad_lret_l}),
outputAvoidGaps: newBoolean(LANG.ad_agap_s, onBooleanClick, {title:LANG.ad_agap_l}),
separator: newBlank({ class:"set-sep", driven, show:isMultiHead }),
outputBeltFirst: newBoolean(LANG.ad_lbir_s, onBooleanClick, {title:LANG.ad_lbir_l, show: isBelt}),
outputNozzle: newSelect(LANG.sp_nozl_s, {title:LANG.sp_nozl_l, show:isMultiHead}, "extruders"),
separator: newBlank({ class:"set-sep", driven, show:isBelt }),
outputBeltFirst: newBoolean(LANG.ad_lbir_s, onBooleanClick, {title:LANG.ad_lbir_l, show:isBelt}),
_____: newGroup(LANG.ad_menu, $('fdm-expert'), { modes:FDM, driven, hideable, separator, group:"fdm-xprt" }),
sliceAngle: newInput(LANG.sl_angl_s, {title:LANG.sl_angl_l, convert:toFloat, show:isBelt}),
outputRetractDwell: newInput(LANG.ad_rdwl_s, {title:LANG.ad_rdwl_l, convert:toInt}),

View file

@ -284,7 +284,8 @@ function updateExtruderFields(device) {
const { LANG } = api.const;
if (device.extruders && device.extruders[device.internal]) {
updateFieldsFromSettings(device.extruders[device.internal]);
ui.extruder.firstChild.innerText = `${LANG.dv_gr_ext} [${device.internal+1}/${device.extruders.length}]`;
ui.extruder.innerHTML =
`${LANG.dv_gr_ext}<label class='grow'></label>${device.internal+1} of ${device.extruders.length}`;
ui.extPrev.disabled = device.internal === 0;
ui.extPrev.onclick = function() {
device.internal--;
@ -303,8 +304,6 @@ function updateExtruderFields(device) {
};
ui.extAdd.onclick = function() {
let copy = clone(device.extruders[device.internal]);
copy.extSelect = [`T${device.extruders.length}`];
copy.extDeselect = [];
device.extruders.push(copy);
device.internal = device.extruders.length - 1;
updateExtruderFields(device);

View file

@ -56,7 +56,7 @@ class Slice {
*/
clone(deep) {
const from = this, slice = newSlice(from.z, from.view);
from.tops.forEach(function(top) {
from.tops?.forEach(function(top) {
slice.addTop(top.poly.clone(deep));
});
return slice;

View file

@ -546,7 +546,6 @@ gapp.register("kiri.ui", [], (root, exports) => {
rows.forEach(row => {
cols = Math.max(cols, row.length);
});
txt.setAttribute("cols", Math.max(30, cols + 1));
let showing = pop === lastPop;
if (lastBtn) {

View file

@ -106,6 +106,7 @@ button {
margin: 1px 1px 2px;
cursor: pointer;
text-transform: capitalize;
white-space: nowrap;
}
button:not([disabled]):hover {
background-color: var(--main-color);