← Back to team overview

yade-dev team mailing list archive

Re: vector<Vector3r> from python

 

> Hi.
> Vaclav, I have vector<Vector3r> attribute in a class. How can I create this class from python?
> Now I do, for example, as
> b.shape=GeometricalModel('Facet',{'vertices':[[1,0,0],[0,0,1],[0,0,-1]],'diffuseColor':color,'wire':wire,'visible':True})
> but I get "RuntimeError: Could not extract type double"
>   
Hi, unfortunately there is a bug in RTTI or in yade-serialization that I
wasn't able to fix although I tried rather hard. Find attached a file
with workaround: use raw string to pass that attribute (setRaw). My idea
was to create same utility function for edges and vertices as well, but
I didn't have time since then; if you do it, that would be great.
Eventually, I though of importing ASCII file with triangular mesh
(vertex coordinates and vertex number for faces) and building simulation
from that (since I am at odds with blender ;-) ). The advantage also
woulds be that once we dump this yade-serialization, only internals of
these functions will change. Once those functions work corretly, feel
free to add them to utils.py.

HTH, Vaclav



Follow ups

References