5 May 2021 at 10 h 00 min #19358SerkanErgunAAUParticipant
- University of Klagenfurt
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:
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.
Serkan7 May 2021 at 23 h 27 min #19408HugoKeymaster
- SOFA Consortium
Since 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 :
Hugo10 May 2021 at 12 h 32 min #19421
- You must be logged in to reply to this topic.