def trajectory_from(self, frame_list): """Ensure trajectory_from elements are :class:`compas.geometry.Frame` objects.""" # noqa: E501 self._trajectory_from = [] if isinstance(frame_list, collections.Sequence): for frame_like in frame_list: frame = ensure_frame(frame_like) self._trajectory_from.append(frame) else: frame = ensure_frame(frame_list) self._trajectory_from.append(frame)
def from_plane_point(cls, tcp_plane, cog_pt=None, **kwargs): """Create RapidToolData object from :class:`Rhino.Geometry.GeometryBase` objects. Parameters ---------- tcp_plane : :class:`Rhino.Geometry.Plane` Plane at tool center plane. cog_pt : :class:`Rhino.Geometry.Point3d`, optional Point at tool center of gravity. name : str, optional weight : float, optional Tool weight in kg Returns ------- :class:`RapidToolData` """ tcp_coord = [ tcp_plane.Origin.X, tcp_plane.Origin.Y, tcp_plane.Origin.Z ] tcp_frame = ensure_frame(tcp_plane) tcp_quaternion = tcp_frame.quaternion.wxyz if cog_pt: cog_coord = [cog_pt.X, cog_pt.Y, cog_pt.Z] kwargs.update({"cog_coord": cog_coord}) return cls(tcp_coord, tcp_quaternion, **kwargs)
def from_compressed_centroid_frame_like(cls, centroid_frame_like, compression_ratio=0.5, height=100, **kwargs): """Construct a :class:`ClayBullet` instance from centroid plane. Parameters ---------- centroid_frame_like : :class:`compas.geometry.Frame` or :class:`Rhino.Geometry.Plane` Frame between bottom of clay bullet and compressed top. compression_ratio : :class:`float` The compressed height as a percentage of the original height. height : :class:`float` The height of the bullet before compression. kwargs : :class:`dict` Other attributes. Returns ------- :class:`ClayBullet` The constructed ClayBullet instance """ # noqa: E501 centroid_frame = ensure_frame(centroid_frame_like) compressed_height = height * compression_ratio location = get_offset_frame(centroid_frame, -compressed_height / 2) return cls(location, compression_ratio=compression_ratio, height=height, **kwargs)
def location(self, frame_like): """Ensure that location is stored as :class:`compas.geometry.Frame` object.""" self._location = ensure_frame(frame_like)