Forum Replies Created
-
AuthorPosts
-
HarrisBlocked
Hi Hugo,
Thanks a lot for your help.
I would like to ask you something more. I want to meassure the stress or strain in an element and I am using Co-rotationalFEM component. When I compute strain by: Strain=StrainDisplacement*Displacement I meassure very smaller strains than the FEBIO software computes. Is this because I compute local strain and FEBIO computes global strain?
Thank you for your time,
HarrisHarrisBlockedHi Hugo,
When you say “solver requires more iterations” do you mean Gauss Seidel algorithm needs more iterations to converge?
Thank you for your reply
HarrisHarrisBlockedHi Hugo,
I use Lagrange multipliers approach.
Harris
HarrisBlockedHi Binesh,
Do you meen that this class has a function which returns the strain vector of each element or I have to calculate the product of the matrices : StrainDisplacement*Displacement, to obtain this vector?
I want in the end to make a colourmap.
Harris
HarrisBlockedHi Binesh,
I solved my problem.
I realize that I had written in the include:
SofaGeneralEngine/BoxROI.hSorry, my mistake.
Thank you for your time,
HarrisHarrisBlockedHi,
the errors are:
LNK2001 Error unresolved external symbol “public: virtual class sofa::core::objectmodel::BaseClass const * __cdecl sofa::component::engine::BoxROI<class sofa::defaulttype::StdVectorTypes<class sofa::defaulttype::Vec<6,double>,class sofa::defaulttype::Vec<6,double>,double> >::getClass(void)const
etc..
Thank you,
HarrisHarrisBlockedHi Hugo,
I think in the geomagic examples ,for example in Geomagic-FEMLiver.scn is wrong to write for the position of the instrument:
<MechanicalObject name=”instrumentState” position=”@GeomagicDevice.positionDevice” />
I deleted “@GeomagicDevice.positionDevice” and it works well without penetrating the liver.I did the same for the cylinder example.
I think this happens because instrument is the god object and its position has to be defined from the position of the Omni and the spring which connect them(VectorSpringForcefield) and not to be tagged to the position of the device.
Is it correct?Best,
HarrisHarrisBlockedHi Hugo,
I have read this the related doc and I tried the examples you mentioned but I was wondering if there is a better explanation for the use of some components for example:
-why Omni is used
-why VectorSpringForcefield is used to connect them?
(Is it a coupling between god object(Instrument) and haptic device(Omni) that is described in the related literature?)Also,I tried the scene GeomagicCarving which is on Github but the instrument sometimes penetrates the cylinder.I meen that the result is not as good as appeared in the video of “SofaCarving with haptics”.
Do you have any advice to fix this?Sorry for all these quetions but it is the first time that I use haptic devices.
Thank you for your time,
HarrisHarrisBlockedThe way I convert .obj files into .msh:
1)Convert .obj to .stl in blender or in meshlab
2)Use tetgen to tetrahedralize the surface model.Tetgen make a .mesh file
3)Convert .mesh to .msh in gmsh softwarehope this helps,
HarrisHarrisBlockedHi Hugo,
Thank you for your answers.I know about mappings and I have already used some types of them.However,I asked for the case of Sofacarving in which triangles are removed and topology changes.I tried to just use BarycentricMapping instead of IdentityMapping but it doesn not work properly.Could you help me?
Best,
HugoHarrisBlockedHi Hugo,
Thank you for your answer.I will test the different approaches you mentioned.Also,I was thinking about Multithreading plugin,do you think it will help me in my scene(combining geomagic and carving plugin)?
Best,
HarrisHarrisBlockedHi Hugo,
I solved the problem that I mentioned in a previous message and some issues with the distance of the collision in Geomagic.
Also,thank you for the links I will check if the algorithms are exactly the same in a few days.
Could I ask you here for more theoretical and software issues in the future?Best,
HarrisHarrisBlockedHi,
I solved the problems that I had before.
I would like to know how the component: “PrecomputedConstraintCorrection” works.
Is there any related paper which describes the functionality of this component?Best
HarrisHarrisBlockedHi @outtt,
Thank you for your help.Now I can use the haptic device.
Also, I want to do the carving with the hatic device.
I observed that “CollisionResponse” response=”default” in SofaCarving plugin but response=”FrictionContact” in Geomagic plugin.If I use response=”FrictionContact”,I get the following error when the carvingTool collides with carvingSurface:
Exception thrown at 0x00007FFF80F9B9BA (SofaConstraint.dll) in runSofa.exe: 0xC0000005: Access violation reading location 0x0000000000000000.
Could you help me fix this?
Thank you,
HarrisHarrisBlockedHi Hugo,
here is my cpp scene:
Node::SPtr groot = sofa::simulation::getSimulation()->createNewGraph("Root"); groot->setGravity(sofa::defaulttype::Vector3(0, -9.81, 0)); groot->setDt(0.005); sofa::component::visualmodel::VisualStyle::SPtr style = sofa::core::objectmodel::New<sofa::component::visualmodel::VisualStyle>(); sofa::core::visual::DisplayFlags& flags = *style->displayFlags.beginEdit(); flags.setShowCollisionModels(true); flags.setShowVisualModels(false); style->displayFlags.endEdit(); groot->addObject(style); sofa::component::collision::DefaultPipeline::SPtr pipeline = sofa::core::objectmodel::New<sofa::component::collision::DefaultPipeline>(); pipeline->setName("CollisionPipeline"); pipeline->d_depth.setValue(6); groot->addObject(pipeline); sofa::component::collision::BruteForceDetection::SPtr bruteforce = sofa::core::objectmodel::New<sofa::component::collision::BruteForceDetection>(); bruteforce->setName("N2"); groot->addObject(bruteforce); sofa::component::collision::DefaultContactManager::SPtr response = sofa::core::objectmodel::New<sofa::component::collision::DefaultContactManager>(); response->setName("Collision Response"); response->setDefaultResponseType("FrictionContact"); //response->response.setName("FrictionContact"); groot->addObject(response); sofa::component::collision::LocalMinDistance::SPtr localMinDist = sofa::core::objectmodel::New<sofa::component::collision::LocalMinDistance>(); localMinDist->setName("Proximity"); localMinDist->alarmDistance.setValue(0.15); localMinDist->contactDistance.setValue(0.05); localMinDist->angleCone.setValue(0.0); //localMinDist->coneFactor.setValue(0.5); groot->addObject(localMinDist); sofa::component::constraintset::LCPConstraintSolver::SPtr lpcSolver = sofa::core::objectmodel::New<sofa::component::constraintset::LCPConstraintSolver>(); lpcSolver->tol.setValue(0.001); lpcSolver->maxIt.setValue(1000); lpcSolver->mu.setValue(0.6); groot->addObject(lpcSolver); sofa::component::controller::GeomagicDriver::SPtr geomDriver = sofa::core::objectmodel::New<sofa::component::controller::GeomagicDriver>(); geomDriver->setName("GeomagicDevice"); geomDriver->d_deviceName.setValue("Default Device"); geomDriver->d_scale.setValue(1); geomDriver->d_frameVisu.setValue(true); geomDriver->d_positionBase.setValue(sofa::defaulttype::Vector3(0, 0, 0)); geomDriver->d_orientationBase.setValue(sofa::defaulttype::Quat(0, 0.707, 0, - 0.707)); geomDriver->f_listening.setValue(true); groot->addObject(geomDriver); /*-----------------Rigid Obj----------------------------------------*/ sofa::simulation::Node::SPtr thoracNode = groot.get()->createChild("Rigid-SKull"); //Collision sofa::simulation::Node::SPtr thoracsurf = thoracNode.get()->createChild("Thorac Surf"); //ObjLoader (coarser) sofa::component::loader::MeshObjLoader::SPtr thoracLoader = sofa::core::objectmodel::New<sofa::component::loader::MeshObjLoader>(); thoracLoader->setFilename(sofa::helper::system::DataRepository.getFile("mesh/diploma/liver-smooth.obj")); thoracLoader->load(); thoracsurf->addObject(thoracLoader); //Topology sofa::component::topology::MeshTopology::SPtr thoracTopology = sofa::core::objectmodel::New<sofa::component::topology::MeshTopology>(); thoracTopology->setSrc("", thoracLoader.get()); thoracsurf->addObject(thoracTopology); //Mechanical Obj MechanicalObject3::SPtr thoracMech = sofa::core::objectmodel::New<MechanicalObject3>(); thoracMech->setName("instrumentCollisionState"); thoracMech->setSrc("", thoracLoader.get()); thoracMech->setTranslation(0, 0, 10); thoracsurf->addObject(thoracMech); //Triangle TTriangle_3::SPtr thoracTrian = sofa::core::objectmodel::New<TTriangle_3>(); thoracTrian->setName("Triangles"); thoracTrian->setContactStiffness(100); thoracTrian->setContactFriction(0.01); thoracTrian->setSimulated(false); thoracTrian->setMoving(false); thoracsurf->addObject(thoracTrian); //Line TLine_3::SPtr thoracLines = sofa::core::objectmodel::New<TLine_3>(); thoracLines->setName("Lines"); thoracLines->setContactStiffness(100); thoracLines->setSimulated(false); thoracLines->setContactFriction(0.01); thoracLines->setMoving(false); thoracsurf->addObject(thoracLines); //Point TPoint_3::SPtr thoracPoints = sofa::core::objectmodel::New<TPoint_3>(); thoracPoints->setName("Points"); thoracPoints->setContactStiffness(100); thoracPoints->setContactFriction(0.01); thoracPoints->setSimulated(false); thoracPoints->setMoving(false); thoracsurf->addObject(thoracPoints); /*---------------------------Omni---------------------------------------------------*/ sofa::simulation::Node::SPtr carvingElement = groot.get()->createChild("Omni"); MechanicalObjectRigid3::SPtr dofRigid = sofa::core::objectmodel::New<MechanicalObjectRigid3>(); dofRigid->setName("DofsRigid"); dofRigid->x.setParent(geomDriver->d_posDevice.getData()); carvingElement->addObject(dofRigid); //MechanicalStateController sofa::component::controller::MechanicalStateController<sofa::defaulttype::Rigid3dTypes>::SPtr controller = sofa::core::objectmodel::New<sofa::component::controller::MechanicalStateController<sofa::defaulttype::Rigid3dTypes>>(); controller->f_listening.setValue(true); controller->setMainDirection(sofa::defaulttype::Vec3d(-1, 0, 0)); controller->handleEventTriggersUpdate.setValue(true); carvingElement->addObject(controller); sofa::simulation::Node::SPtr visuAvatar = carvingElement.get()->createChild("VisuAvatar"); visuAvatar->setActive(false); OglModel::SPtr visual1 = sofa::core::objectmodel::New<OglModel>(); visual1->setName("Visual"); visual1->load(sofa::helper::system::DataRepository.getFile("mesh/sphere.obj"), "", ""); visual1->setColor("gray"); visual1->setScale(0.1, 0.1, 0.1); visuAvatar->addObject(visual1); //RigidMapping RigidMapping_Rigid_to_Extevec3F::SPtr rigidMap2 = sofa::core::objectmodel::New<RigidMapping_Rigid_to_Extevec3F>(); rigidMap2->setName("VM Mapping"); rigidMap2->setModels(dofRigid.get(), visual1.get()); visuAvatar->addObject(rigidMap2); sofa::simulation::Node::SPtr refModel = carvingElement.get()->createChild("RefModel"); sofa::component::loader::MeshObjLoader::SPtr loaderFixed = sofa::core::objectmodel::New<sofa::component::loader::MeshObjLoader>(); loaderFixed->setFilename(sofa::helper::system::DataRepository.getFile("mesh/dental_instrument_centerline.obj")); loaderFixed->load(); refModel->addObject(loaderFixed); sofa::component::topology::MeshTopology::SPtr meshTorusFEM = sofa::core::objectmodel::New<sofa::component::topology::MeshTopology>(); meshTorusFEM->setSrc("", loaderFixed.get()); refModel->addObject(meshTorusFEM); MechanicalObject3::SPtr instrumentColState = sofa::core::objectmodel::New<MechanicalObject3>(); instrumentColState->setName("instrumentCollisionState"); instrumentColState->setSrc("", loaderFixed.get()); instrumentColState->setRotation(0, -180, -90); instrumentColState->setTranslation(-0.3, 0, 3.5); refModel->addObject(instrumentColState); RigidMapping_Rigid_to_Vec3d::SPtr rigidMap3 = sofa::core::objectmodel::New<RigidMapping_Rigid_to_Vec3d>(); rigidMap3->setModels(dofRigid.get(), instrumentColState.get()); refModel->addObject(rigidMap3); sofa::simulation::Node::SPtr refModelRight = carvingElement.get()->createChild("RefModelRight"); sofa::component::loader::MeshObjLoader::SPtr loaderFixedright = sofa::core::objectmodel::New<sofa::component::loader::MeshObjLoader>(); loaderFixedright->setFilename(sofa::helper::system::DataRepository.getFile("mesh/dental_instrument_centerline.obj")); loaderFixedright->load(); refModelRight->addObject(loaderFixedright); sofa::component::topology::MeshTopology::SPtr meshTorusFEMRight = sofa::core::objectmodel::New<sofa::component::topology::MeshTopology>(); meshTorusFEMRight->setSrc("", loaderFixedright.get()); refModelRight->addObject(meshTorusFEMRight); MechanicalObject3::SPtr instrumentColStateRight = sofa::core::objectmodel::New<MechanicalObject3>(); instrumentColStateRight->setName("instrumentCollisionState"); instrumentColStateRight->setSrc("", loaderFixedright.get()); instrumentColStateRight->setRotation(0, -180, -90); instrumentColStateRight->setTranslation(-0.3, 0.5, 3.5); refModelRight->addObject(instrumentColStateRight); RigidMapping_Rigid_to_Vec3d::SPtr rigidMap3right = sofa::core::objectmodel::New<RigidMapping_Rigid_to_Vec3d>(); rigidMap3right->setModels(dofRigid.get(), instrumentColStateRight.get()); refModelRight->addObject(rigidMap3right); sofa::simulation::Node::SPtr refModelleft = carvingElement.get()->createChild("RefModelLeft"); sofa::component::loader::MeshObjLoader::SPtr loaderFixedleft = sofa::core::objectmodel::New<sofa::component::loader::MeshObjLoader>(); loaderFixedleft->setFilename(sofa::helper::system::DataRepository.getFile("mesh/dental_instrument_centerline.obj")); loaderFixedleft->load(); refModelleft->addObject(loaderFixedleft); sofa::component::topology::MeshTopology::SPtr meshTorusFEMleft = sofa::core::objectmodel::New<sofa::component::topology::MeshTopology>(); meshTorusFEMleft->setSrc("", loaderFixedleft.get()); refModelleft->addObject(meshTorusFEMleft); MechanicalObject3::SPtr instrumentColStateleft = sofa::core::objectmodel::New<MechanicalObject3>(); instrumentColStateleft->setName("instrumentCollisionState"); instrumentColStateleft->setSrc("", loaderFixedleft.get()); instrumentColStateleft->setRotation(0, -180, -90); instrumentColStateleft->setTranslation(-0.3, -0.5, 3.5); refModelleft->addObject(instrumentColStateleft); RigidMapping_Rigid_to_Vec3d::SPtr rigidMap3left = sofa::core::objectmodel::New<RigidMapping_Rigid_to_Vec3d>(); rigidMap3left->setModels(dofRigid.get(), instrumentColStateleft.get()); refModelleft->addObject(rigidMap3left); /*------------------------Instrument---------------------------------------------*/ sofa::simulation::Node::SPtr instrum = groot.get()->createChild("Instrument"); EulerImplicitSolver::SPtr solverInstrum = sofa::core::objectmodel::New<EulerImplicitSolver>(); solverInstrum->setName("ODE solver"); solverInstrum->f_rayleighStiffness.setValue(0.05); solverInstrum->f_rayleighMass.setValue(1.0); instrum->addObject(solverInstrum); CGLinearSolver3::SPtr linearSolverIntrum = sofa::core::objectmodel::New<CGLinearSolver3>(); linearSolverIntrum->setName("linear solver"); linearSolverIntrum->f_maxIter.setValue(25); linearSolverIntrum->f_tolerance.setValue(1e-10); linearSolverIntrum->f_smallDenominatorThreshold.setValue(10e-10); instrum->addObject(linearSolverIntrum); MechanicalObjectRigid3::SPtr dofRigidInstrum = sofa::core::objectmodel::New<MechanicalObjectRigid3>(); dofRigidInstrum->setName("instrumentState"); dofRigidInstrum->x.setParent(geomDriver->d_posDevice.getData()); instrum->addObject(dofRigidInstrum); UniformMassRigid3::SPtr uniMassCarvInstrum = sofa::core::objectmodel::New<UniformMassRigid3>(); uniMassCarvInstrum->setTotalMass(0.05); uniMassCarvInstrum->setName("Mass"); instrum->addObject(uniMassCarvInstrum); sofa::component::controller::LCPForceFeedback<sofa::defaulttype::Rigid3dTypes>::SPtr lcpContr = sofa::core::objectmodel::New<sofa::component::controller::LCPForceFeedback<sofa::defaulttype::Rigid3dTypes>>(); lcpContr->f_activate.setValue(true); lcpContr->forceCoef.setValue(0.001); instrum->addObject(lcpContr); sofa::component::constraintset::UncoupledConstraintCorrection<sofa::defaulttype::Rigid3dTypes>::SPtr constrUncoup= sofa::core::objectmodel::New<sofa::component::constraintset::UncoupledConstraintCorrection<sofa::defaulttype::Rigid3dTypes>>(); instrum->addObject(constrUncoup); sofa::simulation::Node::SPtr collModelInstrument = instrum.get()->createChild("CollisionModel"); sofa::component::loader::MeshObjLoader::SPtr loaderColl = sofa::core::objectmodel::New<sofa::component::loader::MeshObjLoader>(); loaderColl->setName("loader"); loaderColl->setFilename(sofa::helper::system::DataRepository.getFile("mesh/dental_instrument_centerline.obj")); loaderColl->load(); collModelInstrument->addObject(loaderColl); sofa::component::topology::MeshTopology::SPtr meshColl = sofa::core::objectmodel::New<sofa::component::topology::MeshTopology>(); meshColl->setSrc("", loaderColl.get()); collModelInstrument->addObject(meshColl); MechanicalObject3::SPtr mechColl = sofa::core::objectmodel::New<MechanicalObject3>(); mechColl->setName("instrumentCollisionState"); mechColl->setSrc("", loaderColl.get()); mechColl->setRotation(0, -180, -90); mechColl->setTranslation(-0.3, 0, 3.5); collModelInstrument->addObject(mechColl); //Lines TLine_3::SPtr line_coll_instr = sofa::core::objectmodel::New<TLine_3>(); line_coll_instr->setName("Lines"); line_coll_instr->setContactStiffness(10.0); line_coll_instr->setContactFriction(0.01); collModelInstrument->addObject(line_coll_instr); //Points TPoint_3::SPtr points_col_instr = sofa::core::objectmodel::New<TPoint_3>(); points_col_instr->setName("Points"); points_col_instr->setContactStiffness(10.0); points_col_instr->setContactFriction(0.01); collModelInstrument->addObject(points_col_instr); //RigidMapping RigidMapping_Rigid_to_Vec3d::SPtr rigidMapInstrCol = sofa::core::objectmodel::New<RigidMapping_Rigid_to_Vec3d>(); rigidMapInstrCol->setName("VM Mapping"); rigidMapInstrCol->setModels(dofRigidInstrum.get(), mechColl.get()); collModelInstrument->addObject(rigidMapInstrCol); //Right sofa::simulation::Node::SPtr collModelInstrumentRight = instrum.get()->createChild("RefModelRight"); sofa::component::loader::MeshObjLoader::SPtr loaderCollRight = sofa::core::objectmodel::New<sofa::component::loader::MeshObjLoader>(); loaderCollRight->setFilename(sofa::helper::system::DataRepository.getFile("mesh/dental_instrument_centerline.obj")); loaderCollRight->load(); collModelInstrumentRight->addObject(loaderCollRight); sofa::component::topology::MeshTopology::SPtr meshCollRight = sofa::core::objectmodel::New<sofa::component::topology::MeshTopology>(); meshCollRight->setSrc("", loaderCollRight.get()); collModelInstrumentRight->addObject(meshCollRight); MechanicalObject3::SPtr mechCollRight = sofa::core::objectmodel::New<MechanicalObject3>(); mechCollRight->setName("instrumentCollisionState"); mechCollRight->setSrc("", loaderCollRight.get()); mechCollRight->setRotation(0, -180, -90); mechCollRight->setTranslation(-0.3, 0.5, 3.5); collModelInstrumentRight->addObject(mechCollRight); //RigidMapping RigidMapping_Rigid_to_Vec3d::SPtr rigidMapInstrColRight = sofa::core::objectmodel::New<RigidMapping_Rigid_to_Vec3d>(); rigidMapInstrColRight->setName("VM Mapping"); rigidMapInstrColRight->setModels(dofRigidInstrum.get(), mechCollRight.get()); collModelInstrumentRight->addObject(rigidMapInstrColRight); //Left sofa::simulation::Node::SPtr collModelInstrumentLeft = instrum.get()->createChild("RefModelLeft"); sofa::component::loader::MeshObjLoader::SPtr loaderCollLeft = sofa::core::objectmodel::New<sofa::component::loader::MeshObjLoader>(); loaderCollLeft->setFilename(sofa::helper::system::DataRepository.getFile("mesh/dental_instrument_centerline.obj")); loaderCollLeft->load(); collModelInstrumentLeft->addObject(loaderCollLeft); sofa::component::topology::MeshTopology::SPtr meshCollLeft = sofa::core::objectmodel::New<sofa::component::topology::MeshTopology>(); meshCollLeft->setSrc("", loaderCollLeft.get()); collModelInstrumentLeft->addObject(meshCollLeft); MechanicalObject3::SPtr mechCollLeft = sofa::core::objectmodel::New<MechanicalObject3>(); mechCollLeft->setName("instrumentCollisionState"); mechCollLeft->setSrc("", loaderCollLeft.get()); mechCollLeft->setRotation(0, -180, -90); mechCollLeft->setTranslation(-0.3, -0.5, 3.5); collModelInstrumentLeft->addObject(mechCollLeft); //RigidMapping RigidMapping_Rigid_to_Vec3d::SPtr rigidMapInstrColLeft = sofa::core::objectmodel::New<RigidMapping_Rigid_to_Vec3d>(); rigidMapInstrColLeft->setName("VM Mapping"); rigidMapInstrColLeft->setModels(dofRigidInstrum.get(), mechCollLeft.get()); collModelInstrumentLeft->addObject(rigidMapInstrColLeft); //VectorSpringForceField sofa::component::interactionforcefield::VectorSpringForceField<sofa::defaulttype::Vec3dTypes>::SPtr vSpringForc = sofa::core::objectmodel::New<sofa::component::interactionforcefield::VectorSpringForceField<sofa::defaulttype::Vec3dTypes>>(); //vSpringForc->addTag() vSpringForc->setPathObject1("@Omni/RefModel/instrumentCollisionState"); vSpringForc->setPathObject2("@Instrument/CollisionModel/instrumentCollisionState"); vSpringForc->m_stiffness.setValue(10); vSpringForc->m_viscosity.setValue(0); instrum->addObject(vSpringForc); sofa::component::interactionforcefield::VectorSpringForceField<sofa::defaulttype::Vec3dTypes>::SPtr vSpringForc2 = sofa::core::objectmodel::New<sofa::component::interactionforcefield::VectorSpringForceField<sofa::defaulttype::Vec3dTypes>>(); vSpringForc2->setPathObject1("@Omni/RefModelRight/instrumentCollisionState"); vSpringForc2->setPathObject2("@Instrument/RefModelRight/instrumentCollisionState"); vSpringForc2->m_stiffness.setValue(10); vSpringForc2->m_viscosity.setValue(0); instrum->addObject(vSpringForc2); sofa::component::interactionforcefield::VectorSpringForceField<sofa::defaulttype::Vec3dTypes>::SPtr vSpringForc3 = sofa::core::objectmodel::New<sofa::component::interactionforcefield::VectorSpringForceField<sofa::defaulttype::Vec3dTypes>>(); vSpringForc3->setPathObject1("@Omni/RefModelLeft/instrumentCollisionState"); vSpringForc3->setPathObject2("@Instrument/RefModelLeft/instrumentCollisionState"); vSpringForc3->m_stiffness.setValue(10); vSpringForc3->m_viscosity.setValue(0); instrum->addObject(vSpringForc3);
In order to link the position of GeomagicDriver with the position og mechanical object(“Instrument”) I wrote:
“dofRigidInstrum->x.setParent(geomDriver->d_posDevice.getData());”
Is it possible when the objects (Rigid and Instrument) collide, mechanicalInstrument to conflict between the response of the collision and the position of the GeomagicDevice?Thank you for your time,
HarrisHarrisBlockedHi,
I solved the problem that I asked in the previous post.
Now, I can move the device in the scene but when the device collides with an object of the scene, I have the following error:
Exception thrown at 0x00007FFCCE6BF070 (SofaBaseMechanics.dll) in runSofa.exe: 0xC0000005: Access violation reading location 0x00000000000007F8.
I tried to write in cpp all the components decribed in: Geomagic-RigidSkull.scn and only the component “FreeMotionAnimationLoop” I couldn’t write.(I had an error with the constructor)
Could you help me fix this error?
Thank you,
Harris10 October 2018 at 15:41 in reply to: [SOLVED] Linking GeomagicDevice.position with MechanicalObject3d.position in cpp #12141HarrisBlockedHi Hugo,
I am sorry for this post.
I was thinking that my first post was in a different topic and that was difficult for someone to see it.I am waiting for your reply
Thank you,
HarrisHarrisBlockedHi Hugo,
I don’t get an error but as I ran the Geomagic-FEMLiver.scn,I saw in the node of the Mechanical object that its position is the same with @GeomagicDevice.positionDevice.So I want to do the same in cpp but I can not make this connection between Mechanical Object and Geomagic Device.
Harris
HarrisBlockedHi,
I tested the fix and now I do not have a problem.
However, I can’t write the following XML line:
<MechanicalObject template=”Rigid” name=”DOFs” position=”@GeomagicDevice.positionDevice”/>
in cpp.I can’t find a way to add a tag to the position of the MechanicalObject.
Could you help me?
Thank you,
HarrisHarrisBlockedHi Hugo,
I just informed by Eric Pernod from InfinityTech3D that there is a bug in the export dll of sofa geomagic plugin and tha it will be fixed in this week.
Best,
HarrisHarrisBlockedHi Hugo,
Yes I tried to implement Geomagic-FEMLiver.scn (the whole scene) in c++ to see how it works because I need it in my c++ application.
Before I implemented in c++ the SimpleCarving_withPenetration.scn (the whole scene) without errors.
Here is the code:sofa::component::collision::CarvingManager::SPtr carv= sofa::core::objectmodel::New<sofa::component::collision::CarvingManager>();
carv->d_active.setValue(true);
carv->d_carvingDistance.setValue(-0.09);
carv->setName(“carving”);
groot->addObject(carv);I also added the CarvingSurface and CarvingTool.
In addition, before start implementing the components of the scene I wrote this code for loading the plugins:
vector<string> plugins;
//ADD PLUGINS: SofaCarving , Geomagic
plugins.push_back(“SofaCarving”);
plugins.push_back(“Geomagic”);
and the plugins are loaded.I know I have to create my own plugin but for now I wanted to just check if I can implement all the components that I need in cpp.
Harris
HarrisBlockedHi Hugo,
No, I wrote this code in runSofa project in Main.cpp.
I only added additional dependencie : Geomagic.lib and the
I did the same for the SofaCarving and I did not had a problem.Harris
HarrisBlockedHi Hugo,
I wrote :
sofa::component::controller::GeomagicDriver::SPtr geomDriver = sofa::modeling::addNew <sofa::component::controller::GeomagicDriver>(groot);
but now I have the following error:
LNK2019 Error unresolved external symbol “public: __cdecl sofa::component::controller::GeomagicDriver::GeomagicDriver(void)” (??0GeomagicDriver@controller@component@sofa@@QEAA@XZ) referenced in function “public: __cdecl sofa::modeling::addNew<class sofa::component::controller::GeomagicDriver>::addNew<class sofa::component::controller::GeomagicDriver>(class boost::intrusive_ptr<class sofa::simulation::Node>,char const *)” (??0?$addNew@VGeomagicDriver@controller@component@sofa@@@modeling@sofa@@QEAA@V?$intrusive_ptr@VNode@simulation@sofa@@@boost@@PEBD@Z)
Thank you for your time,
Harris -
AuthorPosts