Skip to content

Commit

Permalink
docs and doctests
Browse files Browse the repository at this point in the history
  • Loading branch information
tomvanmele committed Jan 27, 2024
1 parent 1de0d67 commit 76f6c2e
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 12 deletions.
2 changes: 2 additions & 0 deletions docs/api/compas_pythreejs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ compas_pythreejs

.. toctree::
:maxdepth: 1

compas_pythreejs.scene
25 changes: 25 additions & 0 deletions docs/api/compas_pythreejs.scene.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
********************************************************************************
compas_pythreejs.scene
********************************************************************************

.. currentmodule:: compas_pythreejs.scene

Classes
=======

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

compas_pythreejs.scene.BoxObject
compas_pythreejs.scene.ConeObject
compas_pythreejs.scene.CylinderObject
compas_pythreejs.scene.MeshObject
compas_pythreejs.scene.PolyhedronObject
compas_pythreejs.scene.SphereObject
compas_pythreejs.scene.ThreeSceneObject
compas_pythreejs.scene.TorusObject


Plugins
=======
21 changes: 21 additions & 0 deletions docs/installation.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
********************************************************************************
Installation
********************************************************************************

Stable
======

Stable releases are available on PyPI and can be installed with pip.

.. code-block:: bash
pip install compas_pythreejs
Latest
======

The latest version can be installed from local source.

.. code-block:: bash
git clone https://github.com/compas-dev/compas_pythreejs.git
cd compas_pythreejs
pip install -e .
3 changes: 3 additions & 0 deletions docs/tutorial.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
********************************************************************************
Tutorial
********************************************************************************

This tutorial demonstrates how to use :mod:`compas_pythreejs` as a scene plugin for COMPAS.

8 changes: 4 additions & 4 deletions src/compas_pythreejs/conversions/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def cone_to_threejs(cone: Cone) -> three.CylinderGeometry:
>>> from compas.geometry import Cone
>>> cone = Cone(radius=1, height=2)
>>> cone_to_threejs(cone)
CylinderGeometry()
CylinderGeometry(height=2.0, radiusTop=0.0)
"""
return three.CylinderGeometry(radiusTop=0, radiusBottom=cone.radius, height=cone.height)
Expand All @@ -72,7 +72,7 @@ def cylinder_to_threejs(cylinder: Cylinder) -> three.CylinderGeometry:
>>> from compas.geometry import Cylinder
>>> cylinder = Cylinder(radius=1, height=2)
>>> cylinder_to_threejs(cylinder)
CylinderGeometry()
CylinderGeometry(height=2.0)
"""
return three.CylinderGeometry(radiusTop=cylinder.radius, radiusBottom=cylinder.radius, height=cylinder.height)
Expand Down Expand Up @@ -118,9 +118,9 @@ def torus_to_threejs(torus: Torus) -> three.TorusGeometry:
Examples
--------
>>> from compas.geometry import Torus
>>> torus = Torus(radius=1, thickness=0.2)
>>> torus = Torus(radius_axis=1, radius_pipe=0.2)
>>> torus_to_threejs(torus)
TorusGeometry()
TorusGeometry(tube=0.2)
"""
return three.TorusGeometry(radius=torus.radius_axis, tube=torus.radius_pipe)
9 changes: 1 addition & 8 deletions src/compas_pythreejs/scene/sceneobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,7 @@


class ThreeSceneObject(SceneObject):
"""Base class for all PyThreeJS scene objects.
Parameters
----------
**kwargs : dict, optional
Additional keyword arguments.
"""
"""Base class for all PyThreeJS scene objects."""

def geometry_to_objects(self, geometry, color, contrastcolor):
"""Convert a PyThreeJS geometry to a list of PyThreeJS objects.
Expand Down

0 comments on commit 76f6c2e

Please sign in to comment.