Home › Forum › SOFA › Using SOFA › file name in GmshLoader as a variable
Tagged: 64_bits, Linux_ubuntu, SOFA_1806
- This topic has 8 replies, 2 voices, and was last updated 6 months, 1 week ago by
Zahra.
-
AuthorPosts
-
9 October 2020 at 19 h 14 min #17338
Hi,
How can I consider the file name in GmshLoader as a variable in python scripting, so it can change during run time?
Best,
Zahra10 October 2020 at 0 h 22 min #17347Hey @zahra !
First of all, for a proper update of the GmshLoader, you might have to use the master branch of SOFA. Current work are ongoing on building a robust architecture for component updates. (If you want to know more, do not hesitate to join the SOFA Symposium and Technical Committee !)
Anyway, in python, you would just need to access and replace the Data field
filename
in your python function.myLoaderPtr.filename="my_new_filename"
If you share with us a simplified version of your scene I could give you a more relevant example. Best,
Hugo
10 October 2020 at 20 h 00 min #17353Hi Hugo,
Thank you for reminding, I registered for the event.
Regarding the question, I tried a similar approach that you suggested, but it doesn’t work. Please find the codes and gmsh files in the link below:
https://gist.github.com/zbounik/3ac0ad45dd48bce88a1b45210e7eef28
I uploaded three gmsh files, but in my work I need to load a large number of gmsh files during the animation.
Best,
Zahra11 October 2020 at 21 h 47 min #17363Hi @zahra
I think you will never succeed to get a different filename (here filename being a string variable) by writing this:
self.Cylinder.getObject('loader').findData('filename').value='filename'
But rather:
self.Cylinder.getObject('loader').findData('filename').value=filename
Let us know if it helps.
Hugo11 October 2020 at 22 h 56 min #17368Dear Hugo,
Thank you for your reply. I tried your suggestion at first and it didn’t work (In struggling to find a solution, I wrote it as a string and forgot to correct it before uploading).
11 October 2020 at 23 h 13 min #17369Which version of SOFA are you using?
12 October 2020 at 21 h 12 min #17388It is currently 17.06 stable version (I tried it using 18.06 and it didn’t work either). Is it working on the newest versions?
12 October 2020 at 21 h 21 min #17389As I said in my previous message, you might have to go for the master branch or wait for the v20.12 (not so far away !). The automatic reload of a mesh when changing the filename has been introduced in #1408. Until this PR, MeshLoader was a passive class in the scene.
I hope this helps.
Hugo
12 October 2020 at 22 h 01 min #17390Dear Hugo,
Thank you for the explanation on “MeshLoader being a passive class in the scene”. I now understand the necessity of using the master branch to solve this issue.
Best,
Zahra -
AuthorPosts
- You must be logged in to reply to this topic.