jgerstmayr / EXUDYN

Multibody Dynamics Simulation: Rigid and flexible multibody systems
https://www.youtube.com/channel/UCsQD2bIPBXB_4J23WtqKkVw/playlists
Other
173 stars 23 forks source link

UFgraphics #52

Closed MichaelUIBK closed 1 year ago

MichaelUIBK commented 1 year ago

If I use exu.ConfigurationType.Current in UFgraphics, which "... gives the current configuration during and at the end of the computation of a step (static or dynamic) ...", everything works fine in the Exudyn OpenGL window, but the Solution Viewer shows only the last step.

def UFgraphics(mbs, objectNum):
  gLine=[]
  for atc in tetList:        
      A=mbs.GetSensorValues(atc.node1.sensorCenterOfRotation,configuration=exu.ConfigurationType.Current)
      B=mbs.GetSensorValues(atc.node2.sensorCenterOfRotation,configuration=exu.ConfigurationType.Current)
      C=mbs.GetSensorValues(atc.node3.sensorCenterOfRotation,configuration=exu.ConfigurationType.Current)
      D=mbs.GetSensorValues(atc.node4.sensorCenterOfRotation,configuration=exu.ConfigurationType.Current)

      points=[A,B,C,D]       

      triangles=[0,1,2]
      gLine+=[GraphicsDataFromPointsAndTrigs(points,triangles,color=[0.41,0.41,0.41,1])]
      triangles=[0,2,3]
      gLine+=[GraphicsDataFromPointsAndTrigs(points,triangles,color=[0.83,0.83,0.83,0.2])]
  return gLine

ground = mbs.AddObject(ObjectGround(visualization=VObjectGround(graphicsDataUserFunction=UFgraphics)))

Python 3.9.7 exudyn.version '1.6.164.dev1'

jgerstmayr commented 1 year ago

You should use configuration=exu.ConfigurationType.Visualization, which gives the according configuration, that is needed for graphics visualization.