Mechanics Forums by Mark Barkey

ABAQUS => Scripting and Python => Topic started by: Wahid on April 02, 2021, 04:41:04 PM

Title: Extract node set coordinates in abaqus using python script
Post by: Wahid on April 02, 2021, 04:41:04 PM
Hello,
I would like to extract the Node set coordinates using a python script. i tried with this method using an odb file :

import sys
from odbAccess import *
from abaqus import *
from abaqusConstants import *
import __main__

odb = openOdb('C:/Temp/Job-1.odb')
set = odb.rootAssembly.instances['part-1'].nodeSets['Set-1']

numNodes = len(set.nodes)
partlabel=[];
partxcord=[];
partycord=[];
partzcord=[];
for curNode in a.nodes:
    partlabel.append(curNode.label)
    partxcord.append(curNode.coordinates[0])
    partycord.append(curNode.coordinates[1])
    partzcord.append(curNode.coordinates[2])

The error displayed is : keyerror : Set-1.
knowing that when I defined the same syntax for the coordinates of the instance nodes, it works correctly.

myInstance = odb.rootAssembly.instances['part-1']
Title: Re: Extract node set coordinates in abaqus using python script
Post by: Mark Barkey on April 02, 2021, 06:29:57 PM
make sure that the node set is being written to the ODB
check the name of the set and name of the part

otherwise, I don't know what the issue could be from that information.

Thanks,
MEB
Title: Re: Extract node set coordinates in abaqus using python script
Post by: Wahid on April 04, 2021, 12:28:17 PM
Thank you for te reply Mr. Barkey.

I found the solution, the name of the set must be noted in upper case ['SET-1']. knowing that in the model abaqus CAE, it is defined like that ['Set-1']

Thanks
Wahid
EhPortal 1.34 © 2024, WebDev