Run a script

Objectives

a Now that you learned about the basic structure of a script, we will save, load and run the script to check if it does exactly what the programmer (i.e. you) has thought.

Instructions

Tasks:
  1. Create a project folder for all scripts.
  2. Check and run the script discussed in the last station.
  3. Activate all functions from the template.
  4. Replace pass in function_1 with a print function.
  5. Add a fourth function that is creating a new sphere in the 3D World at location (1,1,3)
Load script ...
../../../_images/script-load.png

Run script...
../../../_images/script-run.png

Output...
../../../_images/output.png

../../../_images/label-windows.png
Windows: output
../../../_images/output-win.png

Start with console on MacOS

../../../_images/label-macos.png

If you start Blender with a double click, no output will be shown. As a workaround start Blender within a console. Everybody who is familiar with a terminal, moves to the folder of blender.app and starts the application in the background with the following command:

./blender.app/Contents/MacOS/blender &

A second way to start Blender, search Blender with Finder and open the package with a right mouse click:

../../../_images/mac-search-blender.png

move to the blender file and start it with a double click:

../../../_images/mac-start-blender.png

Blender is starting and a terminal window is opened. Do not close this window until you want to quit Blender. Errors and print output is now visible in the terminal window.