Blender

Blender ships with its own embedded version of Python. Therefore, the simplest (and recommended) way to install COMPAS for Blender is to replace the embedded Python by the Python of a conda environment that already has COMPAS installed.

It is important that the version of Python installed in the conda environment matches the version of Python that was originally shipped with Blender. For Blender 2.8x this is Python 3.7x.

Installation

If you wish to install a new python environment with COMPAS, open the command prompt and type the following:

conda config --add channels conda-forge
conda create -n blender python=3.7 COMPAS

Note

we called the environment blender but you can use any name

Now configure Blender to use the newly installed environment or any environment in which you have COMPAS:

conda activate blender
python -m compas_blender.install "%PROGRAMFILES%\Blender Foundation\Blender 2.82\2.82"

Note

change conda activate blender with conda activate name_of_your_environment if you want to link another environment.

Warning

the path %PROGRAMFILES%\Blender Foundation\Blender 2.82\2.82 might be different if you have another version of Blender intalled. Check your version of Blender and change the path accordingly.

If you wish to install a new python environment with COMPAS, open the Terminal and type the following:

conda config --add channels conda-forge
conda create -n blender python=3.7 COMPAS

Note

we called the environment blender but you can use any name

Now configure Blender to use the newly installed environment or any environment in which you have COMPAS:

conda activate blender
python -m compas_blender.install /Applications/blender.app/Contents/Resources/2.82

Note

change conda activate blender with conda activate name_of_your_environment if you want to link another environment.

Warning

the path /Applications/blender.app/Contents/Resources/2.82 might be different if you have another version of Blender intalled. Check your version of Blender and change the path accordingly.

Verify setup

In Blender, at the interactive Python prompt (>>>) import the following packages

>>> import compas
>>> import compas_blender
>>> import numpy
>>> import scipy

Install Python packages

After replacing the embedded version of Python with the one in the virutual environment, as instructed above, it is not necessary to activate the environment before using Blender. However, when you want to update the installed packages, or add more packages, make sure to activate the Blender environment first. Otherwise, the changes will not have any effect.

conda activate blender
conda install ...

Note

if you want to use blender with a different environment, you simply have to activate that environment and floow the same procedure described above.

Start Blender

Blender uses the command window of your system to display error messages and other text output. On Windows, the output window can be brought to the front directly from the “Window” menu. On Mac, you should start Blender from the command line.

By adding the Blender executable to the PATH variable this is really simple. Just add the following to your .bash_profile

export PATH="/Applications/blender.app/Contents/MacOS:$PATH"

After that starting Blender from the command line is much simpler.

blender