×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Creating custom odb files using python scripting

Creating custom odb files using python scripting

Creating custom odb files using python scripting

(OP)
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:
nodeLabels.append(int(node[0]))
nodeCoords.append(node[1:4])

odbPath = 'C:\\Abaqus_Workspace\\01_PythonScripts\\CUF_Taylo r_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')
pOdb.save()

#Creating material for odb
pMat = pOdb.Material(name='MATERIAL')
pMat.Elastic(type=ISOTROPIC,table=((12000,0.3),))

#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.
#pView.setValues(displayedObject=pOdb)

#session.ScratchOdb(odb=pOdb)


#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']
pPart.assignSection(region=pPElt,section=mySection )

#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='Analy sis 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='Displace ment',type=VECTOR,componentLabels=('1','2','3'))
pDisp1 = pFrame1.FieldOutput(name='U',description='Displace ment',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
pStep.setDefaultField(pDisp0)

#pOdb.update()
pOdb.save()
pOdb.close()



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

Regards
Ibrahim
MUL2, Politecnico di Torino
Italy

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources