- This topic has 1 reply, 2 voices, and was last updated 4 years, 5 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 › surface mapping and PartialLinearMovementConstraint in cpp language
Tagged: 64_bits, SOFA_1912, surface mapping, Windows_10
Dear Developers,
Hello, I am the beginner of SOFA.
Last week, I builded SOFA with cpp and I am using this framework to make my own program.
I want to use this framework to move specific point of object like
in this thread. To do this, It seems that ‘surface mapping’ and ‘PartialLinearMovementConstraint’ to be implemented.
In python, code looks quite simple like below. However, I am not sure how cpp can implement the following code.(Application/Tutorial examples are nor cover this things.)
Please let me know if there is any document I can refer to it.
Thanks a lot.
Surf = LiverFEM.createChild("Surf")
self.Surf = Surf
Surf.gravity = gravity
Surf.createObject("SphereLoader, name="SphereLoader", filename="mesh/liver.sph")
Surf.createObject("MechanicalObject", position="@[-1].position", name="mappedMS")
Surf.createObject("SphereModel", listRadius="@[-2].listRadius", name="CollisionModel")
Surf.createObject("BarycentricMapping", input="@../dofs", name="sphere mapping", output="@mappedMS")
cT = self.LiverFEM.getTime()
self.LiverFEM.getObject("PartialLinearMovementConstraint").findData("keyTimes").value = [[cT], [cT + 100]]
self.LiverFEM.getObject("PartialLinearMovementConstraint").findData("movements").value = [0.5*math.sin(cT), 0.5*math.cos(cT), 0]
Dear @dst03251
Welcome on the forum and congratulations for your first steps in SOFA.
To start with SOFA, I would advise the following steps:
If you prefer we also have training sessions for efficiently start with SOFA.
In you files you are loading sphere models, usually used for collision.
I guess you would like to move these spheres in your python script. You should get inspired from the (xml but you can do the same in python) scene : examples/Components/constraint/LinearMovementConstraint.scn
I hope this helps.
Best wishes,
Hugo
WARNING
The forum has been moved to GitHub Discussions.
Old topics and replies are kept here as an archive.