Skip to content

IndexError: tuple index out of range #30

@sugizo

Description

@sugizo

env
google colab

steps

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

code

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

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)
cells = [("triangle", triangles) ]
mesh = meshio.Mesh(vertices, cells)
mesh.write('fuji.stl')

result

IndexError                                Traceback (most recent call last)
[<ipython-input-11-c748460129cb>](https://localhost:8080/#) in <cell line: 13>()
     11 cells = [("triangle", triangles) ]
     12 mesh = meshio.Mesh(vertices, cells)
---> 13 mesh.write('fuji.stl')

1 frames
[/usr/local/lib/python3.10/dist-packages/meshio/_helpers.py](https://localhost:8080/#) in write(filename, mesh, file_format, **kwargs)
    175         value = cell_block.data
    176         if key in num_nodes_per_cell:
--> 177             if value.shape[1] != num_nodes_per_cell[key]:
    178                 raise WriteError(
    179                     f"Unexpected cells array shape {value.shape} for {key} cells. "

IndexError: tuple index out of range

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