COMPAS (Mac)
The main library of COMPAS provides flexible data structures, a geometry processing library, robot fundamentals, numerical solvers, and various other components as a base framework for computational AE(F)C research.
0. run python in Rhino
Start Rhino and type "EditPythonScript" in your command line. This will create an IronPython directory automatically in a specific location. on running the command a rhino python editor dialog box opens up. you can close the editor and rhino.
1. Open your Terminal
2. Create an environment and install COMPAS
The recommended way to install COMPAS is with conda, which you should have installed before.
First, we create an environment named csd2
(you could choose any name for the environment) and install COMPAS.
Copy the following line by line into your terminal:
This is how it will look like. Proceed
type y
or just enter
.
Afterwards, simply activate the environment and run the following commands line by line to check if the installation process was successful.
This is how it should look like:
Instead of the(base)
environment, you now have the(csd2)
environment active.
You are using the first officially released version of COMPAS 1.0.0 - yey!
To list all your environments you can run the command conda info --envs
4. Install COMPAS packages PLEASE SKIP THIS SECTION FOR NOW
Besides the COMPAS main library, we will be using the following packages.
4.1 compas_fofin
Make sure you are inside your csd2 environment before!
to do so, see if it says (csd2)
instead of (base)
Copy the following code line into your terminal to install compas_fofin:
Your steps should look like this:
it could be that you get an error when installing that looks like below
In that case copy and paste the follwoing command in your terminal.
After the install has been completed you can try installing the compas_fofin package as described above
4.2 compas_tna
Copy the following line of code into your terminal to install compas_tna:
If the installation was successful, you should see this:
4.3 compas_rv2 for RhinoVAULT2
Copy the following line to install compas_rv2.
Your step should look like this:
If you want to list the installed packages in your environment use conda list
5. COMPAS in VS Code
5.1 Select the Interpreter
Since we are using conda to manage our virtual environments, VS Code has built-in support for them. When a .py file is open on VS Code, the bottom left side of the Status bar will show the Python interpreter used to run scripts. Click on it and a list of all available interpreters including all environments will be shown. Select the csd2
environment, and the next time you run a script, the newly selected interpreter will be used.
5.1 Acces the COMPAS library
Now let's try to open the folder of COMPAS library. Go to File
, Open Folder
. Select compas
folder, then click Open
.
You can find your COMPAS folder somewhere similar to here: /Users/yourname/opt/anaconda3/envs/csd2/lib/python3.8/site-packages/compas
You will see the following.
You can also access the COMPAS library in your own script if you right-click on your object and choose Go to Definition
:
While you type, you should be able to see suggestions. Try the following and you will be able to see them:
from compas.datastructures import Network
If you then right-click on your object and choose Go to Definition
you can access its COMPAS implementation.
If you try the same for from compas.datastructures import Mesh
and you see the following (No definition found for 'Mesh'), go to the Known Issues section and follow the instructions.
6. Install COMPAS in Rhino
Activate the csd2 environment containing the COMPAS installation. Then copy the next line to install COMPAS for Rhino.
You should provide your Rhino version number (6.0, 7.0). The default is 6.0.
Now open your Rhino and enter the command EditPythonScript
. Copy the following code and run the arrow button. You should see 0.19.3
in your output.
Known Issues
What to do if it shows No definition found for 'Mesh' :
we are working on finding the solution and will let you know shortly here and in slack. In any case, this is not crucial for today's session.
Last updated