Forum Replies Created
-
AuthorPosts
-
Alex BilgerBlocked
Yes, I understand your scene. But, I propose to modify your pipeline in order to avoid the need to merge duplicated vertices. My idea is to merge your input meshes (and not your grids), and then computing one unique grid on the result. It’s just inverting your steps. Here is an example:
<MeshObjLoader name="upLoader" filename="up.obj"/> <MeshObjLoader name="downLoader" filename="down.obj"/> <Node name="merge"> <MergeMeshes position1="@../upLoader.position" position2="@../downLoader.position" quads1="@../upLoader.quads" quads2="@../downLoader.quads" name="merge"/> <!-- <OglModel position="@merge.position" quads="@merge.quads"/> --> <Node name="topology"> <SparseGridTopology drawHexahedra="true" n="10 10 10" vertices="@../merge.position" input_quads="@merge.quads" name="grid"/> <VTKExporter filename="hexa.vtu" hexas="true" position="@grid.position" exportAtBegin="true" overwrite="true"/> </Node> </Node>
Seems to work. This method requires that you want the same hexa size in the whole mesh. In the method you presented, you can define multiple hexa size depending on your initial mesh, but it will be complicated to merge them even if you have a boolean to remove duplicated vertices due to topology problems.
If you really want to remove duplicates, you would need to add a distance parameter to define what duplicated vertices are.
Let me know if I understood correctly
Alex BilgerBlockedHi,
have you tried to merge your input meshes in the first place, and then apply a regular grid on the result?If you would like to detect duplicated vertices, I wouldn’t do it directly in MergeMeshes but rather in another component, so that it can be used without the will to merge meshes.
Alex
5 January 2017 at 18:04 in reply to: [SOLVED] Queries about tetrahedralization with the CGAL Plugin. #8286Alex BilgerBlockedI don’t know how to do that, but if you manage to do this, a description of the method could be very helpful for everyone.
If you look at the code of ImageContainer, you can see the file extensions supported by Sofa: https://github.com/sofa-framework/sofa/blob/master/applications/plugins/image/ImageContainer.h
According to the documentation, Slicer can deal with these formats: https://www.slicer.org/wiki/Documentation/4.0/SlicerApplication/SupportedDataFormat
Try to find a common format (mhd for example).
Good luck5 January 2017 at 14:57 in reply to: [SOLVED] Queries about tetrahedralization with the CGAL Plugin. #8283Alex BilgerBlockedIf I remember correctly, CGAL can load only .inr image files. But you can link the CGAL component with an ImageContainer from the image plugin (like in https://github.com/sofa-framework/sofa/blob/master/applications/plugins/CGALPlugin/scenes/MeshGenerationFromImage.scn). It uses the cimg library http://cimg.eu/. Check the supported files and convert your image with another program.
3 January 2017 at 09:01 in reply to: [SOLVED] Queries about tetrahedralization with the CGAL Plugin. #8256Alex BilgerBlockedHello Yash,
CGAL is also able to convert a 3d image into a tetrahedral mesh (see http://doc.cgal.org/latest/Mesh_3/index.html#title23). There is a SOFA component for that in the CGALPlugin. It’s called MeshGenerationFromImage. You will need to use the image plugin as well. You would have to convert your input DICOM image first with an image processing program.
The input image must be segmented. You can set labels to subdomains and mesh them with different parameters.
If you want to visualize VTU files, I would advise Paraview. It is also possible with Sofa with a scene. In your scene, the trick is to use the visualization tool of the FEM force field, but it means you need to setup a scene with mechanical stuff whereas you only want visualization. I didn’t try your scene but I think it will work by removing the Mesh component. Also check the number of tets in the MeshVTKLoader component in case you have a problem with your mesh.Hope it helped
Alex BilgerBlockedThanks, I’ll open a pull request next time.
Alex BilgerBlockedA temporary solution is to break the topology so that each vertex is used once and only once by a triangle. The problem is we end up with duplicated vertices and Phong shading does not work (each triangle is independent and does not share anything with another triangle).
Alex BilgerBlockedHi,
with the CMake option SOFA_NO_OPENGL, your error is not supposed to happen. I cannot check it, but probably someone forgot to use this flag in this plugin. If it’s the case, you can solve it yourself by putting some #ifndef SOFA_NO_OPENGL in the code making references to OglModel, or wait for someone to fix it.Alex
Alex BilgerBlockedHello,
do you want the camera to be fixed to the tool? Or are the camera and the tool unrelated?In every sofa scene, there is an InteractiveCamera. It’s a component, which is automatically created but you can also create it manually in the xml file. You can set its position and its lookAt.
Hope it helped,
Alex
Alex BilgerBlockedI assume the documentation you’re talking about is https://www.sofa-framework.org/community/doc/getting-started/build/linux/.
Could you tell us if you have compiled the project (the make command, section “Compile in the terminal”)? Has it complain about something or was it a success? Is there actually a file runsofa in your bin directory?Alex BilgerBlockedHi,
Cmake cannot generate binaries on it own. It generates a project that you must compile after. Have you done this step? If not, it’s normal bin folder is empty.
If the file runsofa has been copied in your folder, it’s impossible that the terminal cannot find it. Can you execute it from the file explorer (double click on the icon)? Are you sure you are in the right folder in the terminal (command cd)?
When you ask for help, please give a maximum of details, such as your operating system, and more importantly the exact steps you’ve done.
Hope this helps
Alex
Alex BilgerBlockedHi Michel,
the best I can do is to give you this link: http://docs.unity3d.com/Manual/Plugins.html. I’ve never done that, but I admit this combination would be very useful! Let us know your progress or your questions.
Good luckAlex
Alex BilgerBlockedThis is what I propose and it seems to work for me. Maybe this fix does not work in the context of the commit you mentioned, I don’t know. If we keep this code, then maybe the condition to process the object is not right?
I also would like to highlight a problem with xml export: when exporting, we loop over the objects and write all the data in this object. This is not correct as some component compute things differently if some data are provided or not. This means the initialization is not the same with the exported scene than in the initial one. I don’t have a fix for that. Maybe by writing only the provided data? But that would mean to write file names instead of the position/faces in the case of a MeshLoader for instance.
Alex
Alex BilgerBlockedI understand your goal. Do you think you can do it with a SparseGridTopology. I saw that it internally creates a RegularGrid adapted to your object. Maybe you can use it.
I guess all the bounding box calculations are always done internally. I agree a simple component providing the bounding box of an object would be useful. Maybe it exists but I’m not aware of any.
For your project, have you had a look on the plugin image? Maybe there is all you need.
Alex BilgerBlockedI don’t know if there is such a component, but you may want to use SparseGridTopology instead of RegularGrid. The former is made to contain a mesh, but it creates only cells inside and on the boundary of the mesh.
If you really want to use RegularGrid and you know C++, it should be really simple to create one engine that computes the bounding box that you can provide to the regular grid.Hope this helps,
Alex
Alex BilgerBlockedWe finally found that it does not crash only if the preprocessor variable SOFA_USE_MASK is defined. It’s the case by default in the Sofa projects, but not if we create an independent project from scratch. I recommend to change this behavior or to notice it in a documentation.
Thanks a lot if you started working on this problem
Alex BilgerBlockedHi guys, I also got this error recently. I “installed” boost and set the CMake variables BOOST_LIBRARYDIR and BOOST_ROOT. This should work.
@Hugo: I don’t remember if I activated a plugin or not. But if I did activated one, it was “image”.Alex BilgerBlockedThanks for the info. I once had a huge memory leak, but I didn’t suspect OglLabel. So you’re probably right. Let’s hope it’s gonna fixed soon. If you have a fix, you can send a patch to a Sofa developer.
Alex
Alex BilgerBlocked1 -> RestShapeSpringsForceField is in the core. No need to activate something. Search it in the Modeler and check that it is found. It means it’s compiled and you can use it.
2 -> But you can do this with RestShapeSpringsForceField.Alex BilgerBlocked1 -> use RestShapeSpringForceField instead. I think you can set indices and positions
2 -> I didn’t understand the difference with the SHIFT+CLICK behaviour. If you want to have similar behaviour but slightly different, I think you have no choice but coding a component to do it…30 November 2015 at 14:42 in reply to: [SOLVED] Making controlled deformations without Phantom #4493Alex BilgerBlocked1 -> many possibilities here. Depending on your context, you can add a strong spring, differentiate rest position and initial position or make a script in SofaPython.
2 -> Do you mean in the C++ code? I don’t know where it is, but if this question is related to the first one, I don’t recommend to use this command just for lifting up a specific point. It just adds a spring between a point and the 3D position of your mouse and you can do this with a component instead of modifying C++ code.
3 November 2015 at 09:55 in reply to: [SOLVED] Internal nodes’ displacements from surface displacement #3914Alex BilgerBlockedIt looks like you want to apply a boundary condition on the surface, rather than differentiating rest and initial position. If you need to use the resulting geometry, you can save it and use it in another simulation.
One quick trick to test your simulation is to apply strong springs between the surface points in the rest and in the initial configuration. Set the initial position equal to the rest position and use a RestShapeSpringForceField to create the springs which will move the surface points towards the position you want. You can also do that with constraints but the springs are a lot easier to use for testing.Hope this helps
Alex BilgerBlockedSurfacePressureForceField computes the force at each node like that:
for every triangle:
Deriv p = (ab.cross(ac)) * (pressure / static_cast<Real>(6.0));
f[t[0]] += p;
f[t[1]] += p;
f[t[2]] += p;ab and ac are two edges of the triangle and (ab.cross(ac)) gives the normal. The force is therefore computed along the normal. With a constant pressure.
…and it’s similar for quads.Isn’t it what you want? I’m sorry, I didn’t understand the sentence in your last comment where you explain what you want.
PS: I did not test the example scene I mentionned. It was just the only example with this force field. Maybe it’s not an appropriate example to show the basic features of this component.
Alex BilgerBlockedHello João,
actually I don’t use the Modeler for creating the scene files.
Scene files are just xml files so you can edit them with a text editor.If you just want to test SOFA, I suggest you run the main application runSofa (should be in the folder ./bin). From here, a default scene is launched. Once you have played with it, you can open other scene files from the menu. There are examples in the folder ./examples.
If you want to create your own scene, you can write it in a text editor and test it by opening the file with runSofa.
I agree that if you have seen this feature in the youtube video, you should be able to to create a scene with the Modeler. But the video has been posted in 2010, and I assume this feature is probably not maintained anymore. Waiting that the SOFA developers fix this problem, you will go faster by editing directly the xml file.
Hope this helps,
Alex
Alex BilgerBlockedHello,
I guess you can use one Phantom for an instrument and the mouse/keyboard for the other, but that will be difficult to control for the user.
You can also save the movement of one instrument as an animation and play it automatically in your simulation, but you will always get the same movement.Hope this helps,
-
AuthorPosts