Hello Stefan, I already asked on the SOFA Forum
https://www.sofa-framework.org/community/forum/topic/modify-fields-of-a-node-components-such-as-translationrotation-from-c-api/#post-7972 However, I am still stuck with the question, as seemingly the C++ API of SOFA is not used a lot, and also I do not know how the integration with MITK works (e.g do i have to reinit the scene node for any modification to happen?). I believe it is a problem with the references or casting, but I get quite lost on the API of SOFA with C++.... Best Regards, Albert. 2016-11-24 8:26 GMT+01:00 Kislinskiy, Stefan < [email protected]>: > Hi Albert, > > > for questions related to pure SOFA, I highly recommend to ask in the > official SOFA forum instead: > > https://www.sofa-framework.org/community/forum/section/ > user-forum/developing-in-sofa/ > > > Best, > Stefan? > > > ________________________________ > Von: Albert Alises <[email protected]> > Gesendet: Mittwoch, 23. November 2016 10:56 > An: [email protected] > Betreff: [mitk-users] [SOFA] Modify fields of a node component (such as > translation/rotation) from C++ API. > > > 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
