Page 1 of 1
Thumbnail generator no longer works in S3Dv5
Posted: Fri Jan 13, 2023 2:20 am
by bolsoncerrado
Hi,
FOA I know this is about a third party script but since S3D does NOT support thumbnail generation for the XXIst Century touch-screen nifty cool driven 3D printers, we must rely on these scripts to generate thumbnails for our farms.
https://github.com/idcrook/s3d-thumbnai ... ator-macos
Thing is, once the script generates and places the thumbnail into the S3D gcode via PostProcessing script, the .gcode no longer opens in S3Dv5.
IT WAS WORKING PERFECTLY FINE ON S3D v4 so PLEASE PLEASE PLEASE would you mind relax or fix whatever is checking that makes impossible for the code to open the modified file with S3D v5?
Attached a sample thumbnail gcode.
xreference
https://github.com/idcrook/s3d-thumbnai ... s/issues/4
Re: Thumbnail generator no longer works in S3Dv5
Posted: Fri Jan 13, 2023 11:34 am
by S3D-Jason
It looks like the base64 image is all being written on a single line. That leads to lines in the file that are extremely long, and most printers cannot read lines that big. It can overflow the buffer.
Most other slicer softwares break up the base64 image into multiple lines. So instead of this:
; thumbnail begin 32x32 10772
; AABBCCDDEEFFGGHHAABBCCDDEEFFGGHHAABBCCDDEEFFGGHHAABBCCDDEEFFGGHHAABBCCDDEEFFGGHH...
; thumbnail end
Do something like this:
; thumbnail begin 32x32 10772
; AABBCCDDEEFFGGHH
; AABBCCDDEEFFGGHH
; AABBCCDDEEFFGGHH
; AABBCCDDEEFFGGHH
; thumbnail end
Re: Thumbnail generator no longer works in S3Dv5
Posted: Tue Jan 17, 2023 7:52 am
by bolsoncerrado
The weird part is that v4 handled the "altered" gcodes correctly and I could open normally. v5 DOES NOT.
!??!?!
EDIT: Needless to say, octoprint and/or the printers print the gcodes just fine. it's ONLY S3Dv5 which complains!
Re: Thumbnail generator no longer works in S3Dv5
Posted: Tue Jan 17, 2023 11:16 am
by jandrunas
my crappy thumbnail generator for v5/linux definatley room form improvements, really no reason to write all those temp files for instnace
Code: Select all
#!/bin/bash
set -e
FILE="$@"
FILE_PATH=${FILE%/*}
FILE_NAME=${FILE##*/}
WORKING_DIR='/tmp'
sed -i '; /postProcessing/d' "${FILE}"
gcode2png --output=${WORKING_DIR}/${FILE_NAME}-small.png --grid=1 --color=.2,.6,1 --size=48x48 ${FILE}
gcode2png --output=${WORKING_DIR}/${FILE_NAME}-large.png --grid=1 --color=.2,.6,1 --size=300x300 ${FILE}
OUTPUT_SMALL=$(base64 "$WORKING_DIR/${FILE_NAME}-small.png")
LENGTH_SMALL=$(base64 "$WORKING_DIR/${FILE_NAME}-small.png" | wc -c)
OUTPUT_LARGE=$(base64 "$WORKING_DIR/${FILE_NAME}-large.png")
LENGTH_LARGE=$(base64 "$WORKING_DIR/${FILE_NAME}-large.png" | wc -c)
echo " " > "${WORKING_DIR}/${FILE_NAME}-base64.txt"
echo " thumbnail begin 48x48 ${LENGTH_SMALL}" >> "${WORKING_DIR}/${FILE_NAME}-base64.txt"
echo "${OUTPUT_SMALL}" >> "${WORKING_DIR}/${FILE_NAME}-base64.txt"
echo " thumbnail end" >> "${WORKING_DIR}/${FILE_NAME}-base64.txt"
echo " " >> "${WORKING_DIR}/${FILE_NAME}-base64.txt"
echo " thumbnail begin 300x300 ${LENGTH_LARGE}" >> "${WORKING_DIR}/${FILE_NAME}-base64.txt"
echo "${OUTPUT_LARGE}" >> "${WORKING_DIR}/${FILE_NAME}-base64.txt"
echo " thumbnail end" >> "${WORKING_DIR}/${FILE_NAME}-base64.txt"
echo " " >> "${WORKING_DIR}/${FILE_NAME}-base64.txt"
sed -i 's/^/;/' "${WORKING_DIR}/${FILE_NAME}-base64.txt"
cat "${WORKING_DIR}/${FILE_NAME}-base64.txt" "${FILE}" > "${WORKING_DIR}/${FILE_NAME}-tmp.gcode"; mv "${WORKING_DIR}/${FILE_NAME}-tmp.gcode" "$@"
curl -k --connect-timeout 5 -H "X-Api-Key: <API_KEY_GOES_HERE>" -F "select=false" -F "print=false" -F "file=@${FILE}" "<KLIPPER_URL>/api/files/local" &
Re: Thumbnail generator no longer works in S3Dv5
Posted: Wed Jan 18, 2023 8:18 am
by ptegler
have to agree ...the 'standard' is a physically formatted mult-iline graphics.
If anything v4.1.x was at fault for reading a single line incorrectly. BTDT
run any other of the 'free' slicers' and look at the icon code.... it's all multi-line.
p.s. Your included gcode sample did not open/display in my S3D 4.1.2 either
ptegler
Re: Thumbnail generator no longer works in S3Dv5
Posted: Thu Jan 19, 2023 6:12 am
by bolsoncerrado
Thanks all for reporting back