def from_data(cls, data): """Construct a cylinder from its data representation. Parameters ---------- data : dict The data dictionary. Returns ------- :class:`compas.geometry.Cylinder` The constructed cylinder. Examples -------- >>> from compas.geometry import Cylinder >>> from compas.geometry import Circle >>> from compas.geometry import Plane >>> data = {'circle': Circle(Plane.worldXY(), 5).data, 'height': 7.} >>> cylinder = Cylinder.from_data(data) """ cylinder = cls(Circle.from_data(data['circle']), data['height']) return cylinder
def data(self, data): self.circle = Circle.from_data(data['circle']) self.height = data['height']