Skip to content

TypeError: __init__(): incompatible constructor arguments. The following argument types are supported #33

@sugizo

Description

@sugizo

env
google colab

steps

pip install -U pymartini pymeshlab
!wget -c https://raw.githubusercontent.com/kylebarron/pymartini/master/test/data/fuji.png

code

import imageio.v2 as imageio
from pymartini import decode_ele, Martini, rescale_positions
import pymeshlab

path = './fuji.png'
fuji = imageio.imread(path)
terrain = decode_ele(fuji, 'mapbox')
martini = Martini(fuji.shape[0] + 1)
tile = martini.create_tile(terrain)
vertices, triangles = tile.get_mesh(10)
m = pymeshlab.Mesh(vertices, triangles)
ms = pymeshlab.MeshSet()
ms.add_mesh(m)
ms.save_current_mesh(f'{file_name}_pymeshlab.stl')

result

TypeError                                 Traceback (most recent call last)
[<ipython-input-11-7c37458cfb79>](https://localhost:8080/#) in <cell line: 11>()
      9 tile = martini.create_tile(terrain)
     10 vertices, triangles = tile.get_mesh(10)
---> 11 m = pymeshlab.Mesh(vertices, triangles)
     12 ms = pymeshlab.MeshSet()
     13 ms.add_mesh(m)

TypeError: __init__(): incompatible constructor arguments. The following argument types are supported:
    1. pymeshlab.pmeshlab.Mesh(vertex_matrix: numpy.ndarray[numpy.float64[m, 3]] = array([], shape=(0, 3), dtype=float64), face_matrix: numpy.ndarray[numpy.int32[m, 3]] = array([], shape=(0, 3), dtype=int32), edge_matrix: numpy.ndarray[numpy.int32[m, 2]] = array([], shape=(0, 2), dtype=int32), v_normals_matrix: numpy.ndarray[numpy.float64[m, 3]] = array([], shape=(0, 3), dtype=float64), f_normals_matrix: numpy.ndarray[numpy.float64[m, 3]] = array([], shape=(0, 3), dtype=float64), v_scalar_array: numpy.ndarray[numpy.float64[m, 1]] = array([], dtype=float64), f_scalar_array: numpy.ndarray[numpy.float64[m, 1]] = array([], dtype=float64), v_color_matrix: numpy.ndarray[numpy.float64[m, 4]] = array([], shape=(0, 4), dtype=float64), f_color_matrix: numpy.ndarray[numpy.float64[m, 4]] = array([], shape=(0, 4), dtype=float64), v_tex_coords_matrix: numpy.ndarray[numpy.float64[m, 2]] = array([], shape=(0, 2), dtype=float64), w_tex_coords_matrix: numpy.ndarray[numpy.float64[m, 2]] = array([], shape=(0, 2), dtype=float64))
    2. pymeshlab.pmeshlab.Mesh(vertex_matrix: numpy.ndarray[numpy.float64[m, 3]], face_list_of_indices: List[numpy.ndarray[numpy.uint32[m, 1]]], v_normals_matrix: numpy.ndarray[numpy.float64[m, 3]] = array([], shape=(0, 3), dtype=float64), f_normals_matrix: numpy.ndarray[numpy.float64[m, 3]] = array([], shape=(0, 3), dtype=float64), v_scalar_array: numpy.ndarray[numpy.float64[m, 1]] = array([], dtype=float64), f_scalar_array: numpy.ndarray[numpy.float64[m, 1]] = array([], dtype=float64), v_color_matrix: numpy.ndarray[numpy.float64[m, 4]] = array([], shape=(0, 4), dtype=float64), f_color_matrix: numpy.ndarray[numpy.float64[m, 4]] = array([], shape=(0, 4), dtype=float64), v_tex_coords_matrix: numpy.ndarray[numpy.float64[m, 2]] = array([], shape=(0, 2), dtype=float64))

Invoked with: array([308, 100, 304, ..., 294,  98, 292], dtype=uint16), array([    0,     1,     2, ..., 44963, 45051, 45071], dtype=uint32)

n.b.
the same steps work fine with pydelatin

best regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions