nicolai-wachenschwan / arc-overhang-prusaslicer-integration

A 3D printer slicing algorithm that lets you print 90° overhangs without support material.
GNU General Public License v3.0
329 stars 26 forks source link

TypeError using MMU #46

Closed amatulic closed 1 year ago

amatulic commented 1 year ago

OK, I am going to try this again, and address the closing comment in issue #42.

Trying to run the script on the attached gcode file (somewhat different than in #42) produces the following message:

INFO:PrusaSlicer Setting not in the expected format, but added into script dictionary: [' end_gcode ', '{if max_layer_z < max_print_height}G1 Z{z_offset+min(max_layer_z+1, max_print_height)} F720 ; Move print head up{endif}\\nG1 X0 Y210 F7200 ; park\\n{if max_layer_z < max_print_height}G1 Z{z_offset+min(max_layer_z+49, max_print_height)} F720 ; Move print head further up{endif}\\n{if has_wipe_tower}\\nG1 E-15 F3000\\n{else}\\nG1 E2 F5000\\nG1 E2 F5500\\nG1 E2 F6000\\nG1 E-15 F5800\\nG1 E-20 F5500\\nG1 E10 F3000\\nG1 E-10 F3100\\nG1 E10 F3150\\nG1 E-10 F3250\\nG1 E10 F3300\\n{endif}\\n\\nM140 S0 ; turn off heatbed\\nM107 ; turn off fan\\n\\n; Unload filament\\nM702 C\\n\\nG4 ; wait\\nM221 S100 ; reset flow\\nM900 K0 ; reset LA\\n{if print_settings_id=~/.*(DETAIL @MK3|QUALITY @MK3|SOLUBLE|@0.25 nozzle MK3).*/}M907 E538 ; reset extruder motor current{endif}\\nM104 S0 ; turn off temperature\\nM84 ; disable motors\\n; max_layer_z ', '[max_layer_z]']
Traceback (most recent call last):
  File "c:\standalone\prusa_slicer_post_processing_script.py", line 1189, in <module>
    main(gCodeFileStream,path2GCode,path2Output,skipInput)
  File "c:\standalone\prusa_slicer_post_processing_script.py", line 109, in main
    parameters=makeFullSettingDict(gCodeSettingDict)
  File "c:\standalone\prusa_slicer_post_processing_script.py", line 76, in makeFullSettingDict
    "ArcWidth":gCodeSettingDict.get("nozzle_diameter")*0.95, #change the spacing between the arcs,should be nozzle_diameter
TypeError: can't multiply sequence by non-int of type 'float'

The "INFO" message above appears to be from the "End G-code" setting, which is the stock setting for a Prusa MK3S+MMU2S.

The closing comment in #42 said that the extrusion width is not a number.

That is not the case here. I am using stock PrusaSlicer 2.5.2 settings for a Prusa MK3S with MMU. I'm using the "0.20mm QUALITY @MK3" preset. No changes to any parameters. The extrusion widths are all set to a number, 0.45 for all except top solid infill at 0.4 and support material at 0.35. These are all default values.

If PrusaSlicer is emitting incorrect g-code, then please identify what that is so you or I can report a bug on the PrusaSlicer github repository.

gcode file: rolodex_frame_0.2mm_PLA_MK3SMMU2S_26m.zip

Default PrusaSlicer settings for extrusion widths: Screenshot 2023-04-12 210820

nicolai-wachenschwan commented 1 year ago

missread the info in #42, problem is nozzle diameter. Using MMU the nozzle diameter will be "0.4,0.4,..."=>not easy readable for computer. Added a fix with the parameter "Fallback_nozzle_diameter", which will be used if nozzle diameter is not readable. Is 0.4 by default, so your error should be fixed in the newest commit. Please try if it works and give feedback, thanks!

amatulic commented 1 year ago

Still getting the same error on the gcode attached to this issue. The only difference is the line numbers:

INFO:PrusaSlicer Setting not in the expected format, but added into script dictionary: [' end_gcode ', '{if max_layer_z < max_print_height}G1 Z{z_offset+min(max_layer_z+1, max_print_height)} F720 ; Move print head up{endif}\\nG1 X0 Y210 F7200 ; park\\n{if max_layer_z < max_print_height}G1 Z{z_offset+min(max_layer_z+49, max_print_height)} F720 ; Move print head further up{endif}\\n{if has_wipe_tower}\\nG1 E-15 F3000\\n{else}\\nG1 E2 F5000\\nG1 E2 F5500\\nG1 E2 F6000\\nG1 E-15 F5800\\nG1 E-20 F5500\\nG1 E10 F3000\\nG1 E-10 F3100\\nG1 E10 F3150\\nG1 E-10 F3250\\nG1 E10 F3300\\n{endif}\\n\\nM140 S0 ; turn off heatbed\\nM107 ; turn off fan\\n\\n; Unload filament\\nM702 C\\n\\nG4 ; wait\\nM221 S100 ; reset flow\\nM900 K0 ; reset LA\\n{if print_settings_id=~/.*(DETAIL @MK3|QUALITY @MK3|SOLUBLE|@0.25 nozzle MK3).*/}M907 E538 ; reset extruder motor current{endif}\\nM104 S0 ; turn off temperature\\nM84 ; disable motors\\n; max_layer_z ', '[max_layer_z]']
Traceback (most recent call last):
  File "c:\standalone\prusa_slicer_post_processing_script.py", line 1194, in <module>
    main(gCodeFileStream,path2GCode, skipInput)
  File "c:\standalone\prusa_slicer_post_processing_script.py", line 114, in main
    parameters=makeFullSettingDict(gCodeSettingDict)
  File "c:\standalone\prusa_slicer_post_processing_script.py", line 79, in makeFullSettingDict
    "ArcWidth":gCodeSettingDict.get("nozzle_diameter")*0.95, #change the spacing between the arcs,should be nozzle_diameter
TypeError: can't multiply sequence by non-int of type 'float'
nicolai-wachenschwan commented 1 year ago

Didnt read well enough, should be fixed now. Would be happy if you could Test it on your machine :)

amatulic commented 1 year ago

I get the same error message as before, with the same line numbers indicated. I checked the diff of your commit and that change is in the version I am running.

If you test the g-code file I attached to the initial post in this issue, does it work for you?

nicolai-wachenschwan commented 1 year ago

ok, this was a bit thougher than expected. Apperently a lot of values are speced as a list when using MMU. Therefore I wrote the addition to convert all tuples into their first value. Also included fallback option for manual specification and warnings which tell how to set manual fallback values.

Converted your file successfully, but for your specific geometry using the recursive function by setting the parameter "UseLeastAmountOfCenterPoints" to False could print better.

nicolai-wachenschwan commented 1 year ago

PS: If you only use one extruder you can also slice the file for the regular MK3S and chose the filament when starting the print manual :)

amatulic commented 1 year ago

All right, that fixed it. You can close this issue.

Setting UseLeastAmountOfCenterPoints=False gave me the result I was expecting.

However, I don't understand why the arc overhang layer is covered with a Hilbert curve. Why not just the normal monotonic infill pattern? Does it have to do with warp prevention?

I use the MMU for everything, so I never slice for the regular MK3S anymore. Even for a single extruder, I usually want to print the part from one of the 5 materials loaded into the MMU, not always the default extruder #1. And for this particular model, I would normally print it in PLA with PETG supports along the edges, so I would definitely need the MMU for that. I wanted to experiment with the arc overhang to see if it improves the print time over having tool changes with support material.

nicolai-wachenschwan commented 1 year ago

Yes, monotonic would warp terriblely.