Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro to Retrieve Displacement Data from ODB File

Status
Not open for further replies.

Sri Harsha

Aerospace
Jun 16, 2017
37
0
0
DE
Hi,

I have been trying to record the macro for retrieving displacementdata from ABAQUS ODB File.I have picked a single node and tried to retrieve the displacement data for that particular node.

odb = session.odbs['H:/MiniThessis/MaterialModelling/First_Test.odb']
session.xyDataListFromField(odb=odb, outputPosition=NODAL, variable=(('U',
NODAL, ((INVARIANT, 'Magnitude'), )), ), nodePick=(('PART-1-1', 1, (
'[#0:237 #8 ]', )), ), )
xy1 = session.xyDataObjects['U:Magnitude PI: PART-1-1 N: 7588']

In the recorded Macro above, I could not understand what exactly is "#0:237 #8" ??

I would be really glad,if someone can explain that

Thanks in advance!




 
Replies continue below

Recommended for you

Hello A.Jalal and Igor76,

Could you please explain,how can I retrieve net displacement of a node,if I know a node number
can you please write the macro for doing that?

Would be really helpful!
 
There is a command called getNodeFromLabel() that can be used at odb part level or odb instance level. Just search for that command in the Scripting Reference Manual to get more infos.
 
Hi Mustaine,

If I am writing these 3 lines to retrieve xy data object for displacement.

odb = session.odbs['H:/MiniThessis/MaterialModelling/First_Test.odb']
session.xyDataListFromField(odb=odb, outputPosition=NODAL, variable=(('U',
NODAL, ((INVARIANT, 'Magnitude'), )), ), nodePick=(('PART-1-1', 1, (
'[#0:237 #8 ]', )), ), )
xy1 = session.xyDataObjects['U:Magnitude PI: PART-1-1 N: 7588']

I want to define the node variable as 'N' , instead of the number '7588' and what do i write for "#0:237 #8 "?? How can I retrieve "#0:237 #8", from a given node label??

Thanks in Advance.
 
Two things make it quite simple to get what you want:
1. Access the result by using the node label instead the pick command.
2. Store the result of the command directly in a variable.


Example with my odb and node label 14:

Code:
odb = session.odbs['Job-1.odb']
xy1 = session.xyDataListFromField(odb=odb, outputPosition=NODAL, variable=(('U', 
    NODAL, ((INVARIANT, 'Magnitude'), )), ), nodeLabels=(('PART-1-1', ('14', 
    )), ))

    
# use print to test what you get
print xy1
 
Hi Mustaine,

I have tried the above Macro,which you have suggested with my ODB.
When I tried to print it:

its printing this: [xyDataObjects['U:Magnitude PI: PART-1-1 N: 1837']].

How do I retireve the displacement value from this xyObject. Please explain.I guess,we need to add one more macro line for that?

Waiting for your reply
 
Hi Mustaine,

Thanks for your reply.
I could now retrieve the displacement value.

I have written the follwing macro lines and its working:

xy = session.xyDataListFromField(odb=o1, outputPosition=NODAL, variable=(('U',
NODAL, ((INVARIANT, 'Magnitude'), )), ), nodeLabels=(('PART-1-1', (str(Node),
)), ))
xy1 = session.xyDataObjects['U:Magnitude PI: PART-1-1 N: '+str(Node)]
print xy1[0][1]
 
The assignment to xy1 is imho not necessary. The variable xy has this information already. But it's in a list, so just use xy[0] to access it.

So in your example
print xy[0]
print xy1

would print out two identical lines.
 
Hi Mustaine,

When I say,print xy[0], it prints out "[(1.0, 0.00329504604451358)]". How do I print out only the second value.
I tried out with xy[0][0} as well as xy[0][1],but I am not getting the value as "0.00329504604451358".
 
Hi Mustaine,

Thanks a lot for your reply.
I have written a similar script for retrieving VonMisses stress data

xy1 = session.xyDataListFromField(odb=o1, outputPosition=ELEMENT_NODAL, variable=((
Variable, INTEGRATION_POINT, ((INVARIANT, ParameterName), )), ), elementSets=(
SetName, ))
x0 = session.xyDataObjects[Variable+':'+ParameterName+ ' PI: PART-1-1 E: '+str(Element)+' N: '+str(Node)]
nodalVal = x0[0][1]
print(x0[0][1])
print(xy1[0][0][1])

But,after running the above script,I am getting different values when I print these two values.
Which one do u think is correct??
 
Using ELEMENT_NODAL with an element variable like stress returns you multiple results, because you get the unaveraged value from each element attached to that node. Use Unique Nodal to get one averaged value.
 
Status
Not open for further replies.
Back
Top