def from_data(cls, data): """Construct a torus from its data representation. Parameters ---------- data : dict The data dictionary. Returns ------- :class:`compas.geometry.Torus` The constructed torus. Examples -------- >>> from compas.geometry import Torus >>> data = {'plane': Plane.worldXY().data, 'radius_axis': 4., 'radius_pipe': 1.} >>> torus = Torus.from_data(data) """ torus = cls(Plane.from_data(data['plane']), data['radius_axis'], data['radius_pipe']) return torus
def data(self, data): self.plane = Plane.from_data(data['plane']) self.radius_axis = data['radius_axis'] self.radius_pipe = data['radius_pipe']
def from_data(cls, data): plane = Plane.from_data(data) vplane = cls(plane) return vplane
def data(self, data): self.plane = Plane.from_data(data)