当前位置:服务支持 >  软件文章 >  Abaqus参数化建模脚本实例详解

Abaqus参数化建模脚本实例详解

阅读数 8
点赞 0
article_banner

工作需要经常在三维软件中建立叶片模型导入abaqus计算,不胜其烦,于是尝试用Python编写一个脚本。

#!/usr/bin/python

#-*-coding:UTF-8-*-

from abaqus import *

from abaqusConstants import *

from caeModules import *

from driverUtils import executeOnCaeStartup

executeOnCaeStartup()

Mdb()

mdb.models.changeKey(fromName='Model-1', toName='Blade')

profileName=('profileT-T','profileA-A','profileB-B','profileC-C','profileD-D','profileE-E','profileF-F',

'profileG-G','profileH-H','profileJ-J','profileK-K')

sectionName=('sectionT-T','sectionA-A','sectionB-B','sectionC-C','sectionD-D','sectionE-E','sectionF-F',

'sectionG-G','sectionH-H','sectionJ-J','sectionK-K')

sectionHeight=(523.75,530,542.48,587.48,632.48,677.48,722.48,767.48,812.48,857.48,902.48)

setingAngle=30

sectionAngle=(-0.4269,0,0.8386,2.9231,5.8331,8.7544,11.7169,14.6364,17.4819,20.3272,22.6569)

transformVector=((-54.687,-7.691),(-54.712,-7.595),(-54.761,-7.403),(-54.891,-6.902),(-54.992,-6.248),

(-55.093,-5.749),(-55.241,-5.374),(-55.448,-5.028),(-55.613,-4.679),(-55.783,-4.330),(-55.953,-3.981))

pp=( ( 0.000, 2.561),( 0.500, 1.691),( 1.000, 1.341),( 1.500, 1.101),( 2.000, 0.913),( 2.500, 0.789),此处省略数据)

bladeLength=(125.131,125.231,125.219,125.225,125.215,125.213,125.213,125.213,125.200,125.177,125.230)

for i in range(len(profileName)):

s = mdb.models['Blade'].ConstrainedSketch(name=profileName[i], sheetSize=400.0)

g, v, d, c = s.geometry, s.vertices, s.dimensions, s.constraints

s.setPrimaryObject(option=STANDALONE)

yj=pp[72*2*i:72*2*i+72]

yr=pp[72*2*i+72:72*2*i+144]

s.Spline(points=(yj))

s.Spline(points=(yr))

s.ConstructionLine(point1=(0.0, 0.0), point2=(0.0,1.0))

s.ConstructionLine(point1=(bladeLength[i], 0.0), point2=(bladeLength[i],1.0))

s.FixedConstraint(entity=g[2])

s.FixedConstraint(entity=g[3])

s.FixedConstraint(entity=g[4])

s.FixedConstraint(entity=g[5])

#circleCenter=((yj[len(yj)-1][0]+yr[len(yr)-1][0])/2,(yj[len(yj)-1][1]+yr[len(yr)-1][1])/2)

s.ArcByCenterEnds(center=(124.66325378418, 0.564650535583496), point1=yj[len(yj)-1], point2=yr[len(yr)-1], direction=COUNTERCLOCKWISE)

s.CoincidentConstraint(entity1=v[143], entity2=g[3], addUndoState=False)

s.TangentConstraint(entity1=g[6], entity2=g[5])

print profileName[i],'has been created'

session.viewports['Viewport: 1'].partDisplay.geometryOptions.setValues(

    referenceRepresentation=ON)

p = mdb.models['Blade'].Part(name='blade', dimensionality=THREE_D, 

    type=DEFORMABLE_BODY)

p.ReferencePoint(point=(0.0, 0.0, 0.0))

p = mdb.models['Blade'].parts['blade']

p.DatumPlaneByPrincipalPlane(principalPlane=XYPLANE, offset=523.75)

p.DatumPlaneByPrincipalPlane(principalPlane=XYPLANE, offset=530.0)

p.DatumPlaneByPrincipalPlane(principalPlane=XYPLANE, offset=542.8)

p.DatumPlaneByPrincipalPlane(principalPlane=XYPLANE, offset=587.48)

p.DatumPlaneByPrincipalPlane(principalPlane=XYPLANE, offset=632.48)

p.DatumPlaneByPrincipalPlane(principalPlane=XYPLANE, offset=677.48)

