- This topic has 1 reply, 2 voices, and was last updated 3 years, 6 months ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.
Home › Forum › SOFA › Programming with SOFA › Unable to assign rest_position to MO in SofaPython3 plugin in Debug mode
Tagged: 64_bits, debug, Linux_other, Plugin_other, SOFA_other, SofaPython3
I have compiled SOFA and SofaPython3 plugni in debug mode. In this scenario, I try to assign a numpy vector to the rest position of a mechanical object, but it fails. This is the python code I am executing:
xNObject = coarseObject.addChild("xN")
xN_mo = xNObject.addObject("MechanicalObject", template="Vec1", name="xN_MO")
xN_mo.rest_position = np.array([[0,0.25,0.75]]).T
and this is the error I am getting:
[ERROR] [vector] in vector<Vec<1, double>> 5555571952d0 size 0 : invalid index 0
I understand my MO has no size when created and therefore, assigning a numpy vector to the rest position triggers the error. How should I do this correctly? I have tried calling xN_mo.size = 3 but that also fails.
WARNING
The forum has been moved to GitHub Discussions.
Old topics and replies are kept here as an archive.