- This topic has 8 replies, 2 voices, and was last updated 4 years, 2 months ago by .
Viewing 9 posts - 1 through 9 (of 9 total)
Viewing 9 posts - 1 through 9 (of 9 total)
- You must be logged in to reply to this topic.
Home › Forum › SOFA › Using SOFA › [SOLVED] file name in GmshLoader as a variable
Tagged: 64_bits, Linux_ubuntu, SOFA_1806
Hi,
How can I consider the file name in GmshLoader as a variable in python scripting, so it can change during run time?
Best,
Zahra
Hey @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
Hi 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,
Zahra
Hi @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.
Hugo
Dear 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).
Which version of SOFA are you using?
It 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?
As 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
Dear 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
WARNING
The forum has been moved to GitHub Discussions.
Old topics and replies are kept here as an archive.