- This topic has 2 replies, 2 voices, and was last updated 7 years, 6 months ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.
Home › Forum › SOFA › Using SOFA › [SOLVED] value assignment of mechanicalState in xml fiels
hi,everyone
Does someone know that if we can assign the value of position like the case of array in xml files. For example, we can assign position = “0 0 0 0 0 0 1″, or the other case position=”@GeomagicDevice.positionDevice”, I want to assign position[0]= GeomagicDevice.positionDevice, and the rest elements of position be numerical values like position[1] = “0 0 0 0 0 0 1”,position[2] = “1 0 0 0 0 0 1”,position[3] = “2 0 0 0 0 0 1″position[4] = “3 0 0 0 0 0 1”, as a result, I want values of position to be “GeomagicDevice.positionDevice
0 0 0 0 0 0 1
1 0 0 0 0 0 1
2 0 0 0 0 0 1
3 0 0 0 0 0 1
”
but I cannot find a solution how to achieve this. Does any one have an idea about this? Thank you !
Hi Xiaojuan,
The data positionDevice of the class GeomagicDriver is not a vector of positions, but just a single Rigid coordinate. So all you can do is to manually define the data positionDevice with one rigid, for instance:
<GeomagicDriver positionDevice="0 0 0 0 0 0 1" />
Cheers,
Hugo
To answer your other question : how to define manually the vector of positions of the Mechanical Object.
At my best knowledge, this is not feasible as you described in XML using
<MechanicalObject position[i] = ".." />
Three solutions are available (taking the case of a Rigid-templated MechanicalObject):
<MechanicalObject template="Rigid" position="0 0 0 0 0 0 1
1 0 0 0 0 0 1
2 0 0 0 0 0 1
3 0 0 0 0 0 1" />
v 0 0 0 0 0 0 1
v 1 0 0 0 0 0 1
v 2 0 0 0 0 0 1
v 3 0 0 0 0 0 1
and load this obj in SOFA, and assign these loaded positions:
<MeshObjLoader name="loadingFile" filename="mesh.obj" />
...
<MechanicalObject position="@loadingFile.position" />
Does this help ?
Cheers,
Hugo
WARNING
The forum has been moved to GitHub Discussions.
Old topics and replies are kept here as an archive.