在abaqus中利用python语言建模例子
3.1?Creating a part
The first example shows how you can use an Abaqus/CAE script to replicate the functionality of Abaqus/CAE. The script does the following:
Creates a new model in the model database.
Creates a two-dimensional sketch.
Creates a three-dimensional, deformable part.
Extrudes the two-dimensional sketch to create the first geometric feature of the part.
Creates a new viewport.
Displays a shaded image of the new part in the new viewport.
The new viewport and the shaded part are shown in Figure 3–1.
Figure 3–1 The example creates a new viewport and a part.
The example scripts from this manual can be copied to the user's working directory by using the Abaqus fetch utility:
abaqus fetch job=scriptName
where scriptName.py is the name of the script (see “Execution procedure for fetching sample input files,” Section 3.2.12 of the Abaqus Analysis User's Manual). Use the following command to retrieve the script for this example:
abaqus fetch job=modelAExample
Note:? Abaqus does not install the sample scripts by default during the installation procedure. As a result, if the Abaqus fetch utility fails to find the sample script, the script may be missing from your Abaqus installation. You must rerun the installation procedure and request Abaqus sample problems from the list of items to install.
To run the program, do the following:
Start Abaqus/CAE by typing abaqus cae.
From the startup screen, select Run Script.
From the Run Script dialog box that appears, select modelAExample.py.
Click OK to run the script.
Note:? If Abaqus/CAE is already running, you can run the script by selecting FileRun Script from the main menu bar.
3.1.1?The example script
"""
modelAExample.py
A simple example: Creating a part.
"""
from abaqus import *
import testUtils
testUtils.setBackwardCompatibility()
from abaqusConstants import *
import sketch
import part
myModel = mdb.Model(name='Model A')
mySketch = myModel.ConstrainedSketch(name='Sketch A', sheetSize=200.0)
xyCoordsInner = ((-5