Forum Replies Created
21 October 2021 at 16:23 in reply to: [SOLVED] Get the position value from a MechanicalObject point in Python #20679
I think I have figured it out:
with self.object.position.writeableArray() as wa: wa[0, 0] = 0.2
does what I want21 October 2021 at 16:23 in reply to: [SOLVED] Get the position value from a MechanicalObject point in Python #20680
It appears like I double posted my last answer. Sorry21 October 2021 at 11:48 in reply to: [SOLVED] Get the position value from a MechanicalObject point in Python #20677
I would like to change the vertex positions on the fly from Python.
However, when I run
self.object.findData('position').value = 0.2
ValueError: assignment destination is read-only. I can read the value without any issues.
Has the API been changed? What should I do instead?
I would like to do it directly from Python because I want to have more control. Thus, no PartialLinearMovementConstraint or similar.
Thank you for your help!
thank you for the suggestion. If I understand it correctly, the use of hexahedral meshes makes transformation back to voxels obsolete.
Could you please provide a code example. I tried to search for one but I couldn’t find it. I am particularly interested in how to load and export the mesh.
Somehow I made it work. I took the DiffusionSolverConfig.cmake from the binary installation of Sofa. I could load the example.
Thank you for your help!
Almost there 🙂
I disabled Upsampling and I could compile. But I forgot to include the PLUGIN_IMAGE. Now when I do it, I get
Adding plugin image CMake Error at SofaKernel/modules/Sofa.Config/cmake/SofaMacrosConfigure.cmake:343 (find_package): By not providing "FindDiffusionSolver.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "DiffusionSolver", but CMake did not find one. Could not find a package configuration file provided by "DiffusionSolver" with any of the following names: DiffusionSolverConfig.cmake diffusionsolver-config.cmake Add the installation prefix of "DiffusionSolver" to CMAKE_PREFIX_PATH or set "DiffusionSolver_DIR" to a directory containing one of the above files. If "DiffusionSolver" provides a separate development package or SDK, be sure it has been installed. Call Stack (most recent call first): applications/plugins/image/CMakeLists.txt:15 (sofa_find_package)
It doesn’t appear to be in the src directory.
I took your advice and installed CGAL-5.0.2.
However, I still have my last error from the post #20275.
Could you please tell me how to fix it.
git clone -b v21.06 https://github.com/sofa-framework/sofa.git sofa/src
What version should I be using instead. Please provide the right git clone command if not only the version is different. Thank you
so far I have figured it out. However, UpsamplePointCloud is more complicated. My C++ knowledge is rather limited 🙁
In file included from /Users/mikhail/sofa/src/applications/plugins/CGALPlugin/src/CGALPlugin/UpsamplePointCloud.cpp:25: In file included from /usr/local/include/CGAL/edge_aware_upsample_point_set.h:24: /usr/local/include/CGAL/compute_average_spacing.h:201:5: error: no matching constructor for initialization of 'Point_set_processing_3::internal::Callback_wrapper<Parallel_tag>' callback_wrapper (callback, nb_points); ^ ~~~~~~~~~~~~~~~~~~~
I took the suggestion of the compiler and replaced
I could compile CylinderMesh.
Now my error is in Refine2DMesh. Is there an universal fix?
/Users/mikhail/sofa/src/applications/plugins/CGALPlugin/src/CGALPlugin/Refine2DMesh.inl:387:51: error: no member named 'Vec3' in namespace 'sofa::defaulttype' sofa::type::vector<sofa::defaulttype::Vec3> points; ~~~~~~~~~~~~~~~~~~~^ /Users/mikhail/sofa/src/applications/plugins/CGALPlugin/src/CGALPlugin/Refine2DMesh.inl:402:51: error: no member named 'Vec3' in namespace 'sofa::defaulttype' sofa::type::vector<sofa::defaulttype::Vec3> points; ~~~~~~~~~~~~~~~~~~~^
Thank you. I made the change you have suggested (defaulttype -> type).
It appears that it has solved the issue with DecimateMesh but it is still there for other components. What should I do?
Users/mikhail/sofa/src/applications/plugins/CGALPlugin/src/CGALPlugin/CylinderMesh.inl:511:50: error: no member named 'types' in namespace 'sofa::helper'; did you mean 'type'? vparams->drawTool()->drawPoints(points,8,helper::types::RGBAColor(0.0, 0.0, 1.0,1)); ^~~~~~~~~~~~~ type /Users/mikhail/sofa/src/SofaKernel/modules/Sofa.Type/src/sofa/type/SVector.h:26:17: note: 'type' declared here namespace sofa::type ^ In file included from /Users/mikhail/sofa/src/applications/plugins/CGALPlugin/src/CGALPlugin/CylinderMesh.cpp:25: /Users/mikhail/sofa/src/applications/plugins/CGALPlugin/src/CGALPlugin/CylinderMesh.inl:518:50: error: no member named 'types' in namespace 'sofa::helper'; did you mean 'type'?