예제 #1
0
    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
예제 #2
0
 def data(self, data):
     self.plane = Plane.from_data(data['plane'])
     self.radius_axis = data['radius_axis']
     self.radius_pipe = data['radius_pipe']
예제 #3
0
 def from_data(cls, data):
     plane = Plane.from_data(data)
     vplane = cls(plane)
     return vplane
예제 #4
0
 def data(self, data):
     self.plane = Plane.from_data(data)