Print area with G-Code variables
 
Notifications
Clear all

Print area with G-Code variables  

  RSS
Pasubio
(@pasubio)
Eminent Member
Print area with G-Code variables

Hi all;
I need to obtain the max/min X and Y coordinates of the actual print area inside the G-code starting script.

I know that I can use the first_layer_print_min and first_layer_print_max placeholders, anyway I'm not able to understand how to extract min X/Y and max X/Y coordinates from this placeholders.

Moreover, do you suggest to use the pointed out placeholders or the print_bed_min and print_bed_max placeholders?

Thank you!

Napsal : 21/06/2021 8:27 am
Pasubio
(@pasubio)
Eminent Member
Topic starter answered:
RE: Print area with G-Code variables

To explain better, in Simplify3D you can use [build_min_x], [build_max_x], [build_min_y], [build_max_y] placeholders, so I'm looking for the corresponding placeholders in PrusaSlicer.

Thank you!

Napsal : 22/06/2021 7:18 am
bobstro
(@bobstro)
Illustrious Member
RE: Print area with G-Code variables

I haven't played with these much myself, but the PrusaSlicer 2.3.0 announcementcontains some hints:

  • The G-code placeholder parser supports the following new keys: "print_bed_min", "print_bed_max", "print_bed_size", which are calculated as a bounding box of an existing "bed_shape" vector of points.
  • The G-code placeholder parser also newly supports the following new keys: "first_layer_print_convex_hull", "first_layer_print_min", "first_layer_print_max", "first_layer_print_size", defining convex hull of the first layer. Please note that the extrusions generated by the custom G-code are not accounted for.

Playing around with start gcode, the following statements seem to work as expected. With these lines in my start gcode:

; First layer print min: [first_layer_print_min_0],[first_layer_print_min_1]
; First layer print max: [first_layer_print_max_0],[first_layer_print_max_1]
; First layer print size: [first_layer_print_size_0],[first_layer_print_size_1]

I get this result when slicing a 30x40x50mm STL:

; First layer print min: 55.1281,30.2443
; First layer print max: 85.1281,70.2443
; First layer print size: 30,40

I'm just not certain about first_layer_print_min as the slicer says the part is positioned at 70.13,50.24. The max extent looks right based on that starting position and the print size is correct.

 

My notes and disclaimers on 3D printing

and miscellaneous other tech projects
He is intelligent, but not experienced. His pattern indicates two dimensional thinking. -- Spock in Star Trek: The Wrath of Khan

Napsal : 22/06/2021 3:03 pm
Pasubio
(@pasubio)
Eminent Member
Topic starter answered:
RE: Print area with G-Code variables

Hi @bobstro,
thank you for your precious help.
I'm able to confirm the following placeholders translation:

  • Simplify 3D:  [build_min_x], [build_max_x], [build_min_y], [build_max_y]
  • PrusaSlicer:  [first_layer_print_min_0], [first_layer_print_max_0], [first_layer_print_min_1], [first_layer_print_max_1]

 

Important: the resulting coordinates contemplates also the skirt/brim/raft area if activated, not only the pure STL!

This post was modified před 3 years by Pasubio
Napsal : 28/06/2021 1:33 pm
bobstro se líbí
showGoat
(@showgoat)
Member
RE: Print area with G-Code variables

Old thread, I know, but here's my version:

G29 X3 Y2 L[first_layer_print_min_0] F[first_layer_print_min_1] R[first_layer_print_max_0] B[first_layer_print_max_1]
Napsal : 16/03/2024 5:14 pm
Share: