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 to meshing all parts 1

Status
Not open for further replies.

Guilherme Simonato

Automotive
Jun 26, 2019
3
Hello everyone,

I have 900 parts to meshing on Abaqus 2018. I need a help to write python script to meshing all parts with conditions.

The parts between the number 1 to 200 are a similar geometry, so I will use the same condition like global size, curvature control, size control and type of elements.
The parts between the number 201 to 400 are similar geometry too.

If help something I used macro recording to take this script (only mesh the part number 1)...

# -*- coding: mbcs -*-
# Do not delete the following import lines
from abaqus import *
from abaqusConstants import *
import __main__

def Meshing():
import section
import regionToolset
import displayGroupMdbToolset as dgm
import part
import material
import assembly
import step
import interaction
import load
import mesh
import optimization
import job
import sketch
import visualization
import xyPlot
import displayGroupOdbToolset as dgo
import connectorBehavior
p = mdb.models['Model-1'].parts['Autoclave Trolley-1']
c = p.cells
pickedRegions = c.getSequenceFromMask(mask=('[#3 ]', ), )
p.setMeshControls(regions=pickedRegions, technique=SWEEP)
p = mdb.models['Model-1'].parts['Autoclave Trolley-1']
p.seedPart(size=5.0, deviationFactor=0.1, minSizeFactor=0.1)
elemType1 = mesh.ElemType(elemCode=C3D8HS, elemLibrary=STANDARD)
elemType2 = mesh.ElemType(elemCode=C3D6, elemLibrary=STANDARD)
elemType3 = mesh.ElemType(elemCode=C3D4, elemLibrary=STANDARD)
p = mdb.models['Model-1'].parts['Autoclave Trolley-1']
c = p.cells
cells = c.getSequenceFromMask(mask=('[#3 ]', ), )
pickedRegions =(cells, )
p.setElementType(regions=pickedRegions, elemTypes=(elemType1, elemType2,
elemType3))
p = mdb.models['Model-1'].parts['Autoclave Trolley-1']
p.generateMesh()

How can a create a automatic script loop to meshing all parts?
I do not know how to use a loop or a loop with interval.
I am new on python script programing.

Many thanks!
 
Replies continue below

Recommended for you

In the Knowledge Base of Dassault/Simulia is an existing Plugin for such tasks.

QA00000023265: Abaqus/CAE plug-in to efficiently assign section properties, element types, and meshes to a large number of parts


If you want to use your script, then you just need to go to the part-container (a dictionary) and request the keys. This will create a list of parts that you can iterate through.

Here is a very simple example:
Code:
from abaqus import *
from abaqusConstants import *

for i in mdb.models['Model-1'].parts.keys():
	p = mdb.models['Model-1'].parts[i]
	p.seedPart(size=3.0, deviationFactor=0.1, minSizeFactor=0.1)
	p.generateMesh()
 
Hello Mustaine3,
Thanks for your reply and your help!

following your link I have error 404 "The page you are looking for has been moved"
I searched but not find anything about this.

Could explain better about to use the dictionary and request the keys.
I start learning python program on this week.

Many thanks!

 
I can reach the site. But I think I can attach the Plugin tomorrow afternoon.

I can't teach you Python and Abaqus Scripting here. For Python you will find many sources (and probably already have).
For Abaqus Scripting I recommend The Scripting Users section in the Abaqus documentation. It teaches the basics of the API and has also some examples.
 
Mr. Mustaine3 thank you so much.

This tool works fine to me following the tutorial, only need update scripts on Abaqus after copy the files to plug-ins folder.

This tool use explict, if someone need this tool on standard, just change the EXPLICT to STANDARD on pmeModel.py

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor