openmesh-python issueshttps://gitlab.vci.rwth-aachen.de:9000/OpenMesh/openmesh-python/-/issues2018-07-10T11:58:13Zhttps://gitlab.vci.rwth-aachen.de:9000/OpenMesh/openmesh-python/-/issues/22*_property_array fails for scalar-valued properties2018-07-10T11:58:13ZJanis Born*_property_array fails for scalar-valued propertiesWhen 0-dimensional, i.e. scalar properties are set using `set_*_property`, they cannot be queried as a NumPy array afterwards using `*_property_array`:
```python
mesh = om.TriMesh()
v0 = mesh.add_vertex([1,0,0])
v1 = mesh.add_vertex([0,...When 0-dimensional, i.e. scalar properties are set using `set_*_property`, they cannot be queried as a NumPy array afterwards using `*_property_array`:
```python
mesh = om.TriMesh()
v0 = mesh.add_vertex([1,0,0])
v1 = mesh.add_vertex([0,1,0])
v2 = mesh.add_vertex([0,0,1])
mesh.set_vertex_property('foo', v0, 1.0)
mesh.set_vertex_property('foo', v1, 2.0)
mesh.set_vertex_property('foo', v2, 3.0)
mesh.vertex_property_array('foo') # fails:
# IndexError: too many indices for an array: 1 (ndim = 0)
```
Higher-dimensional-valued properties work though:
```python
mesh.set_vertex_property('bar', v0, [1.0])
mesh.set_vertex_property('bar', v1, [2.0])
mesh.set_vertex_property('bar', v2, [3.0])
mesh.vertex_property_array('bar') # works:
# array([[1.],
# [2.],
# [3.]])
```Alexander DielenAlexander Dielenhttps://gitlab.vci.rwth-aachen.de:9000/OpenMesh/openmesh-python/-/issues/15cannot set 1D arrays as property arrays2018-06-13T18:18:10ZJanis Borncannot set 1D arrays as property arrays```python
m = om.TriMesh()
for _ in range(4):
m.add_vertex(np.random.rand(3))
m.set_vertex_property_array('test', [1,2,3,4]) # doesn't work (fails silently)
m.vertex_property_array('test') # fails here
m.set_vertex_property_array('...```python
m = om.TriMesh()
for _ in range(4):
m.add_vertex(np.random.rand(3))
m.set_vertex_property_array('test', [1,2,3,4]) # doesn't work (fails silently)
m.vertex_property_array('test') # fails here
m.set_vertex_property_array('test', [[1],[2],[3],[4]]) # this works
```
The first `set_vertex_property_array` call should also work and set a property that assigns a scalar to every vertex.Alexander DielenAlexander Dielen