Can I set probe spacing for X and Y individually
-
Hi all!
I am trying to program a conditional gcode script for prusaslicer, that measures the convex hull of the first layer, and changes the area to be probed based on the results.
My code (for now, please ignore any syntax errors)
; Define probe point spacing { local sizex = (first_layer_print_max[0] - first_layer_print_min[0]); local sizey = (first_layer_print_max[1] - first_layer_print_min[1]); local probexmin = (max(55, first_layer_print_min[0]) - 50); local probexmax = (min(print_bed_max[0], first_layer_print_min[0] + 55) - 5); local probeymin = (max(55, first_layer_print_min[1]) - 50); local probeymax = (min(print_bed_max[1], first_layer_print_min[1] + 55) - 5); {if sizex < 200} M557 P3:nn {elsif sizex > 200 and sizex < 300} M557 P5:nn {elsif sizex > 300 and sizex < 400} M557 P7:nn {endif} {if sizey < 200} M557 Pnn:3 {elsif sizey > 200 and sizey < 300} M557 Pnn:5 {elsif sizey > 300 and sizey < 400} M557 Pnn:5 {endif} } ; Define probing grid M557 X probexmin:probexmax Y probeymin:probeymax ; Mesh calibration; G29 ; mesh probe bed
As you can see, I first create local variables (possible in prusaslicer from 2.6a6) and then I want to change the probing density based on the X and Y size of the first layer.
My question;
Is it possible to change only the X or Y value of probe point amounts, without setting/changing the other?
FE ("P-1:5") leaves the X value unchanged, or just leaving it blank will; ("P:5" for Y, "P5:" for X )I cannot seem to figure it out. Anybody ideas?
Kind regards,
Sander? -
@SanderLPFRG said in Can I set probe spacing for X and Y individually:
I guess it is this part you are having issues with:
{if sizex < 200} M557 P3:nn {elsif sizex > 200 and sizex < 300} M557 P5:nn {elsif sizex > 300 and sizex < 400} M557 P7:nn {endif} {if sizey < 200} M557 Pnn:3 {elsif sizey > 200 and sizey < 300} M557 Pnn:5 {elsif sizey > 300 and sizey < 400} M557 Pnn:5 {endif}
Instead of setting M557 directly, set another pair of variables eg probexdensity and probeydensity. Then in you final M557 command, set values for P using them.
Ian
-
I have tried what you said, defining 2 variables "ppointx" and "ppointy" and setting the M557 to P"local.ppointx":"local.ppointy".
However, I cannot set or write variables via the start gcode in prusaslicer. I can only create local and global variables that are used for the processing in prusaslicer alone..
Any other ideas?
-
@SanderLPFRG are you saying PrusaSlicer can't generate the "var" commands? If so then you could use this:
{if sizex < 200} M98 P"SetNumX.g" Snn {elsif sizex > 200 and sizex < 300} M98 P"SetNumX.g" Snn {elsif sizex > 300 and sizex < 400} M98 P"SetNumX.g" Snn {endif} {if sizey < 200} M98 P"SetNumY.g" Snn {elsif sizey > 200 and sizey < 300} M98 P"SetNumY.g" Snn {elsif sizey > 300 and sizey < 400} M98 P"SetNumY.g" Snn {endif}
Then you can define macro SetNumX.g to save the S parameter in a variable, and macro SetNumY.g to pick up that variable and its own S parameter to construct the M557 command.
-
@dc42 Hi
Sorry I was with vacation.
Could you please specify what you mean with the macro's?? and the S parameter?
Hope to hear from you.
Sander