|
1 | 1 | ******************************************************************************** |
2 | | -Working in Rhino 8 |
| 2 | +Working in Rhino 8 (with CPython) |
3 | 3 | ******************************************************************************** |
4 | 4 |
|
5 | 5 | .. warning:: |
6 | 6 |
|
7 | | - Support for the new Rhino 8 ScriptEditor is experimental. |
| 7 | + Support for the new Rhino 8 Script Editor is experimental. |
8 | 8 |
|
9 | | -.. note:: |
10 | 9 |
|
11 | | - The installation procedures listed here are for using COMPAS with CPython in Rhino 8. |
12 | | - For using COMPAS with IronPython in Rhino 8, see :doc:`/userguide/cad.rhino`. |
| 10 | +Rhino 8 supports both CPython and IronPython. |
| 11 | +The instructions on this page are for working with COMPAS in the new Script Editor using CPython. |
| 12 | +More information about the Script Editor is available here: <https://www.rhino3d.com/features/developer/scripting/> |
| 13 | + |
| 14 | +For working with COMPAS in Rhino 8 with IronPython, |
| 15 | +or for information about working in earlier versions of Rhino, see :doc:`/userguide/cad.rhino`. |
13 | 16 |
|
| 17 | +.. note:: |
| 18 | + |
| 19 | + To launch Rhino 8 Script Editor, simply type `ScriptEditor` at the Rhino 8 command prompt. |
14 | 20 |
|
15 | 21 | Installation |
16 | 22 | ============ |
17 | 23 |
|
18 | | -Rhino 8 comes with its own CPython executable (Python 3.9). |
19 | | -This procedure simply uses that executable and its associated ``pip`` to install COMPAS. |
20 | | -The location of the executable is different on different platforms. |
| 24 | +To use COMPAS packages in your Rhino 8 CPython scripts, |
| 25 | +you can now simply add the packages as requirements in a comment. |
21 | 26 |
|
22 | | -* Windows: ``%USERPROFILE%\.rhinocode\py39-rh8\python.exe`` |
23 | | -* macOS: ``~/.rhinocode/py39-rh8/python3.9`` |
| 27 | +.. code-block:: python |
24 | 28 |
|
25 | | -.. note:: |
| 29 | + #! python3 |
| 30 | + # r: compas |
26 | 31 |
|
27 | | - If you already have an installation of COMPAS on your system, you can try finding the Rhino 8 Python executable by running the following in a terminal or command prompt: |
| 32 | + import compas |
| 33 | + from compas.datastructures import Mesh |
28 | 34 |
|
29 | | - .. code-block:: bash |
| 35 | + mesh = ... |
30 | 36 |
|
31 | | - python -m compas_rhino.print_python_path |
| 37 | +More information is available here: <https://developer.rhino3d.com/guides/scripting/scripting-command> |
32 | 38 |
|
33 | | -Update `pip` |
34 | | -~~~~~~~~~~~~ |
35 | 39 |
|
36 | | -Before installing `compas` with `pip`, it is highly recommended that you update `pip` itself. |
| 40 | +Alternative Method |
| 41 | +================== |
37 | 42 |
|
38 | | -.. code-block:: bash |
| 43 | +The above method only works if the package you want to install is available on `PyPI <https://pypi.org/>`_. |
| 44 | +If you want to install a package from local source, |
| 45 | +you can use `pip` directly in combination with the Python executable that is included in Rhino. |
| 46 | +The default location of the executable is different for Windows and Mac. |
39 | 47 |
|
40 | | - $ ~/.rhinocode/py39-rh8/python3.9 -m pip install --upgrade pip |
| 48 | +* Windows: ``%USERPROFILE%\.rhinocode\py39-rh8\python.exe`` |
| 49 | +* macOS: ``~/.rhinocode/py39-rh8/python3.9`` |
41 | 50 |
|
| 51 | +.. code-block:: bash |
42 | 52 |
|
43 | | -Install from PyPI |
44 | | -~~~~~~~~~~~~~~~~~ |
| 53 | + $ cd path/to/compas |
| 54 | + $ ~/.rhinocode/py39-rh8/python3.9 -m pip install . |
45 | 55 |
|
46 | | -For example on Mac: |
| 56 | +To create an editable install, you should update `pip` itself, first. |
47 | 57 |
|
48 | 58 | .. code-block:: bash |
49 | 59 |
|
50 | | - $ ~/.rhinocode/py39-rh8/python3.9 -m pip install compas |
51 | | -
|
52 | | -
|
53 | | -Install from Source |
54 | | -~~~~~~~~~~~~~~~~~~~ |
| 60 | + $ ~/.rhinocode/py39-rh8/python3.9 -m pip install --upgrade pip |
55 | 61 |
|
56 | 62 | .. code-block:: bash |
57 | 63 |
|
|
0 commit comments