Get Profile Setting from AnyCubic gcode 3D print file

Print This Post Print This Post

I wanted to see the settings and profile used to print the sample Owl_pair.gcode. The file has the settings included at the end starting with

;CURA_PROFILE_STRING:

After that there is the base64 encoded zlib inflated profile data. You can extract it by removing everything before the following start code similar to ‘eNrtWk’ (6 bytes or chars) and after the == at the end of this line.

Here is a single line to do this within a Linux system with zlib-flate fro qpdf installed:

awk -F ';CURA_PROFILE_STRING:' '{print $2}' <Owl_pair.gcode |base64 -d -i | zlib-flate -uncompress | tr '\010' '\012' >Owl_pair.gcode.settings

Or here the bash script I used:

#!/bin/sh
# awk -F ';CURA_PROFILE_STRING:' '{print $2}' <Owl_pair.gcode |base64 -d -i | zlib-flate -uncompress | tr '\010' '\012' >Owl_pair.gcode.settings
infile=$1
[ $# -eq 0 ] && { echo "Usage: $0 gcode-file"; exit 999; }
echo "$0\ntool to extract cura settings from gcode file\n"
if [ -f ${infile} ];
then
awk -F ';CURA_PROFILE_STRING:' '{print $2}' < ${infile} |base64 -d -i | zlib-flate -uncompress | tr '\010' '\012' > ${infile}.settings
# less ${infile}.settings
else
echo "\n${infile} not found!\n"
fi
if [ -s ${infile}.settings ];
then
echo "\nSettings written to ${infile}.settings"
else
echo "\nNO Settings found. Either missing ';CURA_PROFILE_STRING:' in gcode file or base64 decode or zlib deflate failed\n"
if [ -f ${infile}.settings ];
then
#delete empty file
rm ${infile}.settings
fi
fi

The output looks similar to this:

layer_height=0.2
wall_thickness=1.2
retraction_enable=True
solid_layer_thickness=1.2
fill_density=25
print_speed=50
print_temperature=200
print_temperature2=0
print_temperature3=0
print_temperature4=0
print_temperature5=0
print_bed_temperature=60
support=None
platform_adhesion=None
support_dual_extrusion=Both
wipe_tower=False
wipe_tower_volume=15
ooze_shield=False
filament_diameter=1.75
filament_diameter2=0
filament_diameter3=0
filament_diameter4=0
filament_diameter5=0
filament_flow=100.0
nozzle_size=0.4
retraction_speed=60.0
retraction_amount=5
retraction_dual_amount=16.5
retraction_min_travel=1.5
retraction_combing=All
retraction_minimal_extrusion=0.02
retraction_hop=0.0
bottom_thickness=0
layer0_width_factor=140
object_sink=0
overlap_dual=0.15
travel_speed=60
bottom_layer_speed=20
infill_speed=0.0
solidarea_speed=30
inset0_speed=30
insetx_speed=40.0
cool_min_layer_time=5
...

 

Leave a Reply