Esempio n. 1
0
    def to_stl(self, filepath, precision=None, binary=False, **kwargs):
        """Write a mesh to an STL file.

        Parameters
        ----------
        filepath : str
            The path to the file.
        precision : str, optional
            Rounding precision for the vertex coordinates.
            Defaults to the value of :attr:`compas.PRECISION`.
        binary : bool, optional
            If True, the file will be written in binary format.
            ASCII otherwise.

        Returns
        -------
        None

        Notes
        -----
        STL files only support triangle faces.
        It is the user's responsibility to convert all faces of a mesh to triangles.
        For example, with :func:`compas.datastructures.mesh_quads_to_triangles`.

        """
        stl = STL(filepath, precision)
        stl.write(self, binary=binary, **kwargs)
Esempio n. 2
0
    def to_stl(self, filepath, precision=None, binary=False, **kwargs):
        """Write a mesh to an STL file.

        Parameters
        ----------
        filepath : str
            The path to the file.
        precision : str, optional
            Rounding precision for the vertex coordinates.
            Default is ``"3f"``.
        binary : bool, optional
            When ``False``, the file will be written in ASCII encoding,
            when ``True``, binary.  Default is ``False``.

        Returns
        -------
        None

        Notes
        -----
        STL files only support triangle faces.
        It is your responsibility to convert all faces of your mesh to triangles.
        For example, with :func:`compas.datastructures.mesh_quads_to_triangles`.
        """
        stl = STL(filepath, precision)
        stl.write(self, binary=binary, **kwargs)
Esempio n. 3
0
    def to_stl(self, filepath, precision=None, **kwargs):
        """Write a mesh to an STL file.

        Parameters
        ----------
        filepath : str
            The path to the file.
        precision : str, optional
            Rounding precision for the vertex coordinates.
            Default is ``"3f"``.

        Returns
        -------
        None

        Notes
        -----
        STL files only support triangle faces.
        However, the writer does not perform any checks
        and will just treat every face as a triangle.
        It is your responsibility to convert all faces of your mesh to triangles.
        For example, with :func:`compas.datastructures.mesh_quads_to_triangles`.
        """
        stl = STL(filepath, precision)
        stl.write(self, **kwargs)