Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Abaqus Script: SET definition

Status
Not open for further replies.

val79

Mechanical
Nov 17, 2006
5
Hi,
I’m working on an Abaqus script (obviously in Python language) to do a parametric model. I just wrote some strings of code to create a solid model, but now I want to define a SET of faces of my model. I cannot do it, because there are some mistakes in the definition of the sting code. Here below there is the script I’m using. The wrong row is the last one. Can someone corrects it?

################################# PROGRAMMA
#
from abaqus import *
import testUtils
testUtils.setBackwardCompatibility()
from abaqusConstants import *
import sketch
import part
import section
import regionToolset
import displayGroupMdbToolset as dgm
import part
import material
import assembly
import step
import interaction
import load
import mesh
import job
import sketch
import visualization
import xyPlot
import displayGroupOdbToolset as dgo
import connectorBehavior
#
# PARAMETRI DA INSERIRE
thick = 22.9 #Spessore lastra in (mm)
L1 = 0.5 #Lunghezza prima parte in(mm)
L2 = 1
L3 = 1
L4 = 1200-(L1+L2+L3)
Ltot = 1200
length= 25 #Semi lunghezza del difetto (mm)
a= 6 #Altezza del difetto (mm)
n= 30 #Numero si strati (30 consigliato)
#
#
myModel = mdb.Model(name='Model-1')
mySketch = myModel.Sketch(name='sezione',sheetSize=200.0)
#
mySketch.Line(point1=(0.0, 0.0), point2=(0.0, thick))
mySketch.Line(point1=(0.0, thick), point2=(628.0, thick))
mySketch.Line(point1=(628.0, thick), point2=(628.0, 0.0))
mySketch.Line(point1=(628.0, 0.0), point2=(0.0, 0.0))
#
myPart = myModel.Part('Lastra', dimensionality=THREE_D, type=DEFORMABLE_BODY)
#
myPart.BaseSolidExtrude(sketch=mySketch, depth=Ltot)
#
face1center=(314,(thick/2),0)
face1=myPart.faces.findAt(face1center)
sezion=myPart.Set(face=face1, name='Sezione1')
 
Replies continue below

Recommended for you

Hi,

the findAt()-method returns a face object.
The argument for the Set()-method is a sequence,
in your case a sequence of faces containing
one face. I think this could be the error.
Try something like:

face1=myPart.faces.findAt(face1center)
i = face1.index
set = myMdb.assembly.Set(name='test', faces=myPart.faces[i:i+1])

Hope this works

Marco
 
Hi,

iwb your solution is right, thanks.
However again, now I don't know how to apply this solution for more surfaces.
I have the reference scripting user manual of Abaqus, but I didn't find in it the string commands that I need. Also it isn't so easy to read and understand.
Where I can download an other manual or something like this?

Thanks in advance.

Valerio
 
Hi Valerio,

unluckily I don't know any further source
of python scripting than the manuals.
A good starting point is to try things in
CAE and figure out from the rpy-file how it
was realized in python.

You can find the faces as mentioned above
getting myPart.faces[i:i+1] for the ith face.
Define

set_seq = myPart.faces[i:i+1]

an then add the subsequent faces maybe in a loop
with

set_seq += myPart.faces[j:j+1].

After all faces are added to the sequence, you can
assign the set again with

set = myMdb.assembly.Set(name='test', faces=set_seq)

Maybe there is an easier solution but this should work
at least.

Good luck
Marco
 
Hi,

iwb you was right again.
In real I wrote my script watching the .py Abaqus macro obtained from the CAE, but sometimes I cannot get clear information, especially when I select objects (cells, faces, points etc.) during the operation. For example when I create a set of face in CAE, the relative rows in the script are:

p = mdb.models['Model-1'].parts['Lastra']
f = p.faces
faces = f.getSequenceFromMask(mask=('[#12 ]', ), )
p.Set(faces=faces, name='io')

In this case, what means 'mask=('[#12]',)??

Thanks
Valerio
 
Hi,

as far as i know, f.getSequenceFromMask(...) is a CAE intern
representation of some .findAT(...) commands. I was not
able to use this command properly but you can expose the
explicit commands in the rpy-file by typing

session.journalOptions.setValues(replayGeometry=COORDINATE,
recoverGeometry=COORDINATE)

in the python command line.

Have fun

Marco
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor