Example #1
0
def _fileserver_mesh_import(url, filename):
    """Internal function that adds primitive support for DAE files
    to the _mesh_import function of compas.robots."""
    file_extension = _get_file_format(url)

    if file_extension == 'dae':
        # Magic!
        return _dae_mesh_importer(filename)
    else:
        return _mesh_import(url, filename)
Example #2
0
def _fileserver_mesh_import(url, filename, precision=None):
    """Internal function that adds primitive support for DAE files
    to the _mesh_import function of compas.robots."""
    file_extension = _get_file_format(url)

    if file_extension == 'dae':
        # Magic!
        return _dae_mesh_importer(filename, precision)
    else:
        # TODO: This _mesh_import should also add support for precision
        return _mesh_import(url, filename)
Example #3
0
    def load_mesh(self, url):
        """Loads a mesh from a Github repository URL.

        Parameters
        ----------
        url : str
            Mesh location

        Returns
        -------
        :class:`Mesh`
            Instance of a mesh.
        """
        _prefix, path = url.split(self.schema_prefix)
        url = self.build_url(path)

        return _mesh_import(url, url)
Example #4
0
    def load_meshes(self, url):
        """Load meshes from the given URL.

        A single mesh file can contain multiple meshes depending on the format.

        Parameters
        ----------
        url : str
            Mesh URL

        Returns
        -------
        list[:class:`compas.datastructures.Mesh`]
            List of meshes.
        """
        _prefix, path = url.split(self.schema_prefix)
        url = self.build_url(path)

        return _mesh_import(url, url)
Example #5
0
    def load_mesh(self, url):
        """Loads a mesh from a Github repository URL.

        Parameters
        ----------
        url : str
            Mesh location

        Returns
        -------
        :class:`Mesh`
            Instance of a mesh.
        """
        _prefix, path = url.split(self.schema_prefix)
        url = self.build_url(path)

        # TODO: As soon as compas.files adds support
        # for file-like objects, we could skip
        # storing a temp file for these urls
        tempfile, _ = urlretrieve(url)
        return _mesh_import(url, tempfile)