Home › Forum › SofaPython3 › Using SofaPython3 › [SOLVED] Issues with PythonScriptController
Tagged: binaries, PythonScriptController, SOFA_2012, SofaPython3, v20.12.02, Windows_10, Windows10
- This topic has 2 replies, 2 voices, and was last updated 3 years, 7 months ago by SerkanErgunAAU.
-
AuthorPosts
-
5 May 2021 at 10:00 #19358SerkanErgunAAUBlocked
Hi again,
I am using SOFA v20.12.02 with binaris (the “zip” version)
At the moment trying to set up an scene using SofaPython3, where I want to assign rotations to an object similar to this example:
Sofa-Framework PythonScriptController Example
For the sake of keeping things simple I am testing the code shown by @Hugo in the last post of the conversation.
When loading the file with my SOFA version using SofaPython3, I get the following error:
[ERROR] [SofaPython3::SceneLoader] ValueError: Object type PythonScriptController<> was not created The object is not in the factory. At: robot.py3scn(182): createScene
Theoretically, when putting everything in a single *.py3scn file it should work, right?
Consider the following very simple example
import Sofa import os, sys import math def createScene(rootNode): rootNode.gravity=[0,-9810,0] rootNode.dt=0.001; ### Create a grid rootNode.addObject("OglGrid", nbSubdiv=50, size=1500) ### some other irrelevant code.. return rootNode def onBeginAnimationStep(self,dt): print("Hello world")
`onBeginAnimationStep(self,dt):’ this part is never called
This is probably just a fault of syntax caused by my weak python programming knowledge.
I am very sorry to nag you again with my problems, but I hope for a simple remedy for this issue.
Kindest regards,
Serkan
7 May 2021 at 23:27 #19408HugoKeymasterSince January 2021, we moved to the SofaPython3 plugin which allow to use SOFA with python3 and from a python3.* environment.
Scenes are written in a slightly different way. You can find a list of examples in SofaPython3/examples/.
You can especially look at :
– basic.py
– basic-GUI.py
– example-scriptcontroller.pyBest
Hugo
10 May 2021 at 12:32 #19421SerkanErgunAAUBlocked -
AuthorPosts
- You must be logged in to reply to this topic.