Home › Forum › SOFA › Programming with SOFA › [SOLVED] How to write a scene file
Tagged: 64_bits, Geomagic touch, Plugin_Geomagic, SOFA_2006, Windows_10
- This topic has 14 replies, 3 voices, and was last updated 3 years, 11 months ago by Hugo.
-
AuthorPosts
-
9 October 2020 at 08:18 #17334pontasBlocked
Hello everyone.
I want to write code to move an object using only a scene file, but I’m having trouble understanding how to do it.
I want to make the object rotate at 20 degrees per second while the Geomagic touch button is held down, and return to the initial position when the button is released.
I’m currently using pybind to do this, but I’m wondering if it’s possible to do this without going through python and just in the scene file.I read the XML file(examples/Tutorials/StepByStep) and scene files, but I couldn’t know the way to write it.
Is it possible to write that much movement with just a scene file…?
I’m a beginner, so I don’t understand a lot of things, but I’d appreciate it if you could help me out.
Thank you very much.
10 October 2020 at 00:15 #17346HugoKeymasterHi @mckysd5 and welcome !
As is, using XML scripting this would not be feasible (static scene description). Python is the easiest way to go. An alternative if you need one would be to implement a C++ component (derivated from a TransformEngine) which would have a Data connected to the Geomagic button, which would apply a rotation if pressed and cancel it when released.
I hope this helps.
Best wishes,
Hugo
10 October 2020 at 06:46 #17349pontasBlockedHi @Hugo
Thank you for your reply.
It says on the site that I can write scene files in C++/python, but am I correct in understanding that I can write scene files in C++/python to represent things like object rotation using Geomagic…?
I’m sorry for the repeated questions, but
I’d appreciate it if you could help me out.Thank you for your cooperation.
pontas
10 October 2020 at 16:35 #17352HugoKeymasterHi @mckysd5
To improve my answer could you tell me which part of my reply was unclear to you?
Best
Hugo
11 October 2020 at 06:50 #17358pontasBlockedHi @Hugo
Thank you for your reply.
I’m sorry for my bad questioning …
If I write a scene file in C++, can I write code that uses Geomagic to rotate an object…?Sorry to trouble you, but I’d appreciate it if you could help me out.
Thank you very much.
pontas
11 October 2020 at 21:51 #17364HugoKeymaster12 October 2020 at 05:49 #17370pontasBlockedHi @Hugo
Thank you for your reply.Thank you!
I’ll see.I’ve never written a scene file in C++ before…
Can I learn how to write it by looking at the tutorials (examples/Tutorials) like the site says?Thank you very much.
pontas
19 October 2020 at 22:59 #17422HugoKeymasterYes and you can also take a look at the doc page : Create your scene in C++
I let you close the topic if you’re fine with this. Keep us posted about your progresses.
Best,
Hugo
20 October 2020 at 05:58 #17425pontasBlockedHi @Hugo
Thank you very much!
I could understand how to write it.But I can’t compile it…(Including the tutorial C++ file)
How do everyone compile their own C++ files?Do I have to rewrite Main.cpp of runSofa?
When this problem is solved, I’ll close this topic.
Thank you very much.
pontas
20 October 2020 at 09:16 #17427HugoKeymasterHi @mckysd5
Just a curious question why do you need to have a scene in C++?
If you need this, then you will have to build your scene (adding components etc) and init, and run yourself the simulation as it is done in the Main.cpp of runSofa.
Best
Hugo
24 October 2020 at 08:11 #17442pontasBlockedHi @Hugo
Sorry for the late reply.
I would like to simulate what I described in the first question.
Since Pybind is so slow, I decided to write the scene file in C++ only.I tried to run the tutorial (applications/tutorials), but I get the following error with CMake’s find_package.
By not providing “FindSofaFramework.cmake” in CMAKE_MODULE_PATH this
The project has asked CMake to find a package configuration file provided by
“SofaFramework”, but CMake did not find one.Could not find a package configuration file provided by “SofaFramework”.
with any of the following names:SofaFrameworkConfig.cmake
sofaframework-config.cmakeAdd the installation prefix of “SofaFramework” to CMAKE_PREFIX_PATH or set
“SofaFramework_DIR” to a directory containing one of the above files.
“SofaFramework” provides a separate development package or SDK, be sure it
It has been installed.I specified the path to the original CMakeLists.txt file with set(), but it doesn’t work. What should I do…?
Thank you very much.
pontas
30 October 2020 at 23:20 #17505HugoKeymasterHi @mckysd5
The error
By not providing “FindSofaFramework.cmake” in CMAKE_MODULE_PATH
shows that you did not specify a CMake entry providing the path to SOFA, despite your are relying on SOFA (find_package).Best wishes,
Hugo
4 November 2020 at 09:43 #17545pontasBlockedHi @Hugo
I was able to solve this problem by specifying a path.
Thank you very much!I want to debug the sln file, but now I get a lot of errors in it.
Isn’t it correct that the way to run the cpp file(ex chainHybrid.cpp, oneTetrahedron.cpp) is to debug the sln file that was created by executing cmake…?Thank you very much.
pontas
18 November 2020 at 02:46 #17710RoqueBlockedHi everyone Im new to the Sofa world and just recently downloaded SOFA v20.06 using Binary along with python 2.7.10 and numpy using windows 10. I followed the tutorial from first steps on youtube but when I run sofa and create a new scene it comes out as a .scn rather than .pyscn as shown on the video. How can I make the interface come out as a .pyscn as shown on the video? My second question is that when I right click on Default Visual Manager Loop and go to open file in editor nothing comes out how can I get the editor to come out? My third question is why is it that when I copy the link from first step tutorial into doc browser the tutorial doesn’t come up? Any help would be very much appreciated as I am still learning how to use this Software. Thank You
4 December 2020 at 23:01 #17938HugoKeymasterI close this topic since I replied to you @rmartinez in the other thread, while @mckysd5 ‘s question is solved.
Hugo
-
AuthorPosts
- You must be logged in to reply to this topic.