Closed tkmmark closed 4 years ago
this is unnecessary
>>> from numpy import float64
>>> from compas.datastructures import Mesh
>>> import compas
>>> mesh = Mesh.from_obj(compas.get('faces.obj'))
>>> mesh.vertex_attribute(mesh.get_any_vertex(), 'x', float64(1))
>>> mesh.to_json('test.json')
>>>
@brgcode
It is true that the use of numpy floats per se does not create any issue now. But it can easily lead to downstream complications when one is then working with the stored attributes, such as with logical operators, since not all numpy datatypes with python analogues can be serialised...
again, unnecessary...
>>> from numpy import bool_
>>> from compas.datastructures import Mesh
>>> import compas
>>> mesh = Mesh.from_obj(compas.get('faces.obj'))
>>> mesh.vertex_attribute(0, 'x', bool_(1))
>>> type(mesh.vertex_attribute(0, 'x'))
<class 'numpy.bool_'>
>>> mesh.to_json('test.json')
>>>
@brgcode Ah, you mean Gonzalo added the support to the DataEncoder in the Sep 21 merge. I see now, thanks.
please check all equilibration methods involving numpy as an example:
this is to ensure that attributes are not np.float64 but float so that the form diagrams can be json-serialisable, and therefore makes it possible for form diagrams to be saved.........................................................................................