Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for rhino8 #1267

Merged
merged 14 commits into from Jan 23, 2024
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -146,3 +146,5 @@ NOTES

src/compas_blender/conversions/__temp/
docs/reference/__old/

scripts/
6 changes: 6 additions & 0 deletions CHANGELOG.md
Expand Up @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

* Added `compas_rhino.objects`.
* Added `compas_rhino.layers`.
* Added `compas_rhino.install_with_pip`.

### Changed

* Changed `compas.tolerance.Tolerance` into singleton.
Expand All @@ -18,6 +22,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Removed

* Removed `compas_blender.geometry.curves`.
* Removed `compas_rhino.utilities.objects`.
* Removed `compas_rhino.utilities.layers`.

## [2.0.0-beta.3] 2024-01-19

Expand Down
20 changes: 20 additions & 0 deletions docs/api/compas_rhino.layers.rst
@@ -0,0 +1,20 @@
********************************************************************************
compas_rhino.layers
********************************************************************************

.. currentmodule:: compas_rhino.layers


Functions
=========

.. autosummary::
:toctree: generated/
:nosignatures:

clear_current_layer
clear_layer
create_layers_from_dict
create_layers_from_path
create_layers_from_paths
delete_layers
54 changes: 54 additions & 0 deletions docs/api/compas_rhino.objects.rst
@@ -0,0 +1,54 @@
********************************************************************************
compas_rhino.objects
********************************************************************************

.. currentmodule:: compas_rhino.objects


Functions
=========

.. autosummary::
:toctree: generated/
:nosignatures:

delete_object
delete_objects
get_curves
get_line_coordinates
get_lines
get_objects
get_object_layers
get_object_name
get_object_names
get_object_types
get_object_attributes
get_object_attributes_from_name
get_point_coordinates
get_points
get_point_coordinates
get_polygon_coordinates
get_polyline_coordinates
get_polylines
get_polygons
is_curve_line
is_curve_polyline
is_curve_polygon
purge_objects
select_curve
select_curves
select_line
select_lines
select_mesh
select_meshes
select_object
select_objects
select_point
select_points
select_polygon
select_polygons
select_polyline
select_polylines
select_surface
select_surfaces
set_object_attributes
8 changes: 2 additions & 6 deletions docs/api/index.rst
Expand Up @@ -70,10 +70,6 @@ COMPAS geometry and data structures in Rhino, and for basic user inter interacti

compas_rhino.conversions
compas_rhino.geometry
compas_rhino.layers
compas_rhino.objects
compas_rhino.scene


compas_rhino8
-------------

Coming soon...
123 changes: 122 additions & 1 deletion docs/userguide/cad.rhino8.rst
Expand Up @@ -2,4 +2,125 @@
Working in Rhino 8
********************************************************************************

Once we figure it out, we will let you know :)
.. warning::

Support for the new Rhino 8 ScriptEditor is experimental.

.. info::

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`.


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

The installation of COMPAS in Rhino 8 can be done in two ways:

* by using the ``compas_rhino.install_with_pip`` command, or
* by installing COMPAS in Rhino 8's Python environment using ``pip`` directly.


Using ``pip``
-------------

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.

* Windows: ``%USERPROFILE%\.rhinocode\py39-rh8\python.exe``
* macOS: ``~/.rhinocode/py39-rh8/python3.9``

Install from PyPI
~~~~~~~~~~~~~~~~~

For example on Mac:

.. code-block:: bash

$ ~/.rhinocode/py39-rh8/python3.9 -m pip install compas


Install from Source
~~~~~~~~~~~~~~~~~~~

.. code-block:: bash

$ cd path/to/compas
$ ~/.rhinocode/py39-rh8/python3.9 -m pip install -e .


Using ``compas_rhino.install_with_pip``
tomvanmele marked this conversation as resolved.
Show resolved Hide resolved
---------------------------------------

To simplify the above procedure, ``compas_rhino`` provides a convnience command.

.. warning::

This command is experimental and may not yet work properly on your system.

Install from PyPI
~~~~~~~~~~~~~~~~~

.. code-block:: bash

$ python -m compas_rhino.install_with_pip compas


Install from Source
~~~~~~~~~~~~~~~~~~~

.. code-block:: bash

$ cd /path/to/compas
$ python -m compas_rhino.install_with_pip "-e ."


Verification
============

In Rhino 8, open the Python editor (just type ``ScriptEditor``), open an new ``Python 3`` edito tab, and type the following:

.. code-block:: python

import compas
print(compas.__version__)

If everything is installed correctly, this should print the version number of the installed COMPAS package.


Visualisation
=============

Visualisation of COMPAS objects in Rhino 8 is handled the same way as in other Rhino version, using viualisation scenes.
For more information on visualisation scenes, see :doc:`/userguide/basics.visualisation`.

.. code-block:: python

import compas
from compas.datastructures import Mesh
from compas.scene import Scene

mesh = Mesh.from_obj(compas.get('tubemesh.obj'))

scene = Scene()
scene.clear()
scene.add(mesh)
scene.redraw()


Conversions
===========


Data Exchange
=============


Remote Procedure Calls
======================


Known Issues
============

3 changes: 0 additions & 3 deletions src/compas/__main__.py
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
from __future__ import print_function

import platform

try:
Expand All @@ -11,7 +9,6 @@
import compas

if __name__ == "__main__":

# c = 'DCDHDCACDHDCAEDEACDHDCAEDEACDHDCAEDCDEACDHDCADCACDEADHDCAEDADEACDHDADADADHDCACDCAEDEACDCACDHDCAEDEACDCAEDEACDCAEDBACDHDAEDEACDADADCAEDBADHDAGDEACDADEADCAEDEADHDBADEDCAEDEACDEDAGDHDADCAEDACDCADADADHDAGDADEACAEDADBADHDAGDCADEAEDEACDBADHDAGDCAEDADEACDBADHDBADADADADAGDHDAGDCADEDADBADHDBADADAGDHDEADEAEDEAEDADHDEADEDADEDADHDEACDADCAEDHDACDADCADHDEACDADCAEDHDEACDADCAEDHDEACDADCAEDHDEAFCDADCAEDHDEAEDHDEDH' # noqa: E501
# r = 'fGfB]DSD]BYBHEIEHCXBUCFBYBFCUBSBEBOEOBEBSBQBEPBGBPBEQBOBDBRIRBDBOBNEUGUENBLBECRBCBCBCBRCEBLBKBDBBBDBNBCBEBCBNBDBBBDBKBKDBFCDBIDIDIBDCFBDKBJDBKCCCDDKBCDCCCKBDJBIBDPCBBCBMBCBBCPDBIBIERBCBBBCGCBCDREIBIDBQDEBDCDBEDQBDIBIDBOBDIBCBIBCBOBDIBIDBNBCBKCKBCBNBDIBIBDMDMCMDMDBIBJDBHBFNCNGHBDJBJBDGkGDBJBKBDFBGB[BGBFEKBLBDHCPCPCHELBMBDBWCWBDBMBOEBUCUBEOBPBEBSCSBEBPBRBEBQCQBEBRBUBECMCMCECTBXBFBDGCGDGCWB[DXC[BbObB' # noqa: E501
# maps = ' !-X_`|\n' if compas.IPY or compas.WINDOWS else ' ▌▀█▄`▐\n'
Expand Down
2 changes: 1 addition & 1 deletion src/compas/rpc/__main__.py
Expand Up @@ -3,7 +3,7 @@
from compas.rpc.services.default import start_service

try:
from xmlrpclib import ServerProxy
from xmlrpclib import ServerProxy # type: ignore
except ImportError:
from xmlrpc.client import ServerProxy

Expand Down