diff --git a/CHANGELOG.md b/CHANGELOG.md index d81aa4b27c2..2482dc698aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -92,6 +92,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Changed `compas.tolerance.Tolerance` to a singleton, to ensure having only library-wide tolerance values. * Updated `compas_rhino.conversions.point_to_compas` to allow for `Rhino.Geometry.Point` as input. * Changed `compas.datastructures.Tree.print_hierarchy` to `compas.datastructures.Tree.__str__`. +* Changed `compas.scene.SceneObject.__init__` to accept `item` as kwarg. * Fixed `compas.geometry.bbox_numpy.minimum_volume_box` to avoid `numpy.linalg.LinAlgError`. ### Removed diff --git a/src/compas/scene/geometryobject.py b/src/compas/scene/geometryobject.py index 952df6be11c..3b209915c14 100644 --- a/src/compas/scene/geometryobject.py +++ b/src/compas/scene/geometryobject.py @@ -2,6 +2,8 @@ from __future__ import division from __future__ import print_function +import compas.colors # noqa: F401 + from .descriptors.color import ColorAttribute from .sceneobject import SceneObject @@ -41,16 +43,19 @@ class GeometryObject(SceneObject): linecolor = ColorAttribute() surfacecolor = ColorAttribute() - def __init__(self, geometry, **kwargs): - super(GeometryObject, self).__init__(item=geometry, **kwargs) - self.geometry = geometry - self.pointcolor = kwargs.get("pointcolor", self.color) - self.linecolor = kwargs.get("linecolor", self.color) - self.surfacecolor = kwargs.get("surfacecolor", self.color) - self.pointsize = kwargs.get("pointsize", 1.0) - self.linewidth = kwargs.get("linewidth", 1.0) - self.show_points = kwargs.get("show_points", False) - self.show_lines = kwargs.get("show_lines", True) - self.show_surfaces = kwargs.get("show_surfaces", True) - # note: either lines should be renamed to curves - # or surfaces should be renamed to faces? + def __init__(self, pointcolor=None, linecolor=None, surfacecolor=None, pointsize=1.0, linewidth=1.0, show_points=False, show_lines=True, show_surfaces=True, **kwargs): + # type: (compas.colors.Color | None, compas.colors.Color | None, compas.colors.Color | None, float, float, bool, bool, bool, dict) -> None + super(GeometryObject, self).__init__(**kwargs) + self.pointcolor = pointcolor or self.color + self.linecolor = linecolor or self.color + self.surfacecolor = surfacecolor or self.color + self.pointsize = pointsize + self.linewidth = linewidth + self.show_points = show_points + self.show_lines = show_lines + self.show_surfaces = show_surfaces + + @property + def geometry(self): + """The geometry of the geometry object.""" + return self.item diff --git a/src/compas/scene/graphobject.py b/src/compas/scene/graphobject.py index 15f28e51b13..963361dea36 100644 --- a/src/compas/scene/graphobject.py +++ b/src/compas/scene/graphobject.py @@ -26,6 +26,10 @@ class GraphObject(SceneObject): node_xyz : dict[hashable, list[float]] Mapping between nodes and their view coordinates. The default view coordinates are the actual coordinates of the nodes of the graph. + show_nodes : Union[bool, sequence[hashable]] + Flag for showing or hiding the nodes. Default is ``True``. + show_edges : Union[bool, sequence[tuple[hashable, hashable]]] + Flag for showing or hiding the edges. Default is ``True``. nodecolor : :class:`compas.colors.ColorDict` Mapping between nodes and RGB color values. edgecolor : :class:`compas.colors.ColorDict` @@ -34,10 +38,6 @@ class GraphObject(SceneObject): The size of the nodes. Default is ``1.0``. edgewidth : float The width of the edges. Default is ``1.0``. - show_nodes : Union[bool, sequence[hashable]] - Flag for showing or hiding the nodes. Default is ``True``. - show_edges : Union[bool, sequence[tuple[hashable, hashable]]] - Flag for showing or hiding the edges. Default is ``True``. See Also -------- @@ -49,12 +49,10 @@ class GraphObject(SceneObject): nodecolor = ColorDictAttribute() edgecolor = ColorDictAttribute() - def __init__(self, graph, show_nodes=True, show_edges=True, nodecolor=None, edgecolor=None, nodesize=1.0, edgewidth=1.0, **kwargs): - # type: (compas.datastructures.Graph, bool | list, bool | list, compas.colors.Color | dict | None, compas.colors.Color | dict | None, float | dict, float | dict, dict) -> None - super(GraphObject, self).__init__(item=graph, **kwargs) - self._graph = None + def __init__(self, show_nodes=True, show_edges=True, nodecolor=None, edgecolor=None, nodesize=1.0, edgewidth=1.0, **kwargs): + # type: (bool | list, bool | list, dict | compas.colors.Color | None, dict | compas.colors.Color | None, float, float, dict) -> None + super(GraphObject, self).__init__(**kwargs) self._node_xyz = None - self.graph = graph self.show_nodes = show_nodes self.show_edges = show_edges self.nodecolor = nodecolor or self.color @@ -77,12 +75,12 @@ def settings(self): @property def graph(self): # type: () -> compas.datastructures.Graph - return self._graph + return self.item @graph.setter def graph(self, graph): # type: (compas.datastructures.Graph) -> None - self._graph = graph + self._item = graph self._transformation = None self._node_xyz = None diff --git a/src/compas/scene/meshobject.py b/src/compas/scene/meshobject.py index 75cf222fac4..b438c964830 100644 --- a/src/compas/scene/meshobject.py +++ b/src/compas/scene/meshobject.py @@ -26,8 +26,15 @@ class MeshObject(SceneObject): vertex_xyz : dict[int, list[float]] View coordinates of the vertices. Defaults to the real coordinates. - color : :class:`compas.colors.Color` - The base RGB color of the mesh. + show_vertices : Union[bool, sequence[float]] + Flag for showing or hiding the vertices, or a list of keys for the vertices to show. + Default is ``False``. + show_edges : Union[bool, sequence[tuple[int, int]]] + Flag for showing or hiding the edges, or a list of keys for the edges to show. + Default is ``True``. + show_faces : Union[bool, sequence[int]] + Flag for showing or hiding the faces, or a list of keys for the faces to show. + Default is ``True``. vertexcolor : :class:`compas.colors.ColorDict` Vertex colors. edgecolor : :class:`compas.colors.ColorDict` @@ -38,15 +45,6 @@ class MeshObject(SceneObject): The size of the vertices. Default is ``1.0``. edgewidth : float The width of the edges. Default is ``1.0``. - show_vertices : Union[bool, sequence[float]] - Flag for showing or hiding the vertices, or a list of keys for the vertices to show. - Default is ``False``. - show_edges : Union[bool, sequence[tuple[int, int]]] - Flag for showing or hiding the edges, or a list of keys for the edges to show. - Default is ``True``. - show_faces : Union[bool, sequence[int]] - Flag for showing or hiding the faces, or a list of keys for the faces to show. - Default is ``True``. See Also -------- @@ -59,12 +57,10 @@ class MeshObject(SceneObject): edgecolor = ColorDictAttribute() facecolor = ColorDictAttribute() - def __init__(self, mesh, show_vertices=False, show_edges=False, show_faces=True, vertexcolor=None, edgecolor=None, facecolor=None, vertexsize=1.0, edgewidth=1.0, **kwargs): - # type: (compas.datastructures.Mesh, bool | list, bool | list, bool | list, compas.colors.Color | dict, compas.colors.Color | dict, compas.colors.Color | dict, float | dict, float | dict, dict) -> None - super(MeshObject, self).__init__(item=mesh, **kwargs) - self._mesh = None + def __init__(self, show_vertices=False, show_edges=False, show_faces=True, vertexcolor=None, edgecolor=None, facecolor=None, vertexsize=1.0, edgewidth=1.0, **kwargs): + # type: (bool | list, bool | list, bool | list, dict | compas.colors.Color | None, dict | compas.colors.Color | None, dict | compas.colors.Color | None, float, float, dict) -> None + super(MeshObject, self).__init__(**kwargs) self._vertex_xyz = None - self.mesh = mesh self.show_vertices = show_vertices self.show_edges = show_edges self.show_faces = show_faces @@ -93,12 +89,12 @@ def settings(self): @property def mesh(self): # type: () -> compas.datastructures.Mesh - return self._mesh + return self.item @mesh.setter def mesh(self, mesh): # type: (compas.datastructures.Mesh) -> None - self._mesh = mesh + self._item = mesh self._transformation = None self._vertex_xyz = None diff --git a/src/compas/scene/scene.py b/src/compas/scene/scene.py index a6d95966be2..680c9a6a4e0 100644 --- a/src/compas/scene/scene.py +++ b/src/compas/scene/scene.py @@ -106,7 +106,7 @@ def add(self, item, parent=None, **kwargs): if kwargs["context"] != self.context: raise Exception("Object context should be the same as scene context: {} != {}".format(kwargs["context"], self.context)) del kwargs["context"] # otherwist the SceneObject receives "context" twice, which results in an error - sceneobject = SceneObject(item, context=self.context, **kwargs) # type: ignore + sceneobject = SceneObject(item=item, context=self.context, **kwargs) # type: ignore super(Scene, self).add(sceneobject, parent=parent) return sceneobject diff --git a/src/compas/scene/sceneobject.py b/src/compas/scene/sceneobject.py index 51988a7bcea..02fe040322a 100644 --- a/src/compas/scene/sceneobject.py +++ b/src/compas/scene/sceneobject.py @@ -10,6 +10,7 @@ import compas.datastructures # noqa: F401 import compas.geometry # noqa: F401 from compas.colors import Color +from compas.data import Data from compas.datastructures import TreeNode from compas.geometry import Transformation @@ -82,13 +83,14 @@ class SceneObject(TreeNode): color = ColorAttribute() - def __new__(cls, item, **kwargs): + def __new__(cls, item=None, **kwargs): sceneobject_cls = get_sceneobject_cls(item, **kwargs) return super(SceneObject, cls).__new__(sceneobject_cls) - def __init__(self, item, name=None, color=None, opacity=1.0, show=True, frame=None, transformation=None, context=None, **kwargs): # fmt: skip - # type: (compas.geometry.Geometry | compas.datastructures.Datastructure, str | None, compas.colors.Color | None, float, bool, compas.geometry.Frame | None, compas.geometry.Transformation | None, str | None, dict) -> None - super(SceneObject, self).__init__(name=name or item.name, **kwargs) + def __init__(self, item=None, name=None, color=None, opacity=1.0, show=True, frame=None, transformation=None, context=None, **kwargs): # fmt: skip + # type: (compas.data.Data | None, str | None, compas.colors.Color | None, float, bool, compas.geometry.Frame | None, compas.geometry.Transformation | None, str | None, dict) -> None + name = item.name if isinstance(item, Data) and name is None else name + super(SceneObject, self).__init__(name=name, **kwargs) # the scene object needs to store the context # because it has no access to the tree and/or the scene before it is added # which means that adding child objects will be added in context "None" @@ -237,7 +239,7 @@ def add(self, item, **kwargs): if kwargs["context"] != self.context: raise Exception("Child context should be the same as parent context: {} != {}".format(kwargs["context"], self.context)) del kwargs["context"] # otherwist the SceneObject receives "context" twice, which results in an error - sceneobject = SceneObject(item, context=self.context, **kwargs) # type: ignore + sceneobject = SceneObject(item=item, context=self.context, **kwargs) # type: ignore super(SceneObject, self).add(sceneobject) return sceneobject diff --git a/src/compas/scene/volmeshobject.py b/src/compas/scene/volmeshobject.py index ecc8fcc0a67..1004c1b0ffa 100644 --- a/src/compas/scene/volmeshobject.py +++ b/src/compas/scene/volmeshobject.py @@ -68,7 +68,6 @@ class VolMeshObject(SceneObject): def __init__( self, - volmesh, show_vertices=False, show_edges=True, show_faces=False, @@ -79,13 +78,11 @@ def __init__( cellcolor=None, vertexsize=1.0, edgewidth=1.0, - **kwargs, + **kwargs, # fmt: skip ): - # type: (compas.datastructures.VolMesh, bool | list, bool | list, bool | list, bool | list, compas.colors.Color | dict, compas.colors.Color | dict, compas.colors.Color | dict, compas.colors.Color | dict, float | dict, float | dict, dict) -> None - super(VolMeshObject, self).__init__(item=volmesh, **kwargs) - self._volmesh = None + # type: (bool | list, bool | list, bool | list, bool | list, compas.colors.Color | dict, compas.colors.Color | dict, compas.colors.Color | dict, compas.colors.Color | dict, float | dict, float | dict, dict) -> None + super(VolMeshObject, self).__init__(**kwargs) self._vertex_xyz = None - self.volmesh = volmesh self.show_vertices = show_vertices self.show_edges = show_edges self.show_faces = show_faces @@ -114,12 +111,12 @@ def settings(self): @property def volmesh(self): # type: () -> compas.datastructures.VolMesh - return self._volmesh + return self.item @volmesh.setter def volmesh(self, volmesh): # type: (compas.datastructures.VolMesh) -> None - self._volmesh = volmesh + self._item = volmesh self._transformation = None self._vertex_xyz = None diff --git a/src/compas_blender/scene/boxobject.py b/src/compas_blender/scene/boxobject.py index 38952936fce..7da0b47379f 100644 --- a/src/compas_blender/scene/boxobject.py +++ b/src/compas_blender/scene/boxobject.py @@ -1,8 +1,5 @@ -from typing import Any - import bpy # type: ignore -from compas.geometry import Box from compas.scene import GeometryObject from compas_blender import conversions @@ -10,20 +7,7 @@ class BoxObject(BlenderSceneObject, GeometryObject): - """Scene object for drawing box shapes in Blender. - - Parameters - ---------- - box : :class:`compas.geometry.Box` - A COMPAS box. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, box: Box, **kwargs: Any): - super().__init__(geometry=box, **kwargs) - self.geometry: Box + """Scene object for drawing box shapes in Blender.""" def draw(self) -> list[bpy.types.Object]: """Draw the box associated with the scene object. diff --git a/src/compas_blender/scene/circleobject.py b/src/compas_blender/scene/circleobject.py index 3a5a15b18a0..f45b9251f61 100644 --- a/src/compas_blender/scene/circleobject.py +++ b/src/compas_blender/scene/circleobject.py @@ -1,29 +1,15 @@ -from typing import Any from typing import Optional import bpy # type: ignore from compas.colors import Color -from compas.geometry import Circle from compas.scene import GeometryObject from .sceneobject import BlenderSceneObject class CircleObject(BlenderSceneObject, GeometryObject): - """Scene object for drawing circles in Blender. - - Parameters - ---------- - circle : :class:`compas.geometry.Circle` - A COMPAS circle. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, circle: Circle, **kwargs: Any): - super().__init__(geometry=circle, **kwargs) + """Scene object for drawing circles in Blender.""" def draw(self, color: Optional[Color] = None, collection: Optional[str] = None) -> list[bpy.types.Object]: """Draw the circle. @@ -47,7 +33,7 @@ def draw(self, color: Optional[Color] = None, collection: Optional[str] = None) obj = bpy.context.object self.objects.append(obj) - self.update_object(obj, color=color, collection=collection, transformation=self.geometry.transformation) + self.update_object(obj, color=color, collection=collection) self._guids = [obj] return self.guids diff --git a/src/compas_blender/scene/curveobject.py b/src/compas_blender/scene/curveobject.py index 39244369711..96e7617db0a 100644 --- a/src/compas_blender/scene/curveobject.py +++ b/src/compas_blender/scene/curveobject.py @@ -1,10 +1,8 @@ -from typing import Any from typing import Optional import bpy # type: ignore from compas.colors import Color -from compas.geometry import Curve from compas.scene import GeometryObject from compas_blender import conversions @@ -12,19 +10,7 @@ class CurveObject(BlenderSceneObject, GeometryObject): - """Scene object for drawing curves in Blender. - - Parameters - ---------- - curve : :class:`compas.geometry.Curve` - A COMPAS curve. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, curve: Curve, **kwargs: Any): - super().__init__(geometry=curve, **kwargs) + """Scene object for drawing curves in Blender.""" def draw( self, diff --git a/src/compas_blender/scene/frameobject.py b/src/compas_blender/scene/frameobject.py index 8c58e5d1fbb..7a4a7e65d19 100644 --- a/src/compas_blender/scene/frameobject.py +++ b/src/compas_blender/scene/frameobject.py @@ -4,7 +4,6 @@ import bpy # type: ignore from compas.colors import Color -from compas.geometry import Frame from compas.geometry import Line from compas.scene import GeometryObject from compas_blender import conversions @@ -17,8 +16,6 @@ class FrameObject(BlenderSceneObject, GeometryObject): Parameters ---------- - frame: :class:`compas.geometry.Frame` - A COMPAS frame. scale : float, optional Scale of the frame axes. **kwargs : dict, optional @@ -40,8 +37,8 @@ class FrameObject(BlenderSceneObject, GeometryObject): """ - def __init__(self, frame: Frame, scale=1.0, **kwargs: Any): - super().__init__(geometry=frame, **kwargs) + def __init__(self, scale=1.0, **kwargs: Any): + super().__init__(**kwargs) self.scale = scale self.color_origin = Color.black() self.color_xaxis = Color.red() diff --git a/src/compas_blender/scene/graphobject.py b/src/compas_blender/scene/graphobject.py index d5593e03332..551c33e0041 100644 --- a/src/compas_blender/scene/graphobject.py +++ b/src/compas_blender/scene/graphobject.py @@ -4,7 +4,6 @@ import compas_blender import compas_blender.objects -from compas.datastructures import Graph from compas.geometry import Line from compas.geometry import Sphere from compas.scene import GraphObject as BaseGraphObject @@ -18,13 +17,32 @@ class GraphObject(BlenderSceneObject, BaseGraphObject): Parameters ---------- - graph : :class:`compas.datastructures.Graph` - A COMPAS graph. + node_u : int, optional + Number of segments in the U direction of the node spheres. + Default is ``16``. + node_v : int, optional + Number of segments in the V direction of the node spheres. + Default is ``16``. + **kwargs : dict, optional + Additional keyword arguments. + For more info, + see :class:`compas_blender.scene.BlenderSceneObject` and :class:`compas.scene.GraphObject`. + + Attributes + ---------- + node_u : int + Number of segments in the U direction of the node spheres. + node_v : int + Number of segments in the V direction of the node spheres. + nodeobjects : list[:blender:`bpy.types.Object`] + List of Blender objects representing the nodes. + edgeobjects : list[:blender:`bpy.types.Object`] + List of Blender objects representing the edges. """ - def __init__(self, graph: Graph, node_u=16, node_v=16, **kwargs: dict): - super().__init__(graph=graph, **kwargs) + def __init__(self, node_u=16, node_v=16, **kwargs: dict): + super().__init__(**kwargs) self.nodeobjects = [] self.edgeobjects = [] self.node_u = node_u @@ -85,7 +103,7 @@ def draw_nodes(self) -> List[bpy.types.Object]: for node in nodes: name = f"{self.graph.name}.node.{node}" color = self.nodecolor[node] - point = self.node_xyz[node] + point = self.graph.node_coordinates(node) # # there is no such thing as a sphere data block # # this doesn't work with application of worl transformation matrix @@ -119,7 +137,7 @@ def draw_edges(self) -> List[bpy.types.Object]: for u, v in edges: name = f"{self.graph.name}.edge.{u}-{v}" color = self.edgecolor[u, v] - curve = conversions.line_to_blender_curve(Line(self.node_xyz[u], self.node_xyz[v])) + curve = conversions.line_to_blender_curve(Line(self.graph.node_coordinates(u), self.graph.node_coordinates(v))) obj = self.create_object(curve, name=name) self.update_object(obj, color=color, collection=self.collection) diff --git a/src/compas_blender/scene/lineobject.py b/src/compas_blender/scene/lineobject.py index 88cd3c96b9f..b49d29996cf 100644 --- a/src/compas_blender/scene/lineobject.py +++ b/src/compas_blender/scene/lineobject.py @@ -1,10 +1,8 @@ -from typing import Any from typing import Optional import bpy # type: ignore from compas.colors import Color -from compas.geometry import Line from compas.scene import GeometryObject from compas_blender import conversions @@ -12,21 +10,7 @@ class LineObject(BlenderSceneObject, GeometryObject): - """Scene object for drawing lines in Blender. - - Parameters - ---------- - line : :class:`compas.geometry.Line` - A COMPAS line. - **kwargs : dict, optional - Additional keyword arguments. - For more info, - see :class:`compas_blender.scene.BlenderSceneObject` and :class:`compas.scene.GeometryObject`. - - """ - - def __init__(self, line: Line, **kwargs: Any): - super().__init__(geometry=line, **kwargs) + """Scene object for drawing lines in Blender.""" def draw( self, diff --git a/src/compas_blender/scene/meshobject.py b/src/compas_blender/scene/meshobject.py index ed963722d03..315201ac2a0 100644 --- a/src/compas_blender/scene/meshobject.py +++ b/src/compas_blender/scene/meshobject.py @@ -5,7 +5,6 @@ import compas_blender import compas_blender.objects -from compas.datastructures import Mesh from compas.geometry import Line from compas.geometry import Sphere from compas.scene import MeshObject as BaseMeshObject @@ -19,13 +18,34 @@ class MeshObject(BlenderSceneObject, BaseMeshObject): Parameters ---------- - mesh : :class:`compas.datastructures.Mesh` - A COMPAS mesh. + vertex_u : int, optional + Number of segments in the U direction of the vertex spheres. + Default is ``16``. + vertex_v : int, optional + Number of segments in the V direction of the vertex spheres. + Default is ``16``. + **kwargs : dict, optional + Additional keyword arguments. + For more info, + see :class:`compas_blender.scene.BlenderSceneObject` and :class:`compas.scene.MeshObject`. + + Attributes + ---------- + vertex_u : int + Number of segments in the U direction of the vertex spheres. + vertex_v : int + Number of segments in the V direction of the vertex spheres. + vertexobjects : list[:blender:`bpy.types.Object`] + List of Blender objects representing the vertices. + edgeobjects : list[:blender:`bpy.types.Object`] + List of Blender objects representing the edges. + faceobjects : list[:blender:`bpy.types.Object`] + List of Blender objects representing the faces. """ - def __init__(self, mesh: Mesh, vertex_u=16, vertex_v=16, **kwargs: Any): - super().__init__(mesh=mesh, **kwargs) + def __init__(self, vertex_u=16, vertex_v=16, **kwargs: Any): + super().__init__(**kwargs) self.vertexobjects = [] self.edgeobjects = [] self.faceobjects = [] @@ -120,7 +140,7 @@ def draw_vertices(self) -> List[bpy.types.Object]: for vertex in vertices: name = f"{self.mesh.name}.vertex.{vertex}" color = self.vertexcolor[vertex] - point = self.vertex_xyz[vertex] + point = self.mesh.vertex_coordinates(vertex) # # there is no such thing as a sphere data block # bpy.ops.mesh.primitive_uv_sphere_add(location=point, radius=radius, segments=u, ring_count=v) @@ -153,7 +173,7 @@ def draw_edges(self) -> List[bpy.types.Object]: for u, v in edges: name = f"{self.mesh.name}.edge.{u}-{v}" color = self.edgecolor[u, v] - curve = conversions.line_to_blender_curve(Line(self.vertex_xyz[u], self.vertex_xyz[v])) + curve = conversions.line_to_blender_curve(Line(self.mesh.vertex_coordinates(u), self.mesh.vertex_coordinates(v))) obj = self.create_object(curve, name=name) self.update_object(obj, color=color, collection=self.collection) @@ -177,7 +197,7 @@ def draw_faces(self) -> List[bpy.types.Object]: for face in faces: name = f"{self.mesh.name}.face.{face}" color = self.facecolor[face] - points = [self.vertex_xyz[vertex] for vertex in self.mesh.face_vertices(face)] + points = [self.mesh.vertex_coordinates(vertex) for vertex in self.mesh.face_vertices(face)] mesh = conversions.polygon_to_blender_mesh(points, name=name) obj = self.create_object(mesh, name=name) diff --git a/src/compas_blender/scene/planeobject.py b/src/compas_blender/scene/planeobject.py index 320692d2f90..cbf3c5a27a1 100644 --- a/src/compas_blender/scene/planeobject.py +++ b/src/compas_blender/scene/planeobject.py @@ -6,7 +6,6 @@ from compas.colors import Color from compas.geometry import Frame from compas.geometry import Line -from compas.geometry import Plane from compas.scene import GeometryObject from compas_blender import conversions @@ -18,8 +17,6 @@ class PlaneObject(BlenderSceneObject, GeometryObject): Parameters ---------- - plane: :class:`compas.geometry.Plane` - A COMPAS plane. scale : float, optional Scale of the plane. **kwargs : dict, optional @@ -34,8 +31,8 @@ class PlaneObject(BlenderSceneObject, GeometryObject): """ - def __init__(self, plane: Plane, scale=1.0, **kwargs: Any): - super().__init__(geometry=plane, **kwargs) + def __init__(self, scale=1.0, **kwargs: Any): + super().__init__(**kwargs) self.scale = scale def draw(self, color: Optional[Color] = None, collection: Optional[str] = None) -> list[bpy.types.Object]: diff --git a/src/compas_blender/scene/pointcloudobject.py b/src/compas_blender/scene/pointcloudobject.py index 26093a3e9bb..4ffa7eebd14 100644 --- a/src/compas_blender/scene/pointcloudobject.py +++ b/src/compas_blender/scene/pointcloudobject.py @@ -1,10 +1,8 @@ -from typing import Any from typing import Optional import bpy # type: ignore from compas.colors import Color -from compas.geometry import Point from compas.scene import GeometryObject from compas_blender import conversions @@ -12,19 +10,7 @@ class PointcloudObject(BlenderSceneObject, GeometryObject): - """Scene object for drawing pointclouds in Blender. - - Parameters - ---------- - pointcloud : :class:`compas.geometry.Pointcloud` - A COMPAS point. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, point: Point, **kwargs: Any): - super().__init__(geometry=point, **kwargs) + """Scene object for drawing pointclouds in Blender.""" def draw( self, diff --git a/src/compas_blender/scene/pointobject.py b/src/compas_blender/scene/pointobject.py index 3da3c63d083..1eee9eb6a89 100644 --- a/src/compas_blender/scene/pointobject.py +++ b/src/compas_blender/scene/pointobject.py @@ -1,29 +1,15 @@ -from typing import Any from typing import Optional import bpy # type: ignore from compas.colors import Color -from compas.geometry import Point from compas.scene import GeometryObject from .sceneobject import BlenderSceneObject class PointObject(BlenderSceneObject, GeometryObject): - """Scene object for drawing points in Blender. - - Parameters - ---------- - point : :class:`compas.geometry.Point` - A COMPAS point. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, point: Point, **kwargs: Any): - super().__init__(geometry=point, **kwargs) + """Scene object for drawing points in Blender.""" def draw( self, diff --git a/src/compas_blender/scene/polygonobject.py b/src/compas_blender/scene/polygonobject.py index 2bbef35640d..7f9c694e88d 100644 --- a/src/compas_blender/scene/polygonobject.py +++ b/src/compas_blender/scene/polygonobject.py @@ -1,10 +1,8 @@ -from typing import Any from typing import Optional import bpy # type: ignore from compas.colors import Color -from compas.geometry import Polygon from compas.scene import GeometryObject from compas_blender import conversions @@ -12,19 +10,7 @@ class PolygonObject(BlenderSceneObject, GeometryObject): - """Scene object for drawing polygons in Blender. - - Parameters - ---------- - polygon : :class:`compas.geometry.Polygon` - A COMPAS polygon. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, polygon: Polygon, **kwargs: Any): - super().__init__(geometry=polygon, **kwargs) + """Scene object for drawing polygons in Blender.""" def draw( self, diff --git a/src/compas_blender/scene/polyhedronobject.py b/src/compas_blender/scene/polyhedronobject.py index 8e0384087cc..60e77304a92 100644 --- a/src/compas_blender/scene/polyhedronobject.py +++ b/src/compas_blender/scene/polyhedronobject.py @@ -1,10 +1,8 @@ -from typing import Any from typing import Optional import bpy # type: ignore from compas.colors import Color -from compas.geometry import Polyhedron from compas.scene import GeometryObject from compas_blender import conversions @@ -12,19 +10,7 @@ class PolyhedronObject(BlenderSceneObject, GeometryObject): - """Scene object for drawing polyhedron shapes in Blender. - - Parameters - ---------- - polyhedron : :class:`compas.geometry.Polyhedron` - A COMPAS polyhedron. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, polyhedron: Polyhedron, **kwargs: Any): - super().__init__(geometry=polyhedron, **kwargs) + """Scene object for drawing polyhedron shapes in Blender.""" def draw(self, color: Optional[Color] = None, collection: Optional[str] = None, show_wire: bool = True) -> list[bpy.types.Object]: """Draw the polyhedron associated with the scene object. diff --git a/src/compas_blender/scene/polylineobject.py b/src/compas_blender/scene/polylineobject.py index 51ec93c40d1..d21ffc919d9 100644 --- a/src/compas_blender/scene/polylineobject.py +++ b/src/compas_blender/scene/polylineobject.py @@ -1,10 +1,8 @@ -from typing import Any from typing import Optional import bpy # type: ignore from compas.colors import Color -from compas.geometry import Polyline from compas.scene import GeometryObject from compas_blender import conversions @@ -12,19 +10,7 @@ class PolylineObject(BlenderSceneObject, GeometryObject): - """Scene object for drawing polylines in Blender. - - Parameters - ---------- - polyline : :class:`compas.geometry.Polyline` - A COMPAS polyline. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, polyline: Polyline, **kwargs: Any): - super().__init__(geometry=polyline, **kwargs) + """Scene object for drawing polylines in Blender.""" def draw(self, color: Optional[Color] = None, collection: Optional[str] = None) -> list[bpy.types.Object]: """Draw the line. diff --git a/src/compas_blender/scene/sceneobject.py b/src/compas_blender/scene/sceneobject.py index 5808d1ae806..f5416c1ae71 100644 --- a/src/compas_blender/scene/sceneobject.py +++ b/src/compas_blender/scene/sceneobject.py @@ -18,6 +18,8 @@ class BlenderSceneObject(SceneObject): ---------- collection : str | :blender:`bpy.types.Collection`, optional The Blender scene collection the object(s) created by the scene object belong to. + show_wire : bool, optional + Display the wireframe of the object. **kwargs : dict, optional Additional keyword arguments. @@ -25,6 +27,10 @@ class BlenderSceneObject(SceneObject): ---------- objects : list[:blender:`bpy.types.Object`] The Blender objects created by the scene object. + collection : str | :blender:`bpy.types.Collection` + The Blender scene collection the object(s) created by the scene object belong to. + show_wire : bool + Display the wireframe of the object. """ diff --git a/src/compas_blender/scene/shapeobject.py b/src/compas_blender/scene/shapeobject.py index ac8aec91b82..b12c659f8de 100644 --- a/src/compas_blender/scene/shapeobject.py +++ b/src/compas_blender/scene/shapeobject.py @@ -15,8 +15,6 @@ class ShapeObject(BlenderSceneObject, GeometryObject): Parameters ---------- - shape : :class:`compas.geometry.shape` - A COMPAS shape. v : int, optional The number of vertices in the u-direction of non-OCC geometries. u : int, optional @@ -28,13 +26,12 @@ class ShapeObject(BlenderSceneObject, GeometryObject): def __init__( self, - geometry: Shape, u: Optional[int] = 16, v: Optional[int] = 16, shade_smooth: bool = True, **kwargs: Any, ): - super().__init__(geometry=geometry, **kwargs) + super().__init__(**kwargs) self.geometry: Shape self.u = u self.v = v diff --git a/src/compas_blender/scene/surfaceobject.py b/src/compas_blender/scene/surfaceobject.py index 94160250b9e..8b0ba37103a 100644 --- a/src/compas_blender/scene/surfaceobject.py +++ b/src/compas_blender/scene/surfaceobject.py @@ -1,10 +1,8 @@ -from typing import Any from typing import Optional import bpy # type: ignore from compas.colors import Color -from compas.geometry import Surface from compas.scene import GeometryObject from compas_blender import conversions @@ -12,19 +10,7 @@ class SurfaceObject(BlenderSceneObject, GeometryObject): - """Scene object for drawing surfaces in Blender. - - Parameters - ---------- - surface : :class:`compas.geometry.Surface` - A COMPAS surface. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, surface: Surface, **kwargs: Any): - super().__init__(geometry=surface, **kwargs) + """Scene object for drawing surfaces in Blender.""" def draw(self, color: Optional[Color] = None, collection: Optional[str] = None) -> list[bpy.types.Object]: """Draw the surface. diff --git a/src/compas_blender/scene/vectorobject.py b/src/compas_blender/scene/vectorobject.py index 599434f3d0a..8d962b67079 100644 --- a/src/compas_blender/scene/vectorobject.py +++ b/src/compas_blender/scene/vectorobject.py @@ -1,4 +1,3 @@ -from typing import Any from typing import Optional import bpy # type: ignore @@ -6,7 +5,6 @@ from compas.colors import Color from compas.geometry import Line from compas.geometry import Point -from compas.geometry import Vector from compas.scene import GeometryObject from compas_blender import conversions @@ -14,19 +12,7 @@ class VectorObject(BlenderSceneObject, GeometryObject): - """Scene object for drawing vectors in Blender. - - Parameters - ---------- - primitive : :class:`compas.geometry.Vector` - A COMPAS vector. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, vector: Vector, **kwargs: Any): - super().__init__(geometry=vector, **kwargs) + """Scene object for drawing vectors in Blender.""" def draw( self, diff --git a/src/compas_blender/scene/volmeshobject.py b/src/compas_blender/scene/volmeshobject.py index 4012bbcefda..5b8f4ff4bb7 100644 --- a/src/compas_blender/scene/volmeshobject.py +++ b/src/compas_blender/scene/volmeshobject.py @@ -18,15 +18,34 @@ class VolMeshObject(BlenderSceneObject, BaseVolMeshObject): Parameters ---------- - volmesh : :class:`compas.datastructures.VolMesh` - The volmesh data structure. + vertex_u : int, optional + Number of segments in the U direction of the vertex spheres. + Default is ``16``. + vertex_v : int, optional + Number of segments in the V direction of the vertex spheres. + Default is ``16``. **kwargs : dict, optional Additional keyword arguments. + Attributes + ---------- + vertex_u : int + Number of segments in the U direction of the vertex spheres. + vertex_v : int + Number of segments in the V direction of the vertex spheres. + vertexobjects : list[:class:`bpy.types.Object`] + The Blender objects representing the vertices. + edgeobjects : list[:class:`bpy.types.Object`] + The Blender objects representing the edges. + faceobjects : list[:class:`bpy.types.Object`] + The Blender objects representing the faces. + cellobjects : list[:class:`bpy.types.Object`] + The Blender objects representing the cells. + """ - def __init__(self, volmesh, vertex_u=16, vertex_v=16, **kwargs: Any): - super().__init__(volmesh=volmesh, **kwargs) + def __init__(self, vertex_u=16, vertex_v=16, **kwargs: Any): + super().__init__(**kwargs) self.vertexobjects = [] self.edgeobjects = [] self.faceobjects = [] @@ -124,7 +143,7 @@ def draw_vertices(self) -> List[bpy.types.Object]: for vertex in vertices: name = f"{self.volmesh.name}.vertex.{vertex}" color = self.vertexcolor[vertex] - point = self.vertex_xyz[vertex] + point = self.volmesh.vertex_coordinates(vertex) sphere = Sphere(radius=self.vertexsize, point=point) sphere.resolution_u = self.vertex_u @@ -152,7 +171,7 @@ def draw_edges(self) -> List[bpy.types.Object]: for u, v in edges: name = f"{self.volmesh.name}.edge.{u}-{v}" color = self.edgecolor[u, v] - curve = conversions.line_to_blender_curve(Line(self.vertex_xyz[u], self.vertex_xyz[v])) + curve = conversions.line_to_blender_curve(Line(self.volmesh.vertex_coordinates(u), self.volmesh.vertex_coordinates(v))) obj = self.create_object(curve, name=name) self.update_object(obj, color=color, collection=self.collection) @@ -176,7 +195,7 @@ def draw_faces(self) -> List[bpy.types.Object]: for face in faces: name = f"{self.volmesh.name}.face.{face}" color = self.facecolor[face] - points = [self.vertex_xyz[vertex] for vertex in self.volmesh.face_vertices(face)] + points = [self.volmesh.vertex_coordinates(vertex) for vertex in self.volmesh.face_vertices(face)] mesh = conversions.polygon_to_blender_mesh(points, name=name) obj = self.create_object(mesh, name=name) @@ -206,7 +225,7 @@ def draw_cells(self) -> List[bpy.types.Object]: faces = self.volmesh.cell_faces(cell) vertex_index = dict((vertex, index) for index, vertex in enumerate(vertices)) - vertices = [self.vertex_xyz[vertex] for vertex in vertices] + vertices = [self.volmesh.vertex_coordinates(vertex) for vertex in vertices] faces = [[vertex_index[vertex] for vertex in self.volmesh.halfface_vertices(face)] for face in faces] mesh = conversions.vertices_and_faces_to_blender_mesh(vertices, faces, name=name) diff --git a/src/compas_ghpython/scene/boxobject.py b/src/compas_ghpython/scene/boxobject.py index 5cc694f9b41..21bedc66df7 100644 --- a/src/compas_ghpython/scene/boxobject.py +++ b/src/compas_ghpython/scene/boxobject.py @@ -9,19 +9,7 @@ class BoxObject(GHSceneObject, GeometryObject): - """Scene object for drawing box shapes. - - Parameters - ---------- - box : :class:`compas.geometry.Box` - A COMPAS box. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, box, **kwargs): - super(BoxObject, self).__init__(geometry=box, **kwargs) + """Scene object for drawing box shapes.""" def draw(self): """Draw the box associated with the scene object. diff --git a/src/compas_ghpython/scene/brepobject.py b/src/compas_ghpython/scene/brepobject.py index 939dd4e5bbf..a4ba1cdf755 100644 --- a/src/compas_ghpython/scene/brepobject.py +++ b/src/compas_ghpython/scene/brepobject.py @@ -9,19 +9,7 @@ class BrepObject(GHSceneObject, GeometryObject): - """A Scene object for drawing a brep in Grasshopper. - - Parameters - ---------- - brep : :class:`compas_rhino.geometry.RhinoBrep` - The brep to draw. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, brep, **kwargs): - super(BrepObject, self).__init__(geometry=brep, **kwargs) + """A Scene object for drawing a brep in Grasshopper.""" def draw(self): """Draw the brep as a Grasshopper geometry. diff --git a/src/compas_ghpython/scene/capsuleobject.py b/src/compas_ghpython/scene/capsuleobject.py index 25518e63dcd..4f243d273f4 100644 --- a/src/compas_ghpython/scene/capsuleobject.py +++ b/src/compas_ghpython/scene/capsuleobject.py @@ -9,19 +9,7 @@ class CapsuleObject(GHSceneObject, GeometryObject): - """Scene object for drawing capsule shapes. - - Parameters - ---------- - capsule : :class:`compas.geometry.Capsule` - A COMPAS capsule. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, capsule, **kwargs): - super(CapsuleObject, self).__init__(geometry=capsule, **kwargs) + """Scene object for drawing capsule shapes.""" def draw(self): """Draw the capsule associated with the scene object. diff --git a/src/compas_ghpython/scene/circleobject.py b/src/compas_ghpython/scene/circleobject.py index f74fb3e0dba..ee8a16e81f7 100644 --- a/src/compas_ghpython/scene/circleobject.py +++ b/src/compas_ghpython/scene/circleobject.py @@ -9,19 +9,7 @@ class CircleObject(GHSceneObject, GeometryObject): - """Scene object for drawing circles. - - Parameters - ---------- - circle : :class:`compas.geometry.Circle` - A COMPAS circle. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, circle, **kwargs): - super(CircleObject, self).__init__(geometry=circle, **kwargs) + """Scene object for drawing circles.""" def draw(self): """Draw the circle. diff --git a/src/compas_ghpython/scene/coneobject.py b/src/compas_ghpython/scene/coneobject.py index c19a318ac8a..621aac32479 100644 --- a/src/compas_ghpython/scene/coneobject.py +++ b/src/compas_ghpython/scene/coneobject.py @@ -9,19 +9,7 @@ class ConeObject(GHSceneObject, GeometryObject): - """Scene object for drawing cone shapes. - - Parameters - ---------- - shape : :class:`compas.geometry.Cone` - A COMPAS cone. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, cone, **kwargs): - super(ConeObject, self).__init__(geometry=cone, **kwargs) + """Scene object for drawing cone shapes.""" def draw(self): """Draw the cone associated with the scene object. diff --git a/src/compas_ghpython/scene/curveobject.py b/src/compas_ghpython/scene/curveobject.py index ede00aaaaea..1bac2aedcd8 100644 --- a/src/compas_ghpython/scene/curveobject.py +++ b/src/compas_ghpython/scene/curveobject.py @@ -9,22 +9,7 @@ class CurveObject(GHSceneObject, GeometryObject): - """Scene object for drawing curves. - - Parameters - ---------- - curve : :class:`compas.geometry.Curve` - A COMPAS curve. - - Other Parameters - ---------------- - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, curve, **kwargs): - super(CurveObject, self).__init__(geometry=curve, **kwargs) + """Scene object for drawing curves.""" def draw(self): """Draw the curve. diff --git a/src/compas_ghpython/scene/cylinderobject.py b/src/compas_ghpython/scene/cylinderobject.py index 19f26846682..f8cc986723f 100644 --- a/src/compas_ghpython/scene/cylinderobject.py +++ b/src/compas_ghpython/scene/cylinderobject.py @@ -9,19 +9,7 @@ class CylinderObject(GHSceneObject, GeometryObject): - """Scene object for drawing cylinder shapes. - - Parameters - ---------- - cylinder : :class:`compas.geometry.Cylinder` - A COMPAS cylinder. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, cylinder, **kwargs): - super(CylinderObject, self).__init__(geometry=cylinder, **kwargs) + """Scene object for drawing cylinder shapes.""" def draw(self): """Draw the cylinder associated with the scene object. @@ -30,6 +18,7 @@ def draw(self): ------- list[:rhino:`Rhino.Geometry.Brep`] List of created Rhino breps. + """ geometry = conversions.cylinder_to_rhino_brep(self.geometry) geometry.Transform(conversions.transformation_to_rhino(self.worldtransformation)) diff --git a/src/compas_ghpython/scene/ellipseobject.py b/src/compas_ghpython/scene/ellipseobject.py index e32a4465305..3c7263fe506 100644 --- a/src/compas_ghpython/scene/ellipseobject.py +++ b/src/compas_ghpython/scene/ellipseobject.py @@ -9,19 +9,7 @@ class EllipseObject(GHSceneObject, GeometryObject): - """Scene object for drawing ellipses. - - Parameters - ---------- - ellipse : :class:`compas.geometry.Ellipse` - A COMPAS ellipse. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, ellipse, **kwargs): - super(EllipseObject, self).__init__(geometry=ellipse, **kwargs) + """Scene object for drawing ellipses.""" def draw(self): """Draw the ellipse. diff --git a/src/compas_ghpython/scene/frameobject.py b/src/compas_ghpython/scene/frameobject.py index 26eaf85cbb6..dde68046f42 100644 --- a/src/compas_ghpython/scene/frameobject.py +++ b/src/compas_ghpython/scene/frameobject.py @@ -13,8 +13,6 @@ class FrameObject(GHSceneObject, GeometryObject): Parameters ---------- - frame : :class:`compas.geometry.Frame` - A COMPAS frame. scale : float, optional The scale of the vectors representing the axes of the frame. **kwargs : dict, optional @@ -24,19 +22,11 @@ class FrameObject(GHSceneObject, GeometryObject): ---------- scale : float Scale factor that controls the length of the axes. - color_origin : :class:`compas.colors.Color` - Default is ``Color.black()``. - color_xaxis : :class:`compas.colors.Color` - Default is ``Color.red()``. - color_yaxis : :class:`compas.colors.Color` - Default is ``Color.green()``. - color_zaxis : :class:`compas.colors.Color` - Default is ``Color.blue()``. """ - def __init__(self, frame, scale=1.0, **kwargs): - super(FrameObject, self).__init__(geometry=frame, **kwargs) + def __init__(self, scale=1.0, **kwargs): + super(FrameObject, self).__init__(**kwargs) self.scale = scale def draw(self): @@ -46,6 +36,7 @@ def draw(self): ------- list[:rhino:`Rhino.Geometry.Point3d`, :rhino:`Rhino.Geometry.Line`] List of created Rhino geometries. + """ geometries = [] diff --git a/src/compas_ghpython/scene/graphobject.py b/src/compas_ghpython/scene/graphobject.py index ee30a20db35..7a0ef394f3f 100644 --- a/src/compas_ghpython/scene/graphobject.py +++ b/src/compas_ghpython/scene/graphobject.py @@ -9,19 +9,7 @@ class GraphObject(GHSceneObject, BaseGraphObject): - """Scene object for drawing graph data structures. - - Parameters - ---------- - graph : :class:`compas.datastructures.Graph` - A COMPAS graph. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, graph, **kwargs): - super(GraphObject, self).__init__(graph=graph, **kwargs) + """Scene object for drawing graph data structures.""" def draw(self): """Draw the entire graph with default color settings. diff --git a/src/compas_ghpython/scene/lineobject.py b/src/compas_ghpython/scene/lineobject.py index ce838408a13..86159db3c01 100644 --- a/src/compas_ghpython/scene/lineobject.py +++ b/src/compas_ghpython/scene/lineobject.py @@ -9,19 +9,7 @@ class LineObject(GHSceneObject, GeometryObject): - """Scene object for drawing lines. - - Parameters - ---------- - line : :class:`compas.geometry.Line` - A COMPAS line. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, line, **kwargs): - super(LineObject, self).__init__(geometry=line, **kwargs) + """Scene object for drawing lines.""" def draw(self): """Draw the line. diff --git a/src/compas_ghpython/scene/meshobject.py b/src/compas_ghpython/scene/meshobject.py index 12c7e6cc4f4..46f4aada794 100644 --- a/src/compas_ghpython/scene/meshobject.py +++ b/src/compas_ghpython/scene/meshobject.py @@ -14,15 +14,20 @@ class MeshObject(GHSceneObject, BaseMeshObject): Parameters ---------- - mesh : :class:`compas.datastructures.Mesh` - A COMPAS mesh. + disjoint : bool, optional + Draw the mesh as disjoint faces. **kwargs : dict, optional Additional keyword arguments. + Attributes + ---------- + disjoint : bool + Draw the mesh as disjoint faces. + """ - def __init__(self, mesh, disjoint=False, **kwargs): - super(MeshObject, self).__init__(mesh=mesh, **kwargs) + def __init__(self, disjoint=False, **kwargs): + super(MeshObject, self).__init__(**kwargs) self.disjoint = disjoint def draw(self): diff --git a/src/compas_ghpython/scene/planeobject.py b/src/compas_ghpython/scene/planeobject.py index cd2472cf9a2..c483f85ba6d 100644 --- a/src/compas_ghpython/scene/planeobject.py +++ b/src/compas_ghpython/scene/planeobject.py @@ -14,8 +14,6 @@ class PlaneObject(GHSceneObject, GeometryObject): Parameters ---------- - plane : :class:`compas.geometry.Plane` - A COMPAS plane. scale : float, optional Scale factor that controls the visualisation size of the plane. Default is ``1.0``. @@ -29,8 +27,8 @@ class PlaneObject(GHSceneObject, GeometryObject): """ - def __init__(self, plane, scale=1.0, **kwargs): - super(PlaneObject, self).__init__(geometry=plane, **kwargs) + def __init__(self, scale=1.0, **kwargs): + super(PlaneObject, self).__init__(**kwargs) self.scale = scale def draw(self): diff --git a/src/compas_ghpython/scene/pointobject.py b/src/compas_ghpython/scene/pointobject.py index e16c3f6c438..93ec8ef6572 100644 --- a/src/compas_ghpython/scene/pointobject.py +++ b/src/compas_ghpython/scene/pointobject.py @@ -9,19 +9,7 @@ class PointObject(GHSceneObject, GeometryObject): - """Scene object for drawing points. - - Parameters - ---------- - point : :class:`compas.geometry.Point` - A COMPAS point. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, point, **kwargs): - super(PointObject, self).__init__(geometry=point, **kwargs) + """Scene object for drawing points.""" def draw(self): """Draw the point. diff --git a/src/compas_ghpython/scene/polygonobject.py b/src/compas_ghpython/scene/polygonobject.py index 5ca5ab8c9ad..0ac74a96982 100644 --- a/src/compas_ghpython/scene/polygonobject.py +++ b/src/compas_ghpython/scene/polygonobject.py @@ -2,7 +2,6 @@ from __future__ import division from __future__ import print_function -from compas.colors import Color from compas.scene import GeometryObject from compas_rhino import conversions @@ -10,34 +9,17 @@ class PolygonObject(GHSceneObject, GeometryObject): - """Scene object for drawing polygons. + """Scene object for drawing polygons.""" - Parameters - ---------- - polygon : :class:`compas.geometry.Polygon` - A COMPAS polygon. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, polygon, **kwargs): - super(PolygonObject, self).__init__(geometry=polygon, **kwargs) - - def draw(self, color=None, show_vertices=False, show_edges=False): + def draw(self): """Draw the polygon. - Parameters - ---------- - color : tuple[int, int, int] | tuple[float, float, float] | :class:`compas.colors.Color`, optional - The RGB color of the polygon. - Returns ------- list[:rhino:`Rhino.Geometry.Mesh`] """ - color = Color.coerce(color) or self.color + color = self.surfacecolor vertices = self.geometry.vertices faces = self.geometry.faces diff --git a/src/compas_ghpython/scene/polyhedronobject.py b/src/compas_ghpython/scene/polyhedronobject.py index 1cf106f37e6..c68331e0ece 100644 --- a/src/compas_ghpython/scene/polyhedronobject.py +++ b/src/compas_ghpython/scene/polyhedronobject.py @@ -2,7 +2,6 @@ from __future__ import division from __future__ import print_function -from compas.colors import Color from compas.scene import GeometryObject from compas_rhino import conversions @@ -10,21 +9,9 @@ class PolyhedronObject(GHSceneObject, GeometryObject): - """Scene object for drawing polyhedron shapes. + """Scene object for drawing polyhedron shapes.""" - Parameters - ---------- - polyhedron : :class:`compas.geometry.Polyhedron` - A COMPAS polyhedron. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, polyhedron, **kwargs): - super(PolyhedronObject, self).__init__(geometry=polyhedron, **kwargs) - - def draw(self, color=None): + def draw(self): """Draw the polyhedron associated with the scene object. Parameters @@ -38,7 +25,7 @@ def draw(self, color=None): List of created Rhino mesh. """ - color = Color.coerce(color) or self.color + color = self.surfacecolor vertices, faces = self.geometry.to_vertices_and_faces() geometry = conversions.vertices_and_faces_to_rhino(vertices, faces, color=color) diff --git a/src/compas_ghpython/scene/polylineobject.py b/src/compas_ghpython/scene/polylineobject.py index 86d50d7f9b1..4f3b4c02948 100644 --- a/src/compas_ghpython/scene/polylineobject.py +++ b/src/compas_ghpython/scene/polylineobject.py @@ -9,19 +9,7 @@ class PolylineObject(GHSceneObject, GeometryObject): - """Scene object for drawing polylines. - - Parameters - ---------- - polyline : :class:`compas.geometry.Polyline` - A COMPAS polyline. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, polyline, **kwargs): - super(PolylineObject, self).__init__(geometry=polyline, **kwargs) + """Scene object for drawing polylines.""" def draw(self): """Draw the polyline. diff --git a/src/compas_ghpython/scene/sceneobject.py b/src/compas_ghpython/scene/sceneobject.py index 1fde7497460..c4eaa0e9988 100644 --- a/src/compas_ghpython/scene/sceneobject.py +++ b/src/compas_ghpython/scene/sceneobject.py @@ -7,6 +7,3 @@ class GHSceneObject(SceneObject): """Base class for all GH scene objects.""" - - def __init__(self, **kwargs): - super(GHSceneObject, self).__init__(**kwargs) diff --git a/src/compas_ghpython/scene/sphereobject.py b/src/compas_ghpython/scene/sphereobject.py index 702d39d1898..a7ad12aa6f9 100644 --- a/src/compas_ghpython/scene/sphereobject.py +++ b/src/compas_ghpython/scene/sphereobject.py @@ -9,19 +9,7 @@ class SphereObject(GHSceneObject, GeometryObject): - """Scene object for drawing sphere shapes. - - Parameters - ---------- - sphere : :class:`compas.geometry.Sphere` - A COMPAS sphere. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, sphere, **kwargs): - super(SphereObject, self).__init__(geometry=sphere, **kwargs) + """Scene object for drawing sphere shapes.""" def draw(self): """Draw the sphere associated with the scene object. diff --git a/src/compas_ghpython/scene/surfaceobject.py b/src/compas_ghpython/scene/surfaceobject.py index 7d2cf3fd79f..321e8fdb097 100644 --- a/src/compas_ghpython/scene/surfaceobject.py +++ b/src/compas_ghpython/scene/surfaceobject.py @@ -9,22 +9,7 @@ class SurfaceObject(GHSceneObject, GeometryObject): - """Scene object for drawing surfaces. - - Parameters - ---------- - surface : :class:`compas.geometry.Surface` - A COMPAS surface. - - Other Parameters - ---------------- - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, surface, **kwargs): - super(SurfaceObject, self).__init__(geometry=surface, **kwargs) + """Scene object for drawing surfaces.""" def draw(self): """Draw the surface. diff --git a/src/compas_ghpython/scene/torusobject.py b/src/compas_ghpython/scene/torusobject.py index bbb48cd9c88..f5740ca0c65 100644 --- a/src/compas_ghpython/scene/torusobject.py +++ b/src/compas_ghpython/scene/torusobject.py @@ -9,19 +9,7 @@ class TorusObject(GHSceneObject, GeometryObject): - """Scene object for drawing torus shapes. - - Parameters - ---------- - torus : :class:`compas.geometry.Torus` - A COMPAS torus. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, torus, **kwargs): - super(TorusObject, self).__init__(geometry=torus, **kwargs) + """Scene object for drawing torus shapes.""" def draw(self): """Draw the torus associated with the scene object. diff --git a/src/compas_ghpython/scene/vectorobject.py b/src/compas_ghpython/scene/vectorobject.py index aeeff71749b..1055b521889 100644 --- a/src/compas_ghpython/scene/vectorobject.py +++ b/src/compas_ghpython/scene/vectorobject.py @@ -10,21 +10,9 @@ class VectorObject(GHSceneObject, GeometryObject): - """Scene object for drawing vectors. + """Scene object for drawing vectors.""" - Parameters - ---------- - vector : :class:`compas.geometry.Vector` - A COMPAS vector. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, vector, **kwargs): - super(VectorObject, self).__init__(geometry=vector, **kwargs) - - def draw(self, point=None, show_point=False): + def draw(self, point=None): """Draw the vector. Parameters diff --git a/src/compas_ghpython/scene/volmeshobject.py b/src/compas_ghpython/scene/volmeshobject.py index 9ad97145ae3..fdc30a2e04b 100644 --- a/src/compas_ghpython/scene/volmeshobject.py +++ b/src/compas_ghpython/scene/volmeshobject.py @@ -10,19 +10,7 @@ class VolMeshObject(GHSceneObject, BaseVolMeshObject): - """Scene object for drawing volmesh data structures. - - Parameters - ---------- - volmesh : :class:`compas.datastructures.VolMesh` - A COMPAS volmesh. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, volmesh, **kwargs): - super(VolMeshObject, self).__init__(volmesh=volmesh, **kwargs) + """Scene object for drawing volmesh data structures.""" def draw(self): """Draw a selection of cells. diff --git a/src/compas_rhino/scene/boxobject.py b/src/compas_rhino/scene/boxobject.py index b084630bfd1..6ef643fb3b9 100644 --- a/src/compas_rhino/scene/boxobject.py +++ b/src/compas_rhino/scene/boxobject.py @@ -12,20 +12,7 @@ class RhinoBoxObject(RhinoSceneObject, GeometryObject): - """Scene object for drawing box shapes. - - Parameters - ---------- - box : :class:`compas.geometry.Box` - A COMPAS box. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, box, **kwargs): - super(RhinoBoxObject, self).__init__(geometry=box, **kwargs) - self.box = box + """Scene object for drawing box shapes.""" def draw(self): """Draw the box associated with the scene object. diff --git a/src/compas_rhino/scene/brepobject.py b/src/compas_rhino/scene/brepobject.py index 24c4bbe9186..7e9bed8a3e4 100644 --- a/src/compas_rhino/scene/brepobject.py +++ b/src/compas_rhino/scene/brepobject.py @@ -12,17 +12,7 @@ class RhinoBrepObject(RhinoSceneObject, GeometryObject): - """A scene object for drawing a RhinoBrep. - - Parameters - ---------- - brep : :class:`compas_rhino.geometry.RhinoBrep` - The Brep to draw. - - """ - - def __init__(self, brep, **kwargs): - super(RhinoBrepObject, self).__init__(geometry=brep, **kwargs) + """A scene object for drawing a RhinoBrep.""" def draw(self): """Bakes the Brep into the current document diff --git a/src/compas_rhino/scene/capsuleobject.py b/src/compas_rhino/scene/capsuleobject.py index 52e59dc95ee..9774a034ab2 100644 --- a/src/compas_rhino/scene/capsuleobject.py +++ b/src/compas_rhino/scene/capsuleobject.py @@ -12,19 +12,7 @@ class RhinoCapsuleObject(RhinoSceneObject, GeometryObject): - """Scene object for drawing capsule shapes. - - Parameters - ---------- - capsule : :class:`compas.geometry.Capsule` - A COMPAS capsule. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, capsule, **kwargs): - super(RhinoCapsuleObject, self).__init__(geometry=capsule, **kwargs) + """Scene object for drawing capsule shapes.""" def draw(self): """Draw the capsule associated with the scene object. diff --git a/src/compas_rhino/scene/circleobject.py b/src/compas_rhino/scene/circleobject.py index 12067e24e45..e2a23f176e1 100644 --- a/src/compas_rhino/scene/circleobject.py +++ b/src/compas_rhino/scene/circleobject.py @@ -12,19 +12,7 @@ class RhinoCircleObject(RhinoSceneObject, GeometryObject): - """Scene object for drawing circles. - - Parameters - ---------- - circle : :class:`compas.geometry.Circle` - A COMPAS circle. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, circle, **kwargs): - super(RhinoCircleObject, self).__init__(geometry=circle, **kwargs) + """Scene object for drawing circles.""" def draw(self): """Draw the circle. diff --git a/src/compas_rhino/scene/coneobject.py b/src/compas_rhino/scene/coneobject.py index 2f578acff58..53bbe9c10ec 100644 --- a/src/compas_rhino/scene/coneobject.py +++ b/src/compas_rhino/scene/coneobject.py @@ -12,19 +12,7 @@ class RhinoConeObject(RhinoSceneObject, GeometryObject): - """Scene object for drawing cone shapes. - - Parameters - ---------- - shape : :class:`compas.geometry.Cone` - A COMPAS cone. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, cone, **kwargs): - super(RhinoConeObject, self).__init__(geometry=cone, **kwargs) + """Scene object for drawing cone shapes.""" def draw(self): """Draw the cone associated with the scene object. diff --git a/src/compas_rhino/scene/curveobject.py b/src/compas_rhino/scene/curveobject.py index a990c6f0cec..bffb887367d 100644 --- a/src/compas_rhino/scene/curveobject.py +++ b/src/compas_rhino/scene/curveobject.py @@ -12,19 +12,7 @@ class RhinoCurveObject(RhinoSceneObject, GeometryObject): - """Scene object for drawing curves. - - Parameters - ---------- - curve : :class:`compas.geometry.Curve` - A COMPAS curve. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, curve, **kwargs): - super(RhinoCurveObject, self).__init__(geometry=curve, **kwargs) + """Scene object for drawing curves.""" def draw(self): """Draw the curve. diff --git a/src/compas_rhino/scene/cylinderobject.py b/src/compas_rhino/scene/cylinderobject.py index d09115c38f7..b29060f45ce 100644 --- a/src/compas_rhino/scene/cylinderobject.py +++ b/src/compas_rhino/scene/cylinderobject.py @@ -12,19 +12,7 @@ class RhinoCylinderObject(RhinoSceneObject, GeometryObject): - """Scene object for drawing cylinder shapes. - - Parameters - ---------- - cylinder : :class:`compas.geometry.Cylinder` - A COMPAS cylinder. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, cylinder, **kwargs): - super(RhinoCylinderObject, self).__init__(geometry=cylinder, **kwargs) + """Scene object for drawing cylinder shapes.""" def draw(self): """Draw the cylinder associated with the scene object. diff --git a/src/compas_rhino/scene/ellipseobject.py b/src/compas_rhino/scene/ellipseobject.py index 154d4ffe9ec..b0d44c65f01 100644 --- a/src/compas_rhino/scene/ellipseobject.py +++ b/src/compas_rhino/scene/ellipseobject.py @@ -12,19 +12,7 @@ class RhinoEllipseObject(RhinoSceneObject, GeometryObject): - """Scene object for drawing ellipses. - - Parameters - ---------- - ellipse : :class:`compas.geometry.Ellipse` - A COMPAS ellipse. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, ellipse, **kwargs): - super(RhinoEllipseObject, self).__init__(geometry=ellipse, **kwargs) + """Scene object for drawing ellipses.""" def draw(self): """Draw the ellipse. diff --git a/src/compas_rhino/scene/frameobject.py b/src/compas_rhino/scene/frameobject.py index 17168dc2eda..ae7d3c4beb4 100644 --- a/src/compas_rhino/scene/frameobject.py +++ b/src/compas_rhino/scene/frameobject.py @@ -17,8 +17,6 @@ class RhinoFrameObject(RhinoSceneObject, GeometryObject): Parameters ---------- - frame: :class:`compas.geometry.Frame` - A COMPAS frame. scale: float, optional Scale factor that controls the length of the axes. **kwargs : dict, optional @@ -40,8 +38,8 @@ class RhinoFrameObject(RhinoSceneObject, GeometryObject): """ - def __init__(self, frame, scale=1.0, **kwargs): - super(RhinoFrameObject, self).__init__(geometry=frame, **kwargs) + def __init__(self, scale=1.0, **kwargs): + super(RhinoFrameObject, self).__init__(**kwargs) self.scale = scale or 1.0 self.color_origin = Color.black() self.color_xaxis = Color.red() diff --git a/src/compas_rhino/scene/graphobject.py b/src/compas_rhino/scene/graphobject.py index 6f2725de118..88f1e409966 100644 --- a/src/compas_rhino/scene/graphobject.py +++ b/src/compas_rhino/scene/graphobject.py @@ -19,15 +19,19 @@ class RhinoGraphObject(RhinoSceneObject, GraphObject): Parameters ---------- - graph : :class:`compas.datastructures.Graph` - A COMPAS graph. + nodegroup : str, optional + The name of the group for the nodes. + edgegroup : str, optional + The name of the group for the edges. + edgedirection : bool, optional + Flag for drawing the edges with an arrow indicating the direction. **kwargs : dict, optional Additional keyword arguments. """ - def __init__(self, graph, nodegroup=None, edgegroup=None, edgedirection=False, **kwargs): - super(RhinoGraphObject, self).__init__(graph=graph, **kwargs) + def __init__(self, nodegroup=None, edgegroup=None, edgedirection=False, **kwargs): + super(RhinoGraphObject, self).__init__(**kwargs) self._guids_nodes = None self._guids_edges = None self._guids_nodelabels = None diff --git a/src/compas_rhino/scene/lineobject.py b/src/compas_rhino/scene/lineobject.py index 420cb2b71cc..9ab5c22e840 100644 --- a/src/compas_rhino/scene/lineobject.py +++ b/src/compas_rhino/scene/lineobject.py @@ -12,19 +12,7 @@ class RhinoLineObject(RhinoSceneObject, GeometryObject): - """Scene object for drawing lines. - - Parameters - ---------- - line : :class:`compas.geometry.Line` - A COMPAS line. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, line, **kwargs): - super(RhinoLineObject, self).__init__(geometry=line, **kwargs) + """Scene object for drawing lines.""" def draw(self): """Draw the line. diff --git a/src/compas_rhino/scene/meshobject.py b/src/compas_rhino/scene/meshobject.py index 19ce6f0fa69..db04e6c9eb2 100644 --- a/src/compas_rhino/scene/meshobject.py +++ b/src/compas_rhino/scene/meshobject.py @@ -26,8 +26,15 @@ class RhinoMeshObject(RhinoSceneObject, MeshObject): Parameters ---------- - mesh : :class:`compas.datastructures.Mesh` - A COMPAS mesh. + disjoint : bool, optional + Draw the faces of the mesh disjointed. + Default is ``False``. + vertexgroup : str, optional + The name of the group for the vertices. + edgegroup : str, optional + The name of the group for the edges. + facegroup : str, optional + The name of the group for the faces. **kwargs : dict, optional Additional keyword arguments. @@ -36,11 +43,17 @@ class RhinoMeshObject(RhinoSceneObject, MeshObject): disjoint : bool, optional Draw the faces of the mesh disjointed. Default is ``False``. + vertexgroup : str, optional + The name of the group for the vertices. + edgegroup : str, optional + The name of the group for the edges. + facegroup : str, optional + The name of the group for the faces. """ - def __init__(self, mesh, disjoint=False, vertexgroup=None, edgegroup=None, facegroup=None, **kwargs): - super(RhinoMeshObject, self).__init__(mesh=mesh, **kwargs) + def __init__(self, disjoint=False, vertexgroup=None, edgegroup=None, facegroup=None, **kwargs): + super(RhinoMeshObject, self).__init__(**kwargs) self.disjoint = disjoint self._guid_mesh = None self._guids_faces = None diff --git a/src/compas_rhino/scene/planeobject.py b/src/compas_rhino/scene/planeobject.py index 18b88259f10..eece052c32c 100644 --- a/src/compas_rhino/scene/planeobject.py +++ b/src/compas_rhino/scene/planeobject.py @@ -18,18 +18,22 @@ class RhinoPlaneObject(RhinoSceneObject, GeometryObject): Parameters ---------- - plane : :class:`compas.geometry.Plane` - A COMPAS plane. scale : float, optional Scale factor. Default is ``1.0``. **kwargs : dict, optional Additional keyword arguments. + Attributes + ---------- + scale : float + Scale factor. + Default is ``1.0``. + """ - def __init__(self, plane, scale=1.0, **kwargs): - super(RhinoPlaneObject, self).__init__(geometry=plane, **kwargs) + def __init__(self, scale=1.0, **kwargs): + super(RhinoPlaneObject, self).__init__(**kwargs) self.scale = scale def draw(self): diff --git a/src/compas_rhino/scene/pointobject.py b/src/compas_rhino/scene/pointobject.py index 0ee1014810c..4091fb7534b 100644 --- a/src/compas_rhino/scene/pointobject.py +++ b/src/compas_rhino/scene/pointobject.py @@ -12,19 +12,7 @@ class RhinoPointObject(RhinoSceneObject, GeometryObject): - """Scene object for drawing points. - - Parameters - ---------- - point : :class:`compas.geometry.Point` - A COMPAS point. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, point, **kwargs): - super(RhinoPointObject, self).__init__(geometry=point, **kwargs) + """Scene object for drawing points.""" def draw(self): """Draw the point. diff --git a/src/compas_rhino/scene/polygonobject.py b/src/compas_rhino/scene/polygonobject.py index 35bc52773f0..3cde33d5874 100644 --- a/src/compas_rhino/scene/polygonobject.py +++ b/src/compas_rhino/scene/polygonobject.py @@ -12,19 +12,7 @@ class RhinoPolygonObject(RhinoSceneObject, GeometryObject): - """Scene object for drawing polygons. - - Parameters - ---------- - polygon : :class:`compas.geometry.Polygon` - A COMPAS polygon. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, polygon, **kwargs): - super(RhinoPolygonObject, self).__init__(geometry=polygon, **kwargs) + """Scene object for drawing polygons.""" def draw(self): """Draw the polygon. diff --git a/src/compas_rhino/scene/polyhedronobject.py b/src/compas_rhino/scene/polyhedronobject.py index ca6df3505d6..8800026b519 100644 --- a/src/compas_rhino/scene/polyhedronobject.py +++ b/src/compas_rhino/scene/polyhedronobject.py @@ -12,19 +12,7 @@ class RhinoPolyhedronObject(RhinoSceneObject, GeometryObject): - """Scene object for drawing polyhedron shapes. - - Parameters - ---------- - polyhedron : :class:`compas.geometry.Polyhedron` - A COMPAS polyhedron. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, polyhedron, **kwargs): - super(RhinoPolyhedronObject, self).__init__(geometry=polyhedron, **kwargs) + """Scene object for drawing polyhedron shapes.""" def draw(self): """Draw the polyhedron associated with the scene object. diff --git a/src/compas_rhino/scene/polylineobject.py b/src/compas_rhino/scene/polylineobject.py index ed98970b958..b00f7226708 100644 --- a/src/compas_rhino/scene/polylineobject.py +++ b/src/compas_rhino/scene/polylineobject.py @@ -12,19 +12,7 @@ class RhinoPolylineObject(RhinoSceneObject, GeometryObject): - """Scene object for drawing polylines. - - Parameters - ---------- - polyline : :class:`compas.geometry.Polyline` - A COMPAS polyline. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, polyline, **kwargs): - super(RhinoPolylineObject, self).__init__(geometry=polyline, **kwargs) + """Scene object for drawing polylines.""" def draw(self): """Draw the polyline. diff --git a/src/compas_rhino/scene/sceneobject.py b/src/compas_rhino/scene/sceneobject.py index 2c2ecfcfadc..ac1f098b655 100644 --- a/src/compas_rhino/scene/sceneobject.py +++ b/src/compas_rhino/scene/sceneobject.py @@ -25,6 +25,13 @@ class RhinoSceneObject(SceneObject): **kwargs : dict, optional Additional keyword arguments. + Attributes + ---------- + layer : str + The name of the layer. + group : str + The name of the group. + """ def __init__(self, layer=None, group=None, **kwargs): diff --git a/src/compas_rhino/scene/sphereobject.py b/src/compas_rhino/scene/sphereobject.py index 3d68d04ae72..ad6278cff99 100644 --- a/src/compas_rhino/scene/sphereobject.py +++ b/src/compas_rhino/scene/sphereobject.py @@ -12,19 +12,7 @@ class RhinoSphereObject(RhinoSceneObject, GeometryObject): - """Scene object for drawing sphere shapes. - - Parameters - ---------- - sphere : :class:`compas.geometry.Sphere` - A COMPAS sphere. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, sphere, **kwargs): - super(RhinoSphereObject, self).__init__(geometry=sphere, **kwargs) + """Scene object for drawing sphere shapes.""" def draw(self): """Draw the sphere associated with the scene object. diff --git a/src/compas_rhino/scene/surfaceobject.py b/src/compas_rhino/scene/surfaceobject.py index 7edfd3c7d0f..e352b237584 100644 --- a/src/compas_rhino/scene/surfaceobject.py +++ b/src/compas_rhino/scene/surfaceobject.py @@ -12,19 +12,7 @@ class RhinoSurfaceObject(RhinoSceneObject, GeometryObject): - """Scene object for drawing surfaces. - - Parameters - ---------- - surface : :class:`compas.geometry.Geometry` - A COMPAS surface. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, surface, **kwargs): - super(RhinoSurfaceObject, self).__init__(geometry=surface, **kwargs) + """Scene object for drawing surfaces.""" def draw(self): """Draw the surface. diff --git a/src/compas_rhino/scene/torusobject.py b/src/compas_rhino/scene/torusobject.py index 4fe21f9d18f..477d24403dc 100644 --- a/src/compas_rhino/scene/torusobject.py +++ b/src/compas_rhino/scene/torusobject.py @@ -12,19 +12,7 @@ class RhinoTorusObject(RhinoSceneObject, GeometryObject): - """Scene object for drawing torus shapes. - - Parameters - ---------- - torus : :class:`compas.geometry.Torus` - A COMPAS torus. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, torus, **kwargs): - super(RhinoTorusObject, self).__init__(geometry=torus, **kwargs) + """Scene object for drawing torus shapes.""" def draw(self): """Draw the torus associated with the scene object. diff --git a/src/compas_rhino/scene/vectorobject.py b/src/compas_rhino/scene/vectorobject.py index 3c0f39739c0..d95eb321a66 100644 --- a/src/compas_rhino/scene/vectorobject.py +++ b/src/compas_rhino/scene/vectorobject.py @@ -13,19 +13,7 @@ class RhinoVectorObject(RhinoSceneObject, GeometryObject): - """Scene object for drawing vectors. - - Parameters - ---------- - vector : :class:`compas.geometry.Vector` - A COMPAS vector. - **kwargs : dict, optional - Additional keyword arguments. - - """ - - def __init__(self, vector, **kwargs): - super(RhinoVectorObject, self).__init__(geometry=vector, **kwargs) + """Scene object for drawing vectors.""" def draw(self): """Draw the vector. diff --git a/src/compas_rhino/scene/volmeshobject.py b/src/compas_rhino/scene/volmeshobject.py index 1b56be5c09b..9a512a1c82f 100644 --- a/src/compas_rhino/scene/volmeshobject.py +++ b/src/compas_rhino/scene/volmeshobject.py @@ -22,18 +22,38 @@ class RhinoVolMeshObject(RhinoSceneObject, VolMeshObject): Parameters ---------- - volmesh : :class:`compas.datastructures.VolMesh` - A COMPAS volmesh. disjoint : bool, optional Draw the faces of the mesh disjointed. Default is ``True``. + vertexgroup : str, optional + The name of the group for the vertices. + edgegroup : str, optional + The name of the group for the edges. + facegroup : str, optional + The name of the group for the faces. + cellgroup : str, optional + The name of the group for the cells. **kwargs : dict, optional Additional keyword arguments. + Attributes + ---------- + disjoint : bool + Draw the faces of the mesh disjointed. + Default is ``True``. + vertexgroup : str + The name of the group for the vertices. + edgegroup : str + The name of the group for the edges. + facegroup : str + The name of the group for the faces. + cellgroup : str + The name of the group for the cells. + """ - def __init__(self, volmesh, disjoint=True, vertexgroup=None, edgegroup=None, facegroup=None, cellgroup=None, **kwargs): - super(RhinoVolMeshObject, self).__init__(volmesh=volmesh, **kwargs) + def __init__(self, disjoint=True, vertexgroup=None, edgegroup=None, facegroup=None, cellgroup=None, **kwargs): + super(RhinoVolMeshObject, self).__init__(**kwargs) self.disjoint = disjoint self._guids_vertices = None self._guids_edges = None