Extract Deformed Node Coordinates

##############################################################
## Extract coordinates of nodes in a deformed set
##############################################################

jobName = '''Name of Job'''
stepName = '''Name of Step'''
outputSetName = '''Name of Output nodeSet'''

from odbAccess import*
from abaqusConstants import*
import string
import numpy as np
import os

odb = openOdb(path = jobName+'.odb')

os.makedirs('ResultFiles')
os.chdir('ResultFiles')

for fm in range(0, len(odb.steps[stepName].frames)):
    outfile = open('X-Y-' + str(fm) + '.csv','w')
    outfile.write('X, Y\n')
    timeFrame = odb.steps[stepName].frames[fm]
    readNode = odb.rootAssembly.nodeSets[outputSetName]
    Coordinate = timeFrame.fieldOutputs['COORD']  # Remember to set field outputs manually
    readNodeCoordinate = Coordinate.getSubset(region=readNode)
    readNodeCoordinateValues = readNodeCoordinate.values
    count=len(readNodeCoordinateValues)
    X_Coordinate = np.zeros(count)
    Y_Coordinate = np.zeros(count)
    Z_Coordinate = np.zeros(count)
    for i in range(0, count):
        X_Coordinate[i]=readNodeCoordinateValues[i].data[0]
        Y_Coordinate[i]=readNodeCoordinateValues[i].data[1]
    Sorted_X_Coordinate = np.sort(X_Coordinate) # Sort data according to X coordinates
    Inps = X_Coordinate.argsort()
    Sorted_Y_Coordinate = Y_Coordinate[Inps]
    for i in range(0, count):
        outfile.write(str(Sorted_X_Coordinate[i]) + ',' +
        str(Sorted_Y_Coordinate[i]) + ',' + '\n')
    outfile.close()

odb.close()