Home › Forum › SOFA › Programming with SOFA › C++ sample code for creating a scene V21.06.02
Tagged: Linux_ubuntu, Programming with SOFA, SOFA_2106
- This topic has 3 replies, 2 voices, and was last updated 2 years, 11 months ago by Hugo.
-
AuthorPosts
-
6 December 2021 at 15:59 #21060EricBlocked
Hi all,
I am currently working on writing up a C++ script to create a surgical cutting scene in which a gripper is trying to hold a piece of nerve lying on a tissue surface and a scalpel is trying to cut the nerve.
To start with, I am working on creating scene including all those components and apply their corresponding constraints. I’ve checked the creating c++ scene page on the website (https://www.sofa-framework.org/community/doc/programming-with-sofa/create-your-scene-in-cpp/) and application/tutorials folder for inspiration. However, it seems that the tutorial code on the website page is bit outdated as SimulationTree seems no longer to be used. I’d like to ask if there are more c++ sample codes for reference? For now, I am trying to apply an attach constraint between nerve object and tissue object, but I’ve had a hard time wading through the API documentation. I’d really appreciate it if you could provide me with some advice.
Cheers
6 December 2021 at 16:15 #21061HugoKeymasterDear @ericcui
Welcome on the SOFA forum!
In fact, c++ writing of a scene is less and less used among the community. People rather go for python scripting. Is there a reason why to choose c++ on your end?Cutting is quite a piece of work. Only few examples are available in SOFA such as the TopologyModifiers in the examples. Anyway, we would be glad to assist.
Best wishes,
Hugo
6 December 2021 at 17:20 #21066EricBlockedHi Hugo,
Thanks for your reply and your support.
1. For one, I fail to find a well documented SOFA python API page for reference. If any, could you help point it out?
2. I was given a SOFA C++ library for tissue cutting which was written by a previous researcher in 2014. However, the code was written in a pretty hacky and horrendous manner; moreover, most of the classes used in the code are deprecated now. Therefore, I have to manually upgrade them all.I’d appreciate your opinion on the potential efforts to develop a tissue cutting simulation using python compared to C++ given the current available reference resources.
Cheers
10 December 2021 at 22:08 #21119HugoKeymasterDear @ericcui
I know how difficult it can be to revive someone else’s code.
But cutting is not an easy topic.
Moreover, the SOFA API evolved recently on this topic, but examples on cut made with haptic devices are still missing.If the code is too hacky, then maybe it would be safer to restart from fresh. But you are the one to have the decision.
You can take a look at the component TopologicalChangeProcessor which is allowing to process known-in-advance topological changes.Keep us closely updated, this is a topic of interest.
Best wishes,Hugo
-
AuthorPosts
- You must be logged in to reply to this topic.