p.DatumPlaneByPrincipalPlane(principalPlane=XYPLANE, offset=722.48)

p.DatumPlaneByPrincipalPlane(principalPlane=XYPLANE, offset=767.48)

p.DatumPlaneByPrincipalPlane(principalPlane=XYPLANE, offset=812.48)

p.DatumPlaneByPrincipalPlane(principalPlane=XYPLANE, offset=857.48)

p.DatumPlaneByPrincipalPlane(principalPlane=XYPLANE, offset=902.48)

p.DatumAxisByPrincipalAxis(principalAxis=YAXIS)

for i in range(len(sectionName)):

p = mdb.models['Blade'].parts['blade']

e1, d2 = p.edges, p.datums

t = p.MakeSketchTransform(sketchPlane=d2[i+2], sketchUpEdge=d2[13], 

sketchPlaneSide=SIDE1, sketchOrientation=LEFT, origin=(0.0, 0.0, sectionHeight[i]))

s = mdb.models['Blade'].ConstrainedSketch(name='__profile__', 

sheetSize=400, gridSpacing=10, transform=t)

g, v, d, c = s.geometry, s.vertices, s.dimensions, s.constraints

s.setPrimaryObject(option=SUPERIMPOSE)

p = mdb.models['Blade'].parts['blade']

p.projectReferencesOntoSketch(sketch=s, filter=COPLANAR_EDGES)

s.retrieveSketch(sketch=mdb.models['Blade'].sketches[profileName[i]])

session.viewports['Viewport: 1'].view.fitView()

s.move(vector=transformVector[i], objectList=(g[5], g[6], g[7], g[8], g[9]))

s.rotate(centerPoint=(0.0, 0.0), angle=sectionAngle[i]+setingAngle, objectList=(g[5], g[6], g[7], g[8], g[9]))

p = mdb.models['Blade'].parts['blade']

e, d1 = p.edges, p.datums

p.Wire(sketchPlane=d1[i+2], sketchUpEdge=d1[13], sketchPlaneSide=SIDE1, 

sketchOrientation=LEFT, sketch=s)

s.unsetPrimaryObject()

del mdb.models['Blade'].sketches['__profile__']

print sectionName[i],'has been created.'

p = mdb.models['Blade'].parts['blade']

e = p.edges

p.SolidLoft(loftsections=((e[15], e[16], e[17]), (e[12], e[13], e[14]), (e[18], 

    e[19], e[20]), (e[9], e[10], e[11]), (e[21], e[22], e[23]), (e[6], e[7], 

    e[8]), (e[24], e[25], e[26]), (e[3], e[4], e[5]), (e[27], e[28], e[29]), (

    e[0], e[1], e[2]), (e[30], e[31], e[32])), startCondition=NONE, 

    endCondition=NONE)

session.viewports['Viewport: 1'].setValues(displayedObject=p)

print('''Three-dimensional model of blade has been created.

Check your model please!

Copyright: WXS''')

这个程序还不完善,还有很多改进的地方,最终建立的模型如下


整个建模的思路类似在UG中的操作,最后形成体采用loft命令。个人感觉Abaqus没有像APDL中的Select功能是一项遗憾,findAt函数不太好使。

abaqus不能像ANSYS直接建三维点,建模过程需要要建很多基准面,感觉对待有的三维模型会比较麻烦。



转自公众号——ABAQUS大世界

旨在分享,若侵即删.


免责声明:本文系网络转载或改编,未找到原创作者,版权归原作者所有。如涉及版权,请联系删
相关文章
QR Code
微信扫一扫,欢迎咨询~

联系我们
武汉格发信息技术有限公司
湖北省武汉市经开区科技园西路6号103孵化器
电话:155-2731-8020 座机:027-59821821
邮件:tanzw@gofarlic.com
Copyright © 2023 Gofarsoft Co.,Ltd. 保留所有权利
遇到许可问题?该如何解决!?
评估许可证实际采购量? 
不清楚软件许可证使用数据? 
收到软件厂商律师函!?  
想要少购买点许可证,节省费用? 
收到软件厂商侵权通告!?  
有正版license,但许可证不够用,需要新购? 
联系方式 155-2731-8020
预留信息,一起解决您的问题
* 姓名:
* 手机:

* 公司名称:

姓名不为空

手机不正确

公司不为空