Title: VisualLoop expected at the root node · Issue #485 · sofa-framework/SofaPython3 · GitHub
Open Graph Title: VisualLoop expected at the root node · Issue #485 · sofa-framework/SofaPython3
X Title: VisualLoop expected at the root node · Issue #485 · sofa-framework/SofaPython3
Description: I tried using SofaPython by following the docs, but the code could not run well. In Sofa Gui there's nothing showed up and the error is: [ERROR] [Simulation] Simulation::initTextures() : VisualLoop expected at the root node Perhaps it's ...
Open Graph Description: I tried using SofaPython by following the docs, but the code could not run well. In Sofa Gui there's nothing showed up and the error is: [ERROR] [Simulation] Simulation::initTextures() : VisualLoop...
X Description: I tried using SofaPython by following the docs, but the code could not run well. In Sofa Gui there's nothing showed up and the error is: [ERROR] [Simulation] Simulation::initTextures() : Visual...
Opengraph URL: https://github.com/sofa-framework/SofaPython3/issues/485
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"VisualLoop expected at the root node","articleBody":"I tried using SofaPython by following the [docs](https://sofapython3.readthedocs.io/en/v24.12.00-doc-generation/content/FirstSteps.html), but the code could not run well. In Sofa Gui there's nothing showed up and the error is: \n\n\u003e [ERROR] [Simulation] Simulation::initTextures() : VisualLoop expected at the root node\n Perhaps it's related to the version of Sofa, my version is Sofa v24.12.00 and python 3.12.9. How to solve this problem? Appreciate your help!\nHere's my code:\n\n\n\n```\nimport Sofa\nimport Sofa.Gui\nimport SofaRuntime\nimport Sofa.Component\n\nSofaRuntime.importPlugin(\"Sofa.Component\")\nSofaRuntime.importPlugin(\"Sofa.Component.Collision.Detection.Algorithm\")\nimport Sofa.Core\n\ndef main():\n # Call the SOFA function to create the root node\n root = Sofa.Core.Node(\"root\")\n\n\n # Call the createScene function, as runSofa does\n createScene(root)\n\n # Once defined, initialization of the scene graph\n Sofa.Simulation.init(root)\n\n # Launch the GUI (qt or qglviewer)\n Sofa.Gui.GUIManager.Init(\"myscene\", \"qglviewer\")\n Sofa.Gui.GUIManager.createGUI(root, __file__)\n Sofa.Gui.GUIManager.SetDimension(1080, 800)\n\n\n\n # Initialization of the scene will be done here\n Sofa.Gui.GUIManager.MainLoop(root)\n\n\n\n Sofa.Gui.GUIManager.closeGUI()\n\n\ndef createScene(rootNode):\n plugins = [\n \"Sofa.Component.Collision.Detection.Algorithm\",\n \"Sofa.Component.Collision.Detection.Intersection\",\n ]\n for plugin in plugins:\n rootNode.addObject(\"RequiredPlugin\", pluginName=plugin, name=plugin)\n # Define the root node properties\n #rootNode.addObject('VisualLoop')\n rootNode.addObject(\"VisualGrid\", nbSubdiv=10, size=1000)\n\n rootNode.gravity=[0.0,-9.81,0.0]\n rootNode.dt=0.01\n\n # Loading all required SOFA modules\n confignode = rootNode.addChild(\"Config\")\n confignode.addObject('RequiredPlugin', name=\"Sofa.Component.AnimationLoop\", printLog=False)\n confignode.addObject('RequiredPlugin', name=\"Sofa.Component.Collision.Detection.Algorithm\", printLog=False)\n confignode.addObject('RequiredPlugin', name=\"Sofa.Component.Collision.Detection.Intersection\", printLog=False)\n confignode.addObject('RequiredPlugin', name=\"Sofa.Component.Collision.Geometry\", printLog=False)\n confignode.addObject('RequiredPlugin', name=\"Sofa.Component.Collision.Response.Contact\", printLog=False)\n confignode.addObject('RequiredPlugin', name=\"Sofa.Component.Constraint.Lagrangian.Correction\", printLog=False)\n confignode.addObject('RequiredPlugin', name=\"Sofa.Component.Constraint.Lagrangian.Solver\", printLog=False)\n confignode.addObject('RequiredPlugin', name=\"Sofa.Component.IO.Mesh\", printLog=False)\n confignode.addObject('RequiredPlugin', name=\"Sofa.Component.LinearSolver.Iterative\", printLog=False)\n confignode.addObject('RequiredPlugin', name=\"Sofa.Component.Mapping.NonLinear\", printLog=False)\n confignode.addObject('RequiredPlugin', name=\"Sofa.Component.Mass\", printLog=False)\n confignode.addObject('RequiredPlugin', name=\"Sofa.Component.ODESolver.Backward\", printLog=False)\n confignode.addObject('RequiredPlugin', name=\"Sofa.Component.StateContainer\", printLog=False)\n confignode.addObject('RequiredPlugin', name=\"Sofa.Component.Topology.Container.Constant\", printLog=False)\n confignode.addObject('RequiredPlugin', name=\"Sofa.Component.Visual\", printLog=False)\n confignode.addObject('RequiredPlugin', name=\"Sofa.GL.Component.Rendering3D\", printLog=False)\n confignode.addObject('OglSceneFrame', style=\"Arrows\", alignment=\"TopRight\")\n\n\n # Collision pipeline\n# rootNode.addObject('VisualLoop')\n rootNode.addObject('CollisionPipeline')\n rootNode.addObject('FreeMotionAnimationLoop')\n rootNode.addObject('GenericConstraintSolver', tolerance=\"1e-6\", maxIterations=\"1000\")\n rootNode.addObject('BruteForceBroadPhase')\n rootNode.addObject('BVHNarrowPhase')\n rootNode.addObject('RuleBasedContactManager', responseParams=\"mu=\"+str(0.0), name='Response', response='FrictionContactConstraint')\n rootNode.addObject('LocalMinDistance', alarmDistance=10, contactDistance=5, angleCone=0.01)\n\n\n totalMass = 1.0\n volume = 1.0\n inertiaMatrix=[1., 0., 0., 0., 1., 0., 0., 0., 1.]\n\n\n sphere = rootNode.addChild(\"sphere\")\n sphere.addObject('EulerImplicitSolver', name='odesolver')\n sphere.addObject('CGLinearSolver', name='Solver', iterations=25, tolerance=1e-05, threshold=1e-05)\n sphere.addObject('MechanicalObject', name=\"mstate\", template=\"Rigid3\", translation2=[0., 0., 0.], rotation2=[0., 0., 0.], showObjectScale=50)\n sphere.addObject('UniformMass', name=\"mass\", vertexMass=[totalMass, volume, inertiaMatrix[:]])\n sphere.addObject('UncoupledConstraintCorrection')\n\n #### Collision subnode for the sphere\n collision = sphere.addChild('collision')\n collision.addObject('MeshOBJLoader', name=\"loader\", filename=\"mesh/ball.obj\", triangulate=\"true\", scale=45.0)\n collision.addObject('MeshTopology', src=\"@loader\")\n collision.addObject('MechanicalObject')\n collision.addObject('TriangleCollisionModel')\n collision.addObject('LineCollisionModel')\n collision.addObject('PointCollisionModel')\n collision.addObject('RigidMapping')\n\n #### Visualization subnode for the sphere\n sphereVisu = sphere.addChild(\"VisualModel\")\n sphereVisu.loader = sphereVisu.addObject('MeshOBJLoader', name=\"loader\", filename=\"mesh/ball.obj\")\n sphereVisu.addObject('OglModel', name=\"model\", src=\"@loader\", scale3d=[50]*3, color=[0., 1., 0.], updateNormals=False)\n sphereVisu.addObject('RigidMapping')\n\n\n # Creating the floor object\n floor = rootNode.addChild(\"floor\")\n\n floor.addObject('MechanicalObject', name=\"mstate\", template=\"Rigid3\", translation2=[0.0,-300.0,0.0], rotation2=[0., 0., 0.], showObjectScale=5.0)\n floor.addObject('UniformMass', name=\"mass\", vertexMass=[totalMass, volume, inertiaMatrix[:]])\n\n #### Collision subnode for the floor\n floorCollis = floor.addChild('collision')\n floorCollis.addObject('MeshOBJLoader', name=\"loader\", filename=\"mesh/floor.obj\", triangulate=\"true\", scale=5.0)\n floorCollis.addObject('MeshTopology', src=\"@loader\")\n floorCollis.addObject('MechanicalObject')\n floorCollis.addObject('TriangleCollisionModel', moving=False, simulated=False)\n floorCollis.addObject('LineCollisionModel', moving=False, simulated=False)\n floorCollis.addObject('PointCollisionModel', moving=False, simulated=False)\n floorCollis.addObject('RigidMapping')\n\n #### Visualization subnode for the floor\n floorVisu = floor.addChild(\"VisualModel\")\n floorVisu.loader = floorVisu.addObject('MeshOBJLoader', name=\"loader\", filename=\"mesh/floor.obj\")\n floorVisu.addObject('OglModel', name=\"model\", src=\"@loader\", scale3d=[5.0]*3, color=[1., 1., 0.], updateNormals=False)\n floorVisu.addObject('RigidMapping')\n\n\n return rootNode\n\n\n# Function used only if this script is called from a python environment\nif __name__ == '__main__':\n main()\n```\n\n","author":{"url":"https://github.com/DarkKnightCyd","@type":"Person","name":"DarkKnightCyd"},"datePublished":"2025-02-21T12:06:21.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/485/SofaPython3/issues/485"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:c4cba2cc-45af-4d47-34dc-9de0f2d977ea |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8E2C:1CC34:2C8F5F:3E0895:697CDAC0 |
| html-safe-nonce | 84376c1b397c0cd67438e017ca822bd403c4adb53a33af664f7c9eaa164a73be |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RTJDOjFDQzM0OjJDOEY1RjozRTA4OTU6Njk3Q0RBQzAiLCJ2aXNpdG9yX2lkIjoiNjU3ODE0NjI0NDM0NzA3MTM2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 290c87321dc4f6c2d919ff7766c914ab8b189dbb174a43de42eee5fe86218d1c |
| hovercard-subject-tag | issue:2868855561 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/sofa-framework/SofaPython3/485/issue_layout |
| twitter:image | https://opengraph.githubassets.com/34e150c5941a7c2bb1884bc6da6580496f21642f3afabb033b08ff4dc59c35df/sofa-framework/SofaPython3/issues/485 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/34e150c5941a7c2bb1884bc6da6580496f21642f3afabb033b08ff4dc59c35df/sofa-framework/SofaPython3/issues/485 |
| og:image:alt | I tried using SofaPython by following the docs, but the code could not run well. In Sofa Gui there's nothing showed up and the error is: [ERROR] [Simulation] Simulation::initTextures() : VisualLoop... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | DarkKnightCyd |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f20df5019a7f846ce01350c443b1b5209bcc8b08d1ff80f92fdef440a0c7c89 |
| turbo-cache-control | no-preview |
| go-import | github.com/sofa-framework/SofaPython3 git https://github.com/sofa-framework/SofaPython3.git |
| octolytics-dimension-user_id | 11028508 |
| octolytics-dimension-user_login | sofa-framework |
| octolytics-dimension-repository_id | 260159147 |
| octolytics-dimension-repository_nwo | sofa-framework/SofaPython3 |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 260159147 |
| octolytics-dimension-repository_network_root_nwo | sofa-framework/SofaPython3 |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 0f08fae6208283a46e6e5febf9878b9cdddfaa23 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width