HELP ! URGENT ! Export deformed shape into any CAD format from ABAQUS
HELP ! URGENT ! Export deformed shape into any CAD format from ABAQUS
(OP)
thread799-178458: HELP ! URGENT ! Export deformed shape into any CAD format from ABAQUS
Hi everybody,
I have done an analysis in abaqus and then I had to export the final part geometry in a CAD file. But unfortunately the abaqus add-on for direct export of the final part geometry is not working so I have to write a python script for it. There was a thread many years ago and one of the members here (cdeepakroy) wrote a script but it was 2D and he saved it in VTK. Does anybody know how whould be script if it were to be 3D and saved as VRML or STL?
Here is the script:
# 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[i]
defNodePos = curNode.coordinates + dispField.values[i].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[i].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()
Hi everybody,
I have done an analysis in abaqus and then I had to export the final part geometry in a CAD file. But unfortunately the abaqus add-on for direct export of the final part geometry is not working so I have to write a python script for it. There was a thread many years ago and one of the members here (cdeepakroy) wrote a script but it was 2D and he saved it in VTK. Does anybody know how whould be script if it were to be 3D and saved as VRML or STL?
Here is the script:
# 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[i]
defNodePos = curNode.coordinates + dispField.values[i].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[i].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()





RE: HELP ! URGENT ! Export deformed shape into any CAD format from ABAQUS
I hope this helps.
Rob
Rob Stupplebeen
Rob's Engineering Blog
Rob's LinkedIn Profile
RE: HELP ! URGENT ! Export deformed shape into any CAD format from ABAQUS
Tnx for the answer but as I said Unfortunately that option doesn't work. It only export the tool geometry and not the part geometry.
RE: HELP ! URGENT ! Export deformed shape into any CAD format from ABAQUS
Then try to export as .STL using the plug-in. Might work?