[docs]classFacesConduit(BaseConduit):"""A Rhino display conduit for faces. Parameters ---------- vertices : list of list of float The coordinates of the vertices of the faces. faces : list of list of int The faces defined as lists of indices in ``vertices``. color : list of str or 3-tuple, optional The colors of the faces. Default is ``None``, in which case the default color is used for all faces. Attributes ---------- color : list of RGB colors The color specification per face. vertices : list of list of float The coordinates of the vertices of the faces. faces : list of list of int The faces defined as lists of indices in ``vertices``. Examples -------- .. code-block:: python from compas.geometry import Polyhedron from compas_rhino.conduits import FacesConduit polyhedron = Polyhedron.generate(6) faces = polyhedron.faces vertices = polyhedron.vertices polygons = [[vertices[index] for index in face] for face in faces] conduit = FacesConduit(polygons) with conduit.enabled(): conduit.redraw(pause=5.0) """def__init__(self,vertices,faces,color=None,**kwargs):super(FacesConduit,self).__init__(**kwargs)self._default_color=FromArgb(255,255,255)self._color=Noneself.vertices=verticesor[]self.faces=facesor[]self.color=color@propertydefcolor(self):returnself._color@color.setterdefcolor(self,color):ifnotcolor:returnf=len(self.faces)ifisinstance(color,(basestring,tuple)):color=[colorfor_inrange(f)]color=[FromArgb(*color_to_rgb(c))forcincolor]c=len(color)ifc<f:color+=[self._default_colorfor_inrange(f-c)]elifc>f:color[:]=color[:f]self._color=colordefDrawForeground(self,e):fori,faceinenumerate(self.faces):points=[Point3d(*self.vertices[key])forkeyinface]ifself.color:e.Display.DrawPolygon(points,self.color[i],True)else:e.Display.DrawPolygon(points,self._default_color,True)