Sorry I don't have particularly good sample code yet for this specific operation. I have another example for python scripting you might find useful. Like finding max/min, getting the output for section cut forces can be a pain in the ass if you're going to make multiple cuts. This script outputs the results for every single frame in the odb. I'm giving you this one because you have to use odbDisplay.setValue to control the frame location for finding the min and max too. As usual, you're going to have to read the painful manual to get better understanding.
class FreeBodyData(object):
"""
Object used to extract free body cut data from Abaqusi CAE/Viewer
Arguments:
frame = Abaqus OdbFrame object
viewport = Abaqus Vieport object
numDigits = number of digits of accuracy for forces/moments
csysType = GLOBAL or LOCAL, specifying Abaqus coordinate system type
"""
def __init__(self,
frame, viewport,
numDigits = 6,
csysType = GLOBAL,
plotState = DEFORMED):
odb, step = get_frame_parents(frame)
self.frameId = frame.frameId
self.frame = frame
self.stepname = step.name
self.viewport = viewport
self.plotState = plotState
self.odb = odb
self.tempname = os.path.splitext(odb.name)[0] + 'FBReport_TEMP001.rpt'
session.freeBodyReportOptions.setValues(numDigits = numDigits,
momentThreshold = 1e-6,
forceThreshold = 1e-6,
numberFormat = SCIENTIFIC,
csysType = csysType)
return
def viewcut(self, plane, position, plotState = DEFORMED):
"""
plane = name of plane to use for cut
position = scalar distance away from plane in normal direction.
plotState = Abaqus constant, either DEFORMED or UNDEFORMED
"""
self.plane = plane
vp = self.viewport
vp.odbDisplay.setFrame(frame = self.frame)
vp.odbDisplay.display.setValues(plotState = (self.plotState))
vp.odbDisplay.setValues(viewCut=ON,
viewCutNames = (plane, ))
vp.odbDisplay.viewCuts[plane].setValues(
showFreeBodyCut = True,
position = position)
session.writeFreeBodyReport(fileName = self.tempname,
append = OFF,
odb = self.odb
)
self.readFreeBodyReport()
os.remove(self.tempname)
return
def readFreeBodyReport(self):
with open(self.tempname, 'r') as file1:
lines = file1.readlines()
i = 0
num_act = lines[i + 2].split('=')[1].strip()
name = lines[i + 4].split('=')[1].strip()
step = lines[i + 5].split('=')[1].strip()
stepnum = lines[i + 6].split('=')[1].strip()
frame = lines[i + 7].split('=')[1].strip()
time = lines[i + 8].split('=')[1].strip()
force = lines[i + 9].split('=')[1].strip()
moment = lines[i + 10].split('=')[1].strip()
sum_point = lines[i + 11].split('=')[1].strip()
m_arr = np.array(moment.split(), dtype = float)
f_arr = np.array(force.split(), dtype = float)
s_arr = np.array(sum_point.split(), dtype = float)
self.moments = m_arr
self.forces = f_arr
self.summation_point = s_arr
return
def string_title(self):
list1 = ['Plane', 'Step', 'Time',
'Mx','My','Mz',
'Fx','Fy','Fz',
'x','y','z']
str1 = format_list(list1)
return str1
def string_line(self):
list1 = self.plane, self.stepname
list2 = [get_frame_total_time(self.frame),
self.moments[0],
self.moments[1],
self.moments[2],
self.forces[0],
self.forces[1],
self.forces[2],
self.summation_point[0],
self.summation_point[1],
self.summation_point[2]]
str1 = "%16s,%16s," % list1 + format_list(list2, fmt='%16.8e')
return str1
##################################################################################
print "hello1"
vname = session.currentViewportName
vp1 = session.viewports[vname]
odbname = vp1.odbDisplay.name
odbbase = os.path.basename(os.path.splitext(odbname)[0])
dirname = os.path.dirname(odbname)
dirname = os.path.join(dirname, "Node Output - " + odbbase)
if not os.path.exists(dirname):
os.mkdir(dirname)
filename = "viewcut_data.dat"
filepath = os.path.join(dirname, filename)
odb1 = session.odbs[odbname]
i = 0
with open(filepath, 'w') as file1:
for f in odb_frames_loop(odb1):
fbcut = FreeBodyData(f, vp1)
fbcut.viewcut(plane = 'Y-Plane', position = 15.0)
if i == 0:
line = fbcut.string_title()
file1.write(line)
file1.write(fbcut.string_line())
i+=1