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!

HELP ! URGENT ! Export deformed shape into any CAD format from ABAQUS 4

Status
Not open for further replies.

cdeepakroy

Computer
Feb 16, 2005
24
0
0
US
Hello,

Is there a way i can export the deformed shape resulting form the FEA analysis in ABAQUS in a standard CAD format ???

Right now, i can view the results in the ABAQUS visualization module and the simulation appers to be right.

But I did not find any way in which i can export the deformed mesh in a standard CAD format.

I want this facility, because i want to read back the deformed mesh into my C++ application code, analyse it and then generate a new input file for ABAQUS for analysis. I want to implement this iterative process.

I have explored all the menu options in the visualization module, but i found no way of exporting the deformed shape in a standard CAD format .....

Any help would be greatly appreciated ....

Thanks in advance,

Deepak

 
Replies continue below

Recommended for you

You could use the old ascii results text output .fil file format to export the displacements as a preliminary stage. Then you would have to write your own program to read this file, add the displacements to the undeformed mesh geometry and create a deformed mesh which you then write out in either VRML or STL format.

A lot of work I know, but it can be done !
 
Thanks a lot for the reply johnors.

Yes i was thinking about that as a last option.

But dont you think --- the ability to export the deformed shape into a standard 3D/CAD format is a very basic facility to provide. Im sure many people want to read back the deformed shape for a variety of reasons apart from seeing visualizations in the visualization module.

Im really surprised that ABAQUS does not provide this facility. are you really sure, there is no way to export directly ???

Regards,

Deepak
 
You can export (File - Export) to VRML which is pretty commonly imported into CAD systems (such as Solidworks, Pro/E etc). 3DXML is also supported and can be read into CATIA.

 
cdeepakroy,

I have been through this problem recently too. My advice would be to not use the vrml file format if you are going to be doing any post processing of the nodal data. While I am not performing an iterative process with my results, I am using Matlab to analyze the deformed mesh. When I imported the vrml file into Matlab and parsed the data I noticed that there are twice as many nodes in the vrml file as in the actual mesh. Not sure why but it seems to be unique to this file format.

To export the nodes of the deformed mesh, simply go to "Report/Field Output..." while in the results window. In the variable tab select "unique nodal" in the position drop down window. In the list of variables check the box next to "U: Spatial Displacement". This will create a report (.rpt) file that contains the individual node numbers along with there dx,dy,dz displacements. If you need to know the original xyz location of each node just look in the .inp file of the model.

Hope that is helpful.
 
the report file output should exist even in the old version. It works for me in v 5.5

blogan,

How can you import *.rpt file into matlab for analysis? If I just want to measure the dimension in the deformed parts, can I use vrml format only?
 
Hello all,

Thanx for your contributions to the discussion.

I have solved the problem, by writing a python script. The code was very simple and straighforward.

I just read the displacements from the output data base object.

And i add the displacements to the respective nodal position coordinates which can be accessed through the model data base object.

Then u can use the python's file I/O capabilities for writing out the deformed shape in any file format you want.

I write my deformed geometry in VTK (Visualization Toolkit -- Url: ) file format, so that i can import into my software which i developed based on C++ and VTK.

I can post this small snippet of python code which does the job --- IF ANYONE IS INTERESTED.
 
Hello all,

Below is the snippet of python code that i used to export the deformed shape in the VTK file format :

********************************************************

# create odb object from odb file
outputDatabase = session.openOdb(name= ImplantAnalysisJob.name + '.odb' )

# get access to the nodal displacement data
frame = outputDatabase.steps[ '<give-step-name-here>' ].frames[-1]

dispField = frame.fieldOutputs['U']

# get access to the part instance -- thru which u can access the undeformed nodal position coordinates
my_part_instance = outputDatabase.rootAssembly.instances['PART-1-1']


# Write deformed shape to vtk file
# NOTE: if you want to export to a different file format, you should appropriate code for that file format here

outFile = open( 'deformed_shape.vtk' , 'w' )

# write vtk header

outFile.write( '# vtk DataFile Version 3.0' )
outFile.write( '\nvtk output' )
outFile.write( '\nASCII' )
outFile.write( '\nDATASET UNSTRUCTURED_GRID' )

# write points

numNodesTotal = len( my_part_instance.nodes )

outFile.write( '\n\nPOINTS ' + str( numNodesTotal ) + ' float' )

for i in range( numNodesTotal ):

curNode = my_part_instance.nodes

defNodePos = curNode.coordinates + dispField.values.data

outFile.write( '\n' )

for j in range( 3 ):

outFile.write( str( defNodePos[j] ) + ' ' )

# write cells

numElementsTotal = len( my_part_instance.elements )

outFile.write( '\n\nCELLS ' + str( numElementsTotal ) + ' ' + str( numElementsTotal * 5 ) )

for i in range( numElementsTotal ):

curElement = list( [4] + list( my_part_instance.elements.connectivity ) )

outFile.write( '\n' )

for j in range( 5 ):

outFile.write( str( curElement[j] ) + ' ' )

# write cell types

outFile.write( '\n\nCELL_TYPES ' + str( numElementsTotal ) )

for i in range( numElementsTotal ):

outFile.write( '\n10' )

