Forum Replies Created
-
AuthorPosts
-
amitBlocked
Hello Hugo,
Thank You for your suggestion. I will test it out.
Meanwhile, I worked around it by writing a python script to print out indices from nearestPointROI component to a text file and using indices to link springs from that file.Right now I am struggling with collision detection in sofa. When I set my models for collision(triangle/sphere or any model) the frame rate drops and the simulation becomes unusable. I need real time, fast and robust collision detection between the organs and the tools so they dont penetrate each other and I can set up interaction based on collision of the tools and organs. What is the proper way to set up collision pipeline so that we can have realistic real time collision with suitable frame rates(~ 60 fps). Please help me with this issue.
amitBlockedHello @hugo,
I just changed drawPoints() function in draw function of BoxROI with draw3DText_Indices(). But i think it is giving me the index of points in roi but not in mesh.
Sorry could not figure out the proper way to follow what you said. Would you mind helping me do this?Also, if I have to check for some event in each frame like checking the elongation of spring or collision, what is the best way to do this?
Thank youamitBlockedHey @Hugo,
Thank You I am trying try all the methods you suggested.
How do we show indices in a region? Using showIndices in mechanical object gives unreadable indices so I tried using BoxROI with show indices to only show indices of some region I am interested in but it is not working with message unused attribute showIndices. Anyway we can show only the indices of region in interest?amitBlockedHi @avihs98
Yes there is already a plugin in development.
This is the website taking you to the plugin. Contact the developer regarding your usage requirements.Its quite performant and integrates well with unity but you should have working/basic knowledge in sofa framework to begin using the plugin.
Thank you,
AmitamitBlockedThank you @Hugo.
I am now trying to create a component based on SpringForceField. But what concerns me is I have to provide the indices of the meshes manually to be linked to make the spring. I am currently using unity3D plugin for sofa and I am testing a lot of stuffs and changes are very frequent, also of the meshes. Is there any way I can provide the mesh indices data to be linked for the springs using python or available components in sofa?
Thank you
amitBlockedHi @hugo,
sorry I dont quite understand what you want me to look at the freeanimationloop.scn.
Let me put my situation more clearly.
I am trying to model fatty tissue that is between two organs, Liver and gallbladder. Here is the xml scene for modelling fatty tissue between liver and gallbladder.<?xml version="1.0" ?> <Node name="root" dt="0.02" showBoundingTree="0"> <VisualStyle displayFlags="showBehaviorModels showVisual" /> <CollisionPipeline verbose="0" /> <BruteForceDetection name="N2" /> <CollisionResponse response="default" /> <MinProximityIntersection name="Proximity" alarmDistance="0.8" contactDistance="0.5" /> <RequiredPlugin pluginName="MyPlugin"/> <CollisionGroup /> <Node name ="Attach"> <EulerImplicit name="cg_odesolverAC" printLog="false" rayleighStiffness="0.1" rayleighMass="0.1" /> <CGLinearSolver iterations="25" name="linear solverAC" tolerance="1.0e-9" threshold="1.0e-9" /> <Node name="Liver"> <EulerImplicit name="cg_odesolver" printLog="false" rayleighStiffness="0.1" rayleighMass="0.1" /> <CGLinearSolver iterations="25" name="linear solver" tolerance="1.0e-9" threshold="1.0e-9" /> <MeshGmshLoader name="loader" filename="./myMesh/liver_only.msh" /> <MechanicalObject src="@loader" name="Volume" scale3d="60 60 60" rotation="140 180 0" translation ="15 100 85"/> <TetrahedronSetTopologyContainer name="Container" position="@Volume.position" src="@loader" tags=" "/> <TetrahedronSetTopologyModifier name="Modifier" /> <TetrahedronSetTopologyAlgorithms name="TopoAlgo" template="Vec3d" /> <TetrahedronSetGeometryAlgorithms name="GeomAlgo" template="Vec3d" showPointIndices="1"/> <DiagonalMass massDensity="1.0" /> <BoxROI template="Vec3d" box="25 98 70 30 100 80" drawBoxes="1" position="@Volume.rest_position" name="FixedROI" /> <FixedConstraint indices="@FixedROI.indices" /> <FastTetrahedralCorotationalForceField name="FEM" youngModulus="13000" poissonRatio="0.3" method="large" /> <Node name="T"> <TriangleSetTopologyContainer name="Container" fileTopology="" tags=" " /> <TriangleSetTopologyModifier name="Modifier" /> <TriangleSetTopologyAlgorithms name="TopoAlgo" template="Vec3d" /> <TriangleSetGeometryAlgorithms name="GeomAlgo" template="Vec3d" /> <Tetra2TriangleTopologicalMapping input="@../Container" output="@Container" /> <TriangularBendingSprings name="FEM-Bend" stiffness="60000" damping="1.0" /> <TriangleSet /> <Node name="VisuLiver"> <OglModel name="Visual" color="blue" /> <IdentityMapping input="@../../Volume" output="@Visual" /> </Node> </Node> </Node> <Node name="Gallbladder"> <EulerImplicit name="cg_odesolver" printLog="false" rayleighStiffness="0.1" rayleighMass="0.1" /> <CGLinearSolver iterations="25" name="linear solver" tolerance="1.0e-9" threshold="1.0e-9" /> <MeshGmshLoader name="loader" filename="./myMesh/gallbladder_only.msh" /> <MechanicalObject src="@loader" name="Volume" scale3d="20 20 20" rotation="140 180 0" translation ="22 106 86"/> <TetrahedronSetTopologyContainer name="Container" position="@Volume.position" src="@loader" tags=" "/> <TetrahedronSetTopologyModifier name="Modifier" /> <TetrahedronSetTopologyAlgorithms name="TopoAlgo" template="Vec3d" /> <TetrahedronSetGeometryAlgorithms name="GeomAlgo" template="Vec3d" showPointIndices="1"/> <DiagonalMass massDensity="1.0" /> <FastTetrahedralCorotationalForceField name="FEM" youngModulus="13000" poissonRatio="0.3" method="large" /> <Node name="T"> <TriangleSetTopologyContainer name="Container" fileTopology="" tags=" " /> <TriangleSetTopologyModifier name="Modifier" /> <TriangleSetTopologyAlgorithms name="TopoAlgo" template="Vec3d" /> <TriangleSetGeometryAlgorithms name="GeomAlgo" template="Vec3d" /> <Tetra2TriangleTopologicalMapping input="@../Container" output="@Container" /> <TriangularBendingSprings name="FEM-Bend" stiffness="60000" damping="1.0" /> <TriangleSet /> <Node name="VisuGallbladder"> <OglModel name="Visual" color="blue" /> <IdentityMapping input="@../../Volume" output="@Visual" /> </Node> </Node> </Node> <Node name="Fat"> <EulerImplicit name="cg_odesolver" printLog="false" rayleighStiffness="0.1" rayleighMass="0.1" /> <CGLinearSolver iterations="25" name="linear solver" tolerance="1.0e-9" threshold="1.0e-9" /> <MeshGmshLoader name="loader" filename="./myMesh/fat_only.msh" /> <MechanicalObject src="@loader" name="Volume" scale3d="2.85 2.85 2.85" rotation="140 180 0" translation ="15 101 85"/> <TetrahedronSetTopologyContainer name="Container" position="@Volume.position" src="@loader" tags=" "/> <TetrahedronSetTopologyModifier name="Modifier" /> <TetrahedronSetTopologyAlgorithms name="TopoAlgo" template="Vec3d" /> <TetrahedronSetGeometryAlgorithms name="GeomAlgo" template="Vec3d" showPointIndices="1"/> <DiagonalMass massDensity="1.0" /> <FastTetrahedralCorotationalForceField name="FEM" youngModulus="13000" poissonRatio="0.3" method="large" /> <Node name="T"> <TriangleSetTopologyContainer name="Container" fileTopology="" tags=" " /> <TriangleSetTopologyModifier name="Modifier" /> <TriangleSetTopologyAlgorithms name="TopoAlgo" template="Vec3d" /> <TriangleSetGeometryAlgorithms name="GeomAlgo" template="Vec3d" /> <Tetra2TriangleTopologicalMapping input="@../Container" output="@Container" /> <TriangularBendingSprings name="FEM-Bend" stiffness="60000" damping="1.0" /> <TriangleSet /> <Node name="VisuFat"> <OglModel name="Visual" color="blue" /> <IdentityMapping input="@../../Volume" output="@Visual" /> </Node> </Node> </Node> <NearestPointROI template="Vec3" name="np1" object1="@./Liver/Volume" object2="@./Fat/Volume" radius="0.5"/> <NearestPointROI template="Vec3" name="np2" object1="@./Fat/Volume" object2="@./Gallbladder/Volume" radius="0.5"/> <TemplateAttachConstraint object1="@Liver" object2="@Fat" name ="AC1" indices1="@np1.indices1" indices2="@np1.indices2" /> <TemplateAttachConstraint object1="@Fat" object2="@Gallbladder" name="AC2" indices1="@np2.indices1" indices2="@np2.indices2"/> </Node> </Node>
The link to the mesh files.Meshes
As you can see, there is templateAttachConstraint used from Myplugin as you suggested earlier. Right now TemplateAttachConstraint is just a child of AttachConstraint,i.e,
it just inherits from attach constraint and I have not implemented any new data attribute or functions.Now I want to add in the TemplateAttachConstraint so that when I interact with the fatty tissue(burn or cut the tissue), the attach constraint are removed procedurally, not all constraints at once but at the point of interaction or contact. How would I approach to do so?
You had also suggested to me to make a new Spring force field component between the organs to attach them and change their stiffness based on their elongation to remove the spring connection. I want to try that approach too but I am not able to compute the indices in the meshes to be end points of the spring. If you can help me to find how do i choose the indices in the meshes that would be really helpful too.
Thank you for your assistance again. Please Help.
amitBlockedHey @Hugo,
Thank you very much for your help. I was able to build the templateattachconstraint plugin.
Is removing the indices best way to remove an attach constraint at point of contact? I want to create an interaction where based on the contact of the instrument with the attached object, the constraints are removed at the point of contact and the attached objects are gradually separated. Is there any other(hopefully better) way to do this? Will you please give me some guidance regarding this?
Thank you again,
amitamitBlockedHey
Thank you for your help.
However when I try to build sofa using this, I get error “Cannot open include file sofa/component/projectiveconstraintset/AttachConstraint.h”:No such file or directory.
I am trying to build using windows 10 and visual studio 2017.My cmakelists.txt file:
cmake_minimum_required(VERSION 3.1) project(MyPlugin) find_package(SofaFramework REQUIRED) find_package(SofaGeneral REQUIRED) find_package(SofaCommon REQUIRED) set(HEADER_FILES TemplateAttachConstraint.h TemplateAttachConstraint.inl config.h ) set(SOURCE_FILES TemplateAttachConstraint.cpp initPlugin.cpp ) add_library(${PROJECT_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES}) target_link_libraries(${PROJECT_NAME} SofaCore SofaGeneralObjectInteraction) include_directories("${CMAKE_CURRENT_SOURCE_DIR}/..") install(TARGETS ${PROJECT_NAME} COMPONENT MyPlugin_libraries EXPORT MyPluginTargets RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
amitBlockedHi Hugo,
Thank you for the answer.Is there any example of creating component inheriting from other components in SOFA? I am having tough time figuring a way to create custom component and use them in SOFA scene.
Any help would be highly appreciated.
amitBlockedHi Hugo,
Thank you for the suggestion.As you suggested, first we were trying to create spring force field between two objects then create the component if it functions well.We were looking at the StiffSpringField.scn and the indices to spring parameter are given manually in the scene. Is there any way I can use NearestPointROI to get the indices between the two mesh and give that to the spring data? Or is providing the spring indices manually the only way?
Also, We are doing this in order to model connective tissue between the liver and gallbladder. So we would have to visualize the connective tissue too after setting up the springforcefield so we could break/burn it. Any suggestions on how we do so?
Thank you again. Looking forward for your guidance.
amitBlockedHi,
We are trying to something similar. In our case, We need two objects, liver and gallbladder, attached to each other and we need to stretch the gallbladder and it breaks of the liver. We were going through the python scripting tutorial and pdf file provided in the tutorial page but still confused on how we can do this?
Any help will be highly appreciated.
Thank you
amit -
AuthorPosts