29 June 2020 at 3 h 13 min #16744RowingMK2Participant
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 h 59 min #16821HugoKeymaster
- SOFA Consortium
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.scn
I hope this helps.
- You must be logged in to reply to this topic.