Close this search box.
Clear all

Creating custom odb files using python scripting

3 Posts
2 Users
0 Reactions
Posts: 2
Topic starter
New Member
Joined: 8 years ago

Dear All

I am new in the forum. Currently a researcher at Politecnico di Torino, Italy. I have a problem with python script developed for creating a new odb file and adding necessary result data to it. I have experience with editing old odb files and adding additional result data into it. Still I am not been able to sort out the problem with my current script.

My script is as follows:

from abaqus import *

from caeModules import *

from abaqusConstants import *

import caePrefsAccess

from odbAccess import *

import odbAccess

import odbMaterial

import odbSection

import part

import os

import math

import numpy as ny

import visualization

#Reading the node and element data from files

nodes = ny.loadtxt(ABQ_Nodes.dat)

elements = ny.loadtxt(ABQ_Element.dat,dtype=int)

nodeLabels = []

nodeCoords = []

for node in nodes:



odbPath = C:\\Abaqus_Workspace\\01_PythonScripts\\CUF_Taylor_PostProcessing\\CUF.odb

#Creating a viewport and adding ODB

#pView = session.Viewport(name = Viewport-1)

#Creating the odb

pOdb = odbAccess.Odb(name=CUF.odb,analysisTitle=CUF Analysis,path=odbPath,description=1D beam)

#Creating material for odb

pMat = pOdb.Material(name=MATERIAL)


#Creating section for odb

sectionName = Homogeneous Solid Section

mySection = pOdb.HomogeneousSolidSection( name = defaultSec,

material = DefaultMat,

thickness = 1.0)

#Creating section for odb

pCat = pOdb.SectionCategory(name=odbSection,description = Section for odb)

# Associate the output database with the viewport.



#Creating the 3D solid part

pPart = pOdb.Part(name=beamTaylor,embeddedSpace = THREE_D,type= DEFORMABLE_BODY)

pPart.addNodes(labels = nodeLabels,coordinates = nodeCoords)

pPart.addElements(elementData = elements, type = C3D8,elementSetName = ELSETPART,sectionCategory=pCat)

pPElt = pPart.elementSets[ELSETPART]


#Create a node and element set

pPartNodes= pPart.NodeSet(name=PartNodes,nodes=pPart.nodes[1:nodeLabels[-1]+1])

#Creating the instance for the solid part

pAssembly = pOdb.rootAssembly.Instance(name = instbeamTaylor-1,object = pPart)

#Creating section for odb

#Creating the analysis step

pStep = pOdb.Step(name=StaticAnalysis,description=Analysis type - 101,domain=TIME,timePeriod = 1.0)

#Creating the frame for the step

pFrame0 = pStep.Frame(incrementNumber=0,frameValue=0.0000)

pFrame1 = pStep.Frame(incrementNumber=1,frameValue=1.0000)

#Reading the result file

dispValues = ny.loadtxt(DISPL_POINTS.dat,skiprows=1,usecols = (3,4,5))

#Creating the Field Output - Displacement

pDisp0 = pFrame0.FieldOutput(name=U,description=Displacement,type=VECTOR,componentLabels=(1,2,3))

pDisp1 = pFrame1.FieldOutput(name=U,description=Displacement,type=VECTOR,componentLabels=(1,2,3))

#Adding data

pDisp0.addData(position = NODAL,instance = pAssembly,labels = nodeLabels,data=dispValues)

pDisp1.addData(position = NODAL,instance = pAssembly,labels = nodeLabels,data=dispValues)

#Setting default display options




In visualization module, none of the above operation occurs. In the tree, only node and element sets are present. Nothing can be visualized. Even though the script runs, the repositories are not added to the odb. It can be accessed via the terminal. When I try to open the new odb, ABAQUS crashes.

It would be great, if you could point out the problem.

Thank you in advance



MUL2, Politecnico di Torino


2 Replies
Posts: 3998
Joined: 5 years ago

Sounds interesting. I have not, as far as I can remember, created empty odb-files from Abaqus/Python. What do you need that?
I am not sure what is causing your code to fail. Can you add debug statements?


2 Replies
Posts: 2
Topic starter
New Member
Joined: 8 years ago

Dear Jorgen

Thank you for your reply. It turns out the element connectivity for C3D8 was not in order as the convention followed by ABAQUS. I changed the order of node numbers in the element connectivity matrix and it worked. That was the reason for the failure. We were using Gmesh for post processing, but it performs erratically when you the DOFs grows. Thus ABAQUS Viewer seemed like a better solution.