Forum Replies Created
-
AuthorPosts
-
ThresholdddBlocked
@Hugo and @guillaumeparan,
Sorry for the late reply and thank you for your help! Good news is it works! I found that windows found the wrong directory for Qt5Core, which cause GUI failed to be imported. And now it works!!! Thank you very much for your help!ThresholdddBlockedHi, @Hugo,
Unfortunately, I did not solve the problem. I actually don’t understand what you mean PYTHONPACKAGE. Is PYTHONPACKAGE a system environmental variable or you mean python package related variable like PYTHON_ROOT or PYTHONPATH. Anyway, I did try to create variable called PYTHONPACKAGE linking to SofaPython3 site-packages and python site-packages. But it does not work.I want to share the variables I set to make sure if there is some problems.
PYTHON_ROOT: C:\Users\user\AppData\Local\Programs\Python\Python37 PYTHONPATH: C:\SOFA\SOFA_v21.06.01_Win64\plugins\SofaPython3\lib\python3\site-packages SOFA_ROOT: C:\SOFA\SOFA_v21.06.01_Win64 Path: %PYTHON_ROOT%;%PYTHON_ROOT%\DLLs;%PYTHON_ROOT%\Lib;%SOFA_ROOT%\bin;%SOFA_ROOT%;C:\Users\user\AppData\Local\Programs\Python\Python37\Scripts
With above settings, I can successfully run runSofa with Sofapython3 in cmd which means sofa_root\bin is successfully set.
C:\Users\user>runSofa [INFO] [runSofa] PluginRepository paths = C:/SOFA/SOFA_v21.06.01_Win64/bin;C:/SOFA/SOFA_v21.06.01_Win64/plugins;C:/SOFA/SOFA_v21.06.01_Win64/bin [INFO] [runSofa] DataRepository paths = C:/SOFA/SOFA_v21.06.01_Win64/share/sofa;C:/SOFA/SOFA_v21.06.01_Win64/share/sofa/examples;C:/SOFA/SOFA_v21.06.01_Win64/share/sofa;C:/SOFA/SOFA_v21.06.01_Win64/share/sofa/examples [INFO] [runSofa] GuiDataRepository paths = C:/SOFA/SOFA_v21.06.01_Win64/share/sofa/gui/runSofa;C:/SOFA/SOFA_v21.06.01_Win64/share/sofa/gui/qt;C:/SOFA/SOFA_v21.06.01_Win64/share/sofa/gui/qt [INFO] [runSofa] Loading automatically plugin list in C:/SOFA/SOFA_v21.06.01_Win64/bin/plugin_list.conf [INFO] [SofaPython3] Initializing with python version 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)] [INFO] [SofaPython3] Registering a scene loader for [.py, .py3, .pyscn, .py3scn] files. [INFO] [SofaPython3] Intializing python [INFO] [PluginManager] Loaded plugin: C:/SOFA/SOFA_v21.06.01_Win64/bin/SofaPython3.dll [INFO] [SofaPython3] Added 'C:/SOFA/SOFA_v21.06.01_Win64/plugins/SofaPython3/lib/python3/site-packages' to sys.path
I also try import other module in C:\SOFA\SOFA_v21.06.01_Win64\plugins\SofaPython3\lib\python3\site-packages, they all can be imported successfully except Sofa.Gui.
C:\Users\user>python Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import Sofa >>> import SofaRuntime >>> import SofaTypes >>> import splib >>> import Sofa.Components >>> import Sofa.Core >>> import Sofa.Helper >>> import Sofa.Simulation >>> import Sofa.SofaDeformable >>> import Sofa.SofaGL >>> import Sofa.Types >>> import Sofa.Gui [ERROR] [SofaRuntime] ImportError: DLL load failed: The specified procedure could not be found. Traceback (most recent call last): File "<stdin>", line 1, in <module> >>>
Do you have any suggestions?
Thank you very very much for your help!!!Best wishes,
YUANThresholdddBlockedHi, @Hugo,
I met the same problem using v21.06.01, but getObject() function still not work. I met the error
def createScene(root): model = root.addChild("model") model.addObject("RegularGridTopology", name = "grid",min = "-5 -5 0", max = "5 5 40", n = "3 3 10") print(LRmodel.getObject("grid"))
I run in python, error
[ERROR] [SofaRuntime] AttributeError: Missing attribute: getObject
in runSofa
[ERROR] [SofaPython3::SceneLoader] AttributeError: Missing attribute: getObject
ThresholdddBlockedOh, the image link broke, the path included site-packages in SofaPython3 and other DLLs or Lib of python. I can import Sofa.Simulation and other components in this package except Gui and I can use runSofa, too.
by the way how to actually put an image, I actually put the image in my goole drive and share the link in this post, but it breaks
19 October 2021 at 05:35 in reply to: [SOLVED] Export Object velocity and position values in each time step #20654ThresholdddBlockedHi, @Hugo,
Thank you for your example! I will try it and mark this problem as solved! Thank you very much again!
Best wishes,
YUAN13 October 2021 at 14:41 in reply to: [SOLVED] Export Object velocity and position values in each time step #20603ThresholdddBlockedHi, @Hugo,
Thanks you for your advice, I read the examples about writing data and successfully record states by using monitor or VtkExamples, but I have one question left that I do not know how to access data field in python. I did not find related examples in sofaPython3 and sofa. Thanks very much for your help!Yuan
-
AuthorPosts