bolsoncerrado
Posts: 176
Joined: Tue Mar 17, 2015 10:55 am

Thumbnail generator no longer works in S3Dv5

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
Attachments
sample.gcode
(81.01 KiB) Downloaded 209 times
S3D-Jason
Posts: 1608
Joined: Sun May 31, 2015 6:01 am

Re: Thumbnail generator no longer works in S3Dv5

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
bolsoncerrado
Posts: 176
Joined: Tue Mar 17, 2015 10:55 am

Re: Thumbnail generator no longer works in S3Dv5

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!
jandrunas
Posts: 3
Joined: Mon Jan 16, 2023 11:01 am

Re: Thumbnail generator no longer works in S3Dv5

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" &
ptegler
Posts: 13
Joined: Wed Dec 28, 2016 8:17 pm

Re: Thumbnail generator no longer works in S3Dv5

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
bolsoncerrado
Posts: 176
Joined: Tue Mar 17, 2015 10:55 am

Re: Thumbnail generator no longer works in S3Dv5

Thanks all for reporting back

Return to “Troubleshooting and Bug Reports”