Using several example scripts found online, I have managed to extract the coordinates of an Abaqus simulation from the .odb file. However, I would like to only extract the coordinates of a certain nodeset e.g. a nodeset called "NS-1". Information on specifically extracting nodeset coordinates using Python in Abaqus is sparse, and I have tried many supposed solutions that do not work.
Would anyone be able to advise me how my code needs to be modified in order to extract coordinates of a certain node set? Thanks
Here is my code:
import sketch
import visualization
import xyPlot
import displayGroupOdbToolset as dgo
import connectorBehavior
import shutil
import os
import sys
from odbAccess import openOdb
from odbAccess import openOdb
for ODBname in os.listdir("D:/AbaqusWorking/Coordtest"):
ODBnamefull = "D:/AbaqusWorking/Coordtest/Job-1.odb"
odb = openOdb(path=ODBnamefull)
assembly = odb.rootAssembly
modelname = "Test"
session.viewports['Viewport: 1'].odbDisplay.setFrame(step=0, frame=1)
numNodes = 0
f = open("D:/AbaqusWorking/Coordtest/Testing.csv", "w")
for name, instance in assembly.instances.items():
n = len(instance.nodes)
print 'Number of nodes of instance %s: %d' % (name, n)
numNodes = numNodes + n
f.write("Name,Node,X,Y,Z" + "\n")
if instance.embeddedSpace == THREE_D:
for node in instance.nodes:
f.write(str(modelname) + "," )
f.write(str(node.label) + "," )
f.write(str(node.coordinates[0]) + "," + str(node.coordinates[1]) + "," + str(node.coordinates[2]) + "\n")
else:
for node in instance.nodes:
f.write( str(node.label) + ";" )
f.write(str(node.coordinates[0]) + "," + str(node.coordinates[1]) + "," + str(node.coordinates[2]) + "\n")
f.write( "*End Part" )
print 'Write to file complete'
f.close()