ctilley79
Posts: 8
Joined: Wed Aug 01, 2018 11:09 pm

Additional Terminal Commands Debugging

I'm having trouble calling a Python script from the post processing section in V5. I believe it has to do with the way file paths are generated when I call the command. Is there any way to view debugging info for commands sent to the terminal? I want to see exactly what command was sent to the terminal and any errors that resulted. I'm on macOS. Is there any system log that would have a record when S3D processes this script?

Here's how I call the script.

Code: Select all

python3 "/Users/uname/Development/S3D/up.py" "[output_dir]/[output_filename].gcode"
Everything to the right of up.py is a sysArg
S3D-Jason
Posts: 1402
Joined: Sun May 31, 2015 6:01 am

Re: Additional Terminal Commands Debugging

You might want to try putting the full path to python3 at the start. Type "whereis python3" in a Terminal window and then use that path at the start of the command.
ctilley79
Posts: 8
Joined: Wed Aug 01, 2018 11:09 pm

Re: Additional Terminal Commands Debugging

S3D-Jason wrote: Thu Jan 05, 2023 6:16 am You might want to try putting the full path to python3 at the start. Type "whereis python3" in a Terminal window and then use that path at the start of the command.
Already tried that and a dozen different ways. It would be nice if there was an operating system tool I could use to see what SImplify3D is sending to the terminal. It would also be nice if you could write a blog post on the ins and outs of the post processing (additional terminal commands) feature.
S3D-Jason
Posts: 1402
Joined: Sun May 31, 2015 6:01 am

Re: Additional Terminal Commands Debugging

I just ran a test on my Mac, so I can give you the exact instructions I used.

First, open a Terminal window and type "whereis python3". Mine says it is located at "/usr/bin/python3". We will use that same path below.

Next, create a simple python script for testing. I called mine "script.py" and placed it in the Downloads folder. The contents of the script are below.

file = open('/Users/YOURUSERNAMEHERE/Downloads/test.txt', 'w')
file.write("hello")
file.close()

Save the script, the open S3D, go to Edit Process Settings > Scripts > Post Processing. Add the following line:

/usr/bin/python3 /Users/YOURUSERNAMEHERE/Downloads/script.py

Save your settings. Now click Prepare to Print, and then "Export Build File to Disk". The custom script will run when you export the file and you should see a new file in your Downloads folder called test.txt that says "hello".

I just tested all of these steps myself and it worked correctly.
jandrunas
Posts: 3
Joined: Mon Jan 16, 2023 11:01 am

Re: Additional Terminal Commands Debugging

I use linux and just wrap everything in a shell script and then put the full path to the script in the post processing screen

/usr/local/bin/send-to-printer "[output_filepath]"

Return to “General Discussion and Tips”