# Scripting for 360° View of Results in Abaqus

Posted in Simulations and tagged , on .

A 360° view of simulation results might help to produce an overall view of the deformed material body and the distribution of field output. This note documents the implementation of 360° view of a deployed airbag using Abaqus Python script.

Abaqus Python scripting has the setViewpoint() method of a viewport object that allows analysts to change how they look at the model in Visualization module. It has the arguments viewVector which is a sequence of 3 floats to specify the viewpoint and cameraUpVector to specify the orientation of the camera. We can think it like we are standing at the position specified by viewVector and looking to the origin of the model with our head orientated in the cameraUpVector direction.

We can easily set up a loop in Python to move the viewpoint on a circle of the cone to form a 360° view of the simulation results.

The following is an example script that saves a series of n images of Mises stress of a deployed airbag, viewed from n viewpoints along 360°. Those images can be used to generate a GIF animation of a 360° view following this workflow.

from odbAccess import *
from abaqusConstants import *
odb = openOdb('mybag_3.odb')
# generate n viewpoints along 360 degree
n = 20
ang = pi/4
file = 0

session.viewports['Viewport: 1'].setValues(displayedObject=odb)
session.viewports['Viewport: 1'].odbDisplay.setPrimaryVariable(
variableLabel='S',
outputPosition=INTEGRATION_POINT,
refinement=(INVARIANT, 'Mises'), )
session.viewports['Viewport: 1'].odbDisplay.display.setValues(
plotState=(CONTOURS_ON_DEF, ))

for i in range(n):
ang += 2*pi/n
session.viewports['Viewport: 1'].view.setViewpoint(
viewVector=(sqrt(2)*sin(ang), sqrt(2)*cos(ang), .5),
cameraUpVector=(0, 0, 1),
drawImmediately=True)
session.printOptions.setValues(vpDecorations=OFF)
session.printToFile(
fileName=str(file),
format=PNG,
canvasObjects=(session.viewports['Viewport: 1'], ))
file += 1