Home › Forum › SOFA › Programming with SOFA › surface mapping and PartialLinearMovementConstraint in cpp language
Tagged: 64_bits, SOFA_1912, surface mapping, Windows_10
- This topic has 1 reply, 2 voices, and was last updated 4 years ago by
Hugo.
-
AuthorPosts
-
29 June 2020 at 03:13 #16744
RowingMK2
BlockedDear 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]
7 July 2020 at 22:59 #16821Hugo
KeymasterDear @dst03251
Welcome on the forum and congratulations for your first steps in SOFA.
To start with SOFA, I would advise the following steps:- follow the online documentation
- watch our first Tutorials on YouTube
- start using SOFA, running the examples/Tutorials (as you just did)
- read a reference paper about SOFA
- browse the SOFA API
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.scnI hope this helps.
Best wishes,Hugo
-
AuthorPosts
- You must be logged in to reply to this topic.