Skip to content

Creates gcode thumbnails from Simplify3D within macOS environment.

License

Notifications You must be signed in to change notification settings

bolsoncerrado/s3d-thumbnail-generator-macos

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Insert gcode preview thumbnails for Simplify3D on macOS

Tested with Slicer Thumbnails plugin for OctoPrint.

Tested on Simplify3D.app 4.1.2 in macOS Big Sur on both Intel and Apple Silicon

Install

  1. Install dependencies. Use macOS Homebrew.

    brew install imagemagick
    brew install smokris/getwindowid/getwindowid
  2. Clone this repo somewhere in your macOS home directory.

    mkdir -p ~/projects/3dprint
    cd ~/projects/3dprint
    git clone https://github.com/idcrook/s3d-thumbnail-generator-macos.git s3d-thumbnails
  3. Customize the included generate_S3D_thumbnails.bash script

    • Customize any paths (most should be fine as-is)
    • May need to iterate on the cropping image dimensions and proportions to match your window layout and preferences.
  4. Add script invocation in Simplify 3D gcode post-processing

    /Users/%%USERNAME%%/projects/3dprint/s3d-thumbnails/generate_S3D_thumbnails.bash "[output_filepath]"
    • %%USERNAME%% in the line above is meant to be replaced with your Mac account username.
    • This is added in Additional terminal commands for post processing in the Scripts tab in Process settings, e.g.

    Main window - Edit process settings FFF Settings - Show advanced Scripts - additional terminal commands for post processing

  5. Now when you save the .gcode file in Simplify3D.app, thumbnails get embedded directly.

IMPORTANT: For recent macOS, in System Preferences in the Security and Privacy preferences, in the Privacy tab, you will have to enable Screen Recording (and possibly Accessibility) permissions for Simplify3D.app

  • This is so the post-processing script can automatically screen capture the Simplify3D app window

  • The preview thumbnail is obtained directly from the Simplify3D application window.

With Slicer Thumbnails plugin for Octoprint enabled, the thumbnail can be viewed from web interface.

OctoPrint - View thumbnail

Additional Settings

Use Sliced preview or normal view

The thumbnail is captured from the Simplify3D application window when the sliced .gcode file is saved.

If you prefer the non-sliced preview version, in Application Preferences in the Visualization tab, uncheck

  • "Automatically load preview after slicing"

Visualization - load preview after slicing

Customize crop size and position

The image crop and dimension settings may be unique to the preview type and your macOS desktop setup.

These are adjustable in the script. Look for the in the bash script for the section starting at the line # Position the crop bounding box

Troubleshooting

Getting list of app windows

There is included an applescript that lists running application windows. It can be run as follows:

$ osascript window_list.scpt

This is from example found at https://stackoverflow.com/a/59293280

Manually run script

With Simplify3D.app open, the thumbnail embedding script can be run on a "dummy" gcode file to confirm that it has been set up correctly or for iterating on thumbnail crop area.

For example, on my Mac that has zsh as my terminal shell (long lines truncated in the less output):

$ cd ~/projects/3dprint/s3d-thumbnails
$ echo END >! sample.gcode && ./generate_S3D_thumbnails.bash
400x469 237992
$ less sample.gcode
;
; thumbnail begin 32x32 3012
; iVBORw0KGgoAAAANSUhEUgAAABsAAAAgCAMAAADUt/MJAAABNWlDQ1BpY2MAACiRY2Bg4kksKMhhYW
; thumbnail end
; thumbnail begin 400x469 237992
; iVBORw0KGgoAAAANSUhEUgAAAZAAAAHVCAYAAADfKq0TAAABNWlDQ1BpY2MAACiRY2Bg4kksKMhhYW
; thumbnail end
END
$ open $TMPDIR/bigthumb.png

Enable script tracing

To turn on generic bash command tracing, change the first line of the bash script to include the -x option.

#!/bin/bash -x

SEE ALSO

About

Creates gcode thumbnails from Simplify3D within macOS environment.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 90.8%
  • AppleScript 9.2%