SofaDefrost / STLIB

Sofa Template Library
GNU Lesser General Public License v3.0
17 stars 22 forks source link

Issue on [CableGripper] Tutorials #87

Closed jmz3 closed 10 months ago

jmz3 commented 2 years ago

Hi,

I followed the tutorial of DefrostSofaBundle/plugins/SoftRobots/docs/sofapython3/tutorials/CableGripper/cablegripper-tuto.md to create my own cube&floor scene, and I figured out that the tutorial is out-dated in terms of the VisualModel.

From the Line# 54 The tutorial asked me to modify the */CableGripper/myproject/cablegripper.py file like the following:

from stlib3.visuals import ShowGrid
from stlib3.physics.rigid import Floor
from stlib3.physics.rigid import Cube

def createScene(rootNode):
    """This is my first scene"""
    ShowGrid(rootNode)

    Floor(rootNode,
          translation=[0.0,0.0,0.0],
          isAStaticObject=True)

    Cube(rootNode,
          translation=[0.0,0.0,0.0])

    return rootNode

However, the terminal log shows that there is no such module called ShowGrid in the visuals package

[ERROR]   [SofaPython3::SceneLoader] Unable to completely load the scene from file '/home/jeremy/DefrostSofaBundle/plugins/SoftRobots/docs/sofapython3/tutorials/CableGripper/myproject/cablegripper.py'.  
Python exception:   
  ImportError: cannot import name 'ShowGrid' from 'stlib3.visuals' (/home/jeremy/DefrostSofaBundle/plugins/STLIB/lib/python3/site-packages/stlib3/visuals/__init__.py)

Hence, I checked with the source code here and think the right expression based on the current structure of stlib3 should be like this:

from stlib3.visuals.visualmodel import VisualModel
def createScene(rootNode):
    VisualModel.showGrid(rootNode)

Hope this might help. Thank you.

EulalieCoevoet commented 10 months ago

I think this has been fixed. ShowGrid(rootNode) is no longer used in the CableGripper tutorial.