从未打开过Abaqus开始的二次开发。参考书籍《Abaqus Python二次开发攻略》,书里写的很详细。
初始rpy文件
# -*- coding: mbcs -*-
#
# Abaqus/CAE Release 2020 replay file
# Internal Version: 2019_09_14-01.49.31 163176
# Run by Administrator on Thu May 19 11:05:34 2022
#
# from driverUtils import executeOnCaeGraphicsStartup
# executeOnCaeGraphicsStartup()
#: Executing "onCaeGraphicsStartup()" in the site directory ...
from abaqus import *
from abaqusConstants import *
session.Viewport(name='Viewport: 1', origin=(0.0, 0.0), width=250.050506591797,
height=145.686111450195)
session.viewports['Viewport: 1'].makeCurrent()
session.viewports['Viewport: 1'].maximize()
from caeModules import *
from driverUtils import executeOnCaeStartup
executeOnCaeStartup()
session.viewports['Viewport: 1'].partDisplay.geometryOptions.setValues(
referenceRepresentation=ON)
4个import导入必要的模块;
其余行生成Viewport:1用于显示。
GUI操作,建立一个边长10的正方体作为基体
s = mdb.models['Model-1'].ConstrainedSketch(name='__profile__',
sheetSize=200.0)
g, v, d, c = s.geometry, s.vertices, s.dimensions, s.constraints
s.setPrimaryObject(option=STANDALONE)
s.rectangle(point1=(0.0, 0.0), point2=(10.0, 10.0))
p = mdb.models['Model-1'].Part(name='MATRIX', dimensionality=THREE_D,
type=DEFORMABLE_BODY)
p = mdb.models['Model-1'].parts['MATRIX']
p.BaseSolidExtrude(sketch=s, depth=10.0)
s.unsetPrimaryObject()
p = mdb.models['Model-1'].parts['MATRIX']
session.viewports['Viewport: 1'].setValues(displayedObject=p)
del mdb.models['Model-1'].sketches['__profile__']
前5行建立草图对象s;
6-10行使用草图s生成Solid部件p;
最后两行书上没说,但看意思大概就是设定一下当前显示对象,然后删掉草图。可以看到,草图对象是在mdb.models仓库里的。
GUI操作,创建纤维,其实就是在方体一个面上画圆,后期算法主要针对这里的圆圈生成
p = mdb.models['Model-1'].parts['MATRIX']
f, e = p.faces, p.edges
t = p.MakeSketchTransform(sketchPlane=f[4], sketchUpEdge=e[7],
sketchPlaneSide=SIDE1, sketchOrientation=RIGHT, origin=(5.0, 5.0, 10.0))
s1 = mdb.models['Model-1'].ConstrainedSketch(name='__profile__',
sheetSize=34.64, gridSpacing=0.86, transform=t)
g, v, d, c = s1.geometry, s1.vertices, s1.dimensions, s1.constraints
s1.setPrimaryObject(option=SUPERIMPOSE)
p = mdb.models['Model-1'].parts['MATRIX']
p.projectReferencesOntoSketch(sketch=s1, filter=COPLANAR_EDGES)
s1.CircleByCenterPerimeter(center=(0.0, 0.0), point1=(1.72, 0.0))
p = mdb.models['Model-1'].parts['MATRIX']
f1, e1 = p.faces, p.edges
p.SolidExtrude(sketchPlane=f1[4], sketchUpEdge=e1[7], sketchPlaneSide=SIDE1,
sketchOrientation=RIGHT, sketch=s1, depth=10.0, flipExtrudeDirection=ON,
keepInternalBoundaries=ON)
s1.unsetPrimaryObject()
del mdb.models['Model-1'].sketches['__profile__']
GUI操作,分别为基体和纤维创建材料属性,FIBER属性与MATRIX类似
session.viewports['Viewport: 1'].partDisplay.setValues(sectionAssignments=ON,
engineeringFeatures=ON)
session.viewports['Viewport: 1'].partDisplay.geometryOptions.setValues(
referenceRepresentation=OFF)
mdb.models['Model-1'].Material(name='MATRIX')
mdb.models['Model-1'].materials['MATRIX'].Elastic(table=((7000.0, 0.38), ))
mdb.models['Model-1'].Material(name='FIBER')
mdb.models['Model-1'].materials['FIBER'].Elastic(table=((220000.0, 0.2), ))
为纤维和基体创建两个截面,并赋予
mdb.models['Model-1'].HomogeneousSolidSection(name='FIBER-SEC',
material='FIBER', thickness=None)
mdb.models['Model-1'].HomogeneousSolidSection(name='MATRIX-SET',
material='MATRIX', thickness=None)
p = mdb.models['Model-1'].parts['MATRIX']
c = p.cells
cells = c.getSequenceFromMask(mask=('[#1 ]', ), )
region = p.Set(cells=cells, name='Set-1')
p = mdb.models['Model-1'].parts['MATRIX']
p.SectionAssignment(region=region, sectionName='FIBER-SEC', offset=0.0,
offsetType=MIDDLE_SURFACE, offsetField='',
thicknessAssignment=FROM_SECTION)
p = mdb.models['Model-1'].parts['MATRIX']
c = p.cells
cells = c.getSequenceFromMask(mask=('[#2 ]', ), )
region = p.Set(cells=cells, name='Set-2')
p = mdb.models['Model-1'].parts['MATRIX']
p.SectionAssignment(region=region, sectionName='MATRIX-SET', offset=0.0,
offsetType=MIDDLE_SURFACE, offsetField='',
thicknessAssignment=FROM_SECTION)
a = mdb.models['Model-1'].rootAssembly
session.viewports['Viewport: 1'].setValues(displayedObject=a)
session.viewports['Viewport: 1'].assemblyDisplay.setValues(
optimizationTasks=OFF
免责声明:本文系网络转载或改编,未找到原创作者,版权归原作者所有。如涉及版权,请联系删