Hello,

I have a problem related to the way we access the scene and nodes
information via the C++ API of SOFA (from MITK). I have a simulation node,

sofa::simulation::Simulation simnode;

Based on that object, I want to access a specific node component of this
simulation, that is an OglModel (a mesh loaded from an stl). What I want to
do is modify the translation and rotation properties of this node. That can
be done on the xml file defining the scene as:

<OglModel template=”ExtVec3f” name=”oglModel6″ translation=”100 0 100″ ..

However, as I am using MITK integrated with sofa, I need a way to access
and modify the scene using the C++ API, not the xml. Is there a way I can
get the OglModel object and add/modify fields to it from the
sofa::simulation::Simulation class?

I get to the point where I get the SOFASimulation object from the
mitk::Simulation one.


SOFASimulation = simulation->GetSOFASimulation();


Then I get a child node and try to get the mesh object and cast it to a
VisualModel which has an applyTranslation method. However this does not
seem to work, what I want to do is setup the scene moving the mesh (not on
simulation runtime)

sofa::simulation::Node::SPtr ImplantNode =
SOFASimulation->GetRoot()->GetChild("Implant");

sofa::core::objectmodel::BaseObject *object =
ImplantNode->getObject("oglModel6");

sofa::core::visual::VisualModel* visualModel =
dynamic_cast<sofa::core::visual::VisualObject*>(object);

visualModel->applyTranslation(100,0,100);


Is it a casting problem, reference ... I do not know how to modify the
initial placement of the objects of the scene, and the SOFA C++ API does
not provide any examples that I have seen.


Thank You,

Albert.



Thank you very much,
Cordially,
Albert.
------------------------------------------------------------------------------
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to