Skip to content

Commit

Permalink
update to use # r: ...
Browse files Browse the repository at this point in the history
  • Loading branch information
tomvanmele committed Oct 2, 2024
1 parent 1888213 commit caf2b69
Showing 1 changed file with 33 additions and 27 deletions.
60 changes: 33 additions & 27 deletions docs/userguide/cad.rhino8.rst
Original file line number Diff line number Diff line change
@@ -1,57 +1,63 @@
********************************************************************************
Working in Rhino 8
Working in Rhino 8 (with CPython)
********************************************************************************

.. warning::

Support for the new Rhino 8 ScriptEditor is experimental.
Support for the new Rhino 8 Script Editor is experimental.

.. note::

The installation procedures listed here are for using COMPAS with CPython in Rhino 8.
For using COMPAS with IronPython in Rhino 8, see :doc:`/userguide/cad.rhino`.
Rhino 8 supports both CPython and IronPython.
The instructions on this page are for working with COMPAS in the new Script Editor using CPython.
More information about the Script Editor is available here: <https://www.rhino3d.com/features/developer/scripting/>

For working with COMPAS in Rhino 8 with IronPython,
or for information about working in earlier versions of Rhino, see :doc:`/userguide/cad.rhino`.

.. note::

To launch Rhino 8 Script Editor, simply type `ScriptEditor` at the Rhino 8 command prompt.

Installation
============

Rhino 8 comes with its own CPython executable (Python 3.9).
This procedure simply uses that executable and its associated ``pip`` to install COMPAS.
The location of the executable is different on different platforms.
To use COMPAS packages in your Rhino 8 CPython scripts,
you can now simply add the packages as requirements in a comment.

* Windows: ``%USERPROFILE%\.rhinocode\py39-rh8\python.exe``
* macOS: ``~/.rhinocode/py39-rh8/python3.9``
.. code-block:: python
.. note::
#! python3
# r: compas
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:
import compas
from compas.datastructures import Mesh
.. code-block:: bash
mesh = ...
python -m compas_rhino.print_python_path
More information is available here: <https://developer.rhino3d.com/guides/scripting/scripting-command>

Update `pip`
~~~~~~~~~~~~

Before installing `compas` with `pip`, it is highly recommended that you update `pip` itself.
Alternative Method
==================

.. code-block:: bash
The above method only works if the package you want to install is available on `PyPI <https://pypi.org/>`_.
If you want to install a package from local source,
you can use `pip` directly in combination with the Python executable that is included in Rhino.
The default location of the executable is different for Windows and Mac.

$ ~/.rhinocode/py39-rh8/python3.9 -m pip install --upgrade pip
* Windows: ``%USERPROFILE%\.rhinocode\py39-rh8\python.exe``
* macOS: ``~/.rhinocode/py39-rh8/python3.9``

.. code-block:: bash
Install from PyPI
~~~~~~~~~~~~~~~~~
$ cd path/to/compas
$ ~/.rhinocode/py39-rh8/python3.9 -m pip install .
For example on Mac:
To create an editable install, you should update `pip` itself, first.

.. code-block:: bash
$ ~/.rhinocode/py39-rh8/python3.9 -m pip install compas
Install from Source
~~~~~~~~~~~~~~~~~~~
$ ~/.rhinocode/py39-rh8/python3.9 -m pip install --upgrade pip
.. code-block:: bash
Expand Down

0 comments on commit caf2b69

Please sign in to comment.