# write cell data

outFile.write( '\n\nCELL_DATA ' + str( numElementsTotal ) )

# write point data

outFile.write( '\n\nPOINT_DATA ' + str( numNodesTotal ) )

outFile.close()

outputDatabase.close()


**********************************************************

Hope this is some use to people ......

Regards,

Deepak
 
cdeepakroy,

Thanks for posting this code snippet. I would like to use this code to write the exact same data to a .txt or .xls file so I don't have to manually parse the data which is way too time consuming. However, when I tried to implement the code and run the script I get a KeyError in the code line that gets access to the part instance. I am using ABAQUS 6.6 and didn't know if you had the same version so I checked the documentation. The documentation says access to the OdbMeshNode object is done using

import odbAccess
session.odbs[name].rootAssembly.instances[name]

so that's what I tried but I got the same KeyError. Here is a sample of the first part of the code I am using which is nearly identical to yours.

import odbAccess

outputDatabase = session.odbs['filename.odb']

frame = outputDatabase.steps['stepname'].frames[-1]

dispField = frame.fieldOutputs['U']

my_part_instance = outputDatabase.rootAssembly.instances['instancename']

Why does ABAQUS not recognize the instance name? I checked the input file to see the exact name of the part instance (instance=instancename) and copied it into my code but it still didn't work. Any ideas on how to debug this problem?
 
The CLI (command line interpreter - look at the message window, there's a tab labeled >>>) is your best friend - you should use it!

Try entering the same lines (cut and paste one by one) into the CLI, but when you get to the last one "my_part_instance = "... stop when you get to "instances"

At this point you should press the tab key and ABAQUS will complete the command with the instance name(s) available. If you don't get any completion options then you have to back up a bit to have a look at what is in your odb.

The tab completion is an INCREDIBLY useful tool, not only for cycling through keys in a repositiory (which is what you are doing in this situation), but more importantly, it can complete a command by showing the available methods/members of an object. Try this:

You have already created an object called "frame". Now type >>> print frame.<tab>

(Obviously the <tab> refers to a press of the tab key)

You can continue to press tab to cycle through the various methods/members.

With this method you can traverse the object model of the odb or mdb. It is not a replacement for reading the docs, but it sure helps you find what you're looking for!!!
 
errata: in the above explanation I missed a "[" character in the second paragraph. It should read:

####
Try entering the same lines (cut and paste one by one) into the CLI, but when you get to the last one "my_part_instance = "... stop when you get to "instances["
####


PS The tab completion also works with partially typed commands...

Try the following next time you have an odb displayed..
(The <tab> refers to a single press of the tab key. Type in the rest of the characters as shown. You should get the picture)

>>>myOdb = se<tab>.od<tab><tab>[<tab>
 
Final tip for the evening;

when you have an object defined (like frame in blogan's posting) if you want to see all the available members and methods for that object just type:

>>> dir(frame)

 
brep,

I hope this is my last question regarding this problem, but I thought I had everything working great until I ran my Python script to get the node and nodal displacement data and compared the resulting .txt file to the .rpt file that I manually exported from ABAQUS. I will try to summarize what is wrong with the .txt file.

The x,y, and z columns are output in the correct order staring with nodeLabel 1. However the dx,dy, and dz columns are shifted down one row each (starting with nodeLabel 2). What doesn't make sense is that the first entry in each of the dx,dy, and dz columns doesn't belong in my data. It looks something like this.

x dx y dy z dz
A # A # A #
B A B A B A
C B C B C B
D C D C D C
...
Z Y Z Y Z Y

Here is the code I use to output the data.

import odbAccess

# create odb object from odb file
outputDatabase = session.odbs['name']

# get access to the nodal displacement data
frame = outputDatabase.steps[ 'name' ].frames[-1]

dispField = frame.fieldOutputs['U']

# get access to the part instance to access the undeformed nodal position coordinates
my_part_instance = outputDatabase.rootAssembly.instances['name']

# Write deformed shape to txt file

outFile = open( 'name.txt' , 'w' )

numNodesTotal = len( my_part_instance.nodes )

outFile.write( 'x ' + 'dx ' + 'y ' + 'dy ' + 'z ' + 'dz ' )

# write points
for i in range( numNodesTotal ):

curNode = my_part_instance.nodes

defNodePos = dispField.values.data

outFile.write( '\n' )

for j in range( 3 ):

outFile.write( str( curNode.coordinates[j] ) + ' ' + str( defNodePos[j] ) + ' ' )

outFile.close()

Any ideas why the defNodePos starts at nodeLabel 2?
 
You should be aware that the node objects in instance.nodes are indexed from 0.

The label of the nodes , as given by node.label starts from 1.

i.e.
my_instance.nodes[0].label=1

 
xerf,

I did not know that, but nonetheless I am not accessing or outputing the node.label. I know the first entry in the output .txt file for dx,dy,dz corresponds to node 2 (not node 1 as it should) because I am looking at the .inp file and the .rpt file that I maunally created. Even if the node object indexing starts at 0 and node labels begin at 1, why is the undeformed node coordinates written to the .txt file in ascending order starting with node 1 but the deformed coordinates start from node 2?
 
Status
Not open for further replies.
Back
Top