garethky / PrusaSlicerPressureAdvanceCalibration

An web tool that modified PrusaSlicer GCode to add a Pressure Advance test pattern
https://garethky.github.io/PrusaSlicerPressureAdvanceCalibration/
GNU General Public License v3.0
5 stars 3 forks source link

Add Support for Round Beds/Delta Printers #3

Open garethky opened 10 months ago

garethky commented 10 months ago

Round beds in Prusa Slicer generate a huge list of what look like x/y coordinate pairs, e.g.:

; bed_shape = 129.505x11.3302,128.025x22.5743,125.57x33.6465,122.16x44.4626,117.82x54.9404,112.583x65,106.49x74.5649,99.5858x83.5624,91.9239x91.9239,83.5624x99.5858,74.5649x106.49,65x112.583,54.9404x117.82,44.4626x122.16,33.6465x125.57,22.5743x128.025,11.3302x129.505,7.9602e-15x130,-11.3302x129.505,-22.5743x128.025,-33.6465x125.57,-44.4626x122.16,-54.9404x117.82,-65x112.583,-74.5649x106.49,-83.5624x99.5858,-91.9239x91.9239,-99.5858x83.5624,-106.49x74.5649,-112.583x65,-117.82x54.9404,-122.16x44.4626,-125.57x33.6465,-128.025x22.5743,-129.505x11.3302,-130x1.59204e-14,-129.505x-11.3302,-128.025x-22.5743,-125.57x-33.6465,-122.16x-44.4626,-117.82x-54.9404,-112.583x-65,-106.49x-74.5649,-99.5858x-83.5624,-91.9239x-91.9239,-83.5624x-99.5858,-74.5649x-106.49,-65x-112.583,-54.9404x-117.82,-44.4626x-122.16,-33.6465x-125.57,-22.5743x-128.025,-11.3302x-129.505,-2.38806e-14x-130,11.3302x-129.505,22.5743x-128.025,33.6465x-125.57,44.4626x-122.16,54.9404x-117.82,65x-112.583,74.5649x-106.49,83.5624x-99.5858,91.9239x-91.9239,99.5858x-83.5624,106.49x-74.5649,112.583x-65,117.82x-54.9404,122.16x-44.4626,125.57x-33.6465,128.025x-22.5743,129.505x-11.3302,130x-3.18408e-14

I assume the plan would be to find the min/max of x and y respectively. (In this case its -130 +130 in both axes.) From this we can deduce that the bed is a circle with a center at 0,0 and a radius of 130.

But could this string of numbers could define some other shape? The goal of parsing this data is to decide if the test pattern will fit on the bed. If its some other shape we may not be able to do that (at least not without full on collision detection). Since "arbitrary shape" seems like a rare thing, I'd be fine with a check to see if these points are all plausibly on the diameter of a circle and if not, issue an error.

In a possible future feature I'd like to scale down the test pattern to work on small printers. Knowing the size of the bed would be useful for that as well.