1.打开ABAQUS-->>part
然后画好一个立方体
如图
2.划分网格
先后点击我框住的那个东西 划分网格 最后得到
4.这是最重要的一步
点击菜单栏上的网格--创建网格部件
5.到属性里面添加材料
按照下面的顺序
当你点到第三个指派截面的时候 看
这时就可以选择你的材料了,但是要注意,你这是只是对整个立方体的一个小格子进行材料的设置,还有很多你没有设置,所以你得一个一个选择才可以
最好的方法是在你的生成的脚本里面修改。
代码如下:(你要先找到对应的修改代码的部分)
找到下面的代码
p = mdb.models['Model-1'].parts['Part-1-mesh-1'] e = p.elements elements = e.getSequenceFromMask(mask=('[#0:3 #8 ]', ), ) region = p.Set(elements=elements, name='Set-1') p = mdb.models['Model-1'].parts['Part-1-mesh-1'] p.SectionAssignment(region=region, sectionName='Section-1', offset=0.0, offsetType=MIDDLE_SURFACE, offsetField='', thicknessAssignment=FROM_SECTION)修改为
p = mdb.models['Model-1'].parts['Part-1-mesh-1'] e = p.elements len(e) n1=len(e) mat="Set" for i in range(1,8):#这里我对前8个都修改了 elements=e[i-1:i]#这里选定的是当前的单元格 settionname=mat+str(i)#设置材料名 p.Set(elements=elements,name=settionname) region = p.Set(elements=elements, name=settionname) p = mdb.models['Model-1'].parts['Part-1-mesh-1'] p.SectionAssignment(region=region, sectionName='Section-1', offset=0.0, offsetType=MIDDLE_SURFACE, offsetField='', thicknessAssignment=FROM_SECTION)
或者你直接用我的脚本 完整的
# -*- coding: mbcs -*- # # Abaqus/CAE Release 6.12-1 replay file # Internal Version: 2012_03_13-20.23.18 119612 # Run by Alex on Sat May 07 17:07:22 2016 # # 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=264.805725097656, height=270.227783203125) 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) 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=(55.0, 5.0)) p = mdb.models['Model-1'].Part(name='Part-1', dimensionality=THREE_D, type=DEFORMABLE_BODY) p = mdb.models['Model-1'].parts['Part-1'] p.BaseSolidExtrude(sketch=s, depth=5.0) s.unsetPrimaryObject() p = mdb.models['Model-1'].parts['Part-1'] session.viewports['Viewport: 1'].setValues(displayedObject=p) del mdb.models['Model-1'].sketches['__profile__'] session.viewports['Viewport: 1'].view.setValues(nearPlane=98.7834, farPlane=144.088, width=53.2673, height=27.6587, viewOffsetX=2.08857, viewOffsetY=-1.13423) session.viewports['Viewport: 1'].partDisplay.setValues(mesh=ON) session.viewports['Viewport: 1'].partDisplay.meshOptions.setValues( meshTechnique=ON) session.viewports['Viewport: 1'].partDisplay.geometryOptions.setValues( referenceRepresentation=OFF) p = mdb.models['Model-1'].parts['Part-1'] p.seedPart(size=5.0, deviationFactor=0.1, minSizeFactor=0.1) p = mdb.models['Model-1'].parts['Part-1'] p.generateMesh() p = mdb.models['Model-1'].parts['Part-1'] p.PartFromMesh(name='Part-1-mesh-1', copySets=True) p1 = mdb.models['Model-1'].parts['Part-1-mesh-1'] session.viewports['Viewport: 1'].setValues(displayedObject=p1) session.viewports['Viewport: 1'].partDisplay.setValues(sectionAssignments=ON, engineeringFeatures=ON, mesh=OFF) session.viewports['Viewport: 1'].partDisplay.meshOptions.setValues( meshTechnique=OFF) mdb.models['Model-1'].Material(name='Material-1') mdb.models['Model-1'].materials['Material-1'].Elastic(table=((99999.0, 0.33), )) mdb.models['Model-1'].HomogeneousSolidSection(name='Section-1', material='Material-1', thickness=None) p = mdb.models['Model-1'].parts['Part-1-mesh-1'] e = p.elements len(e) n1=len(e)+1 for i in range(1,n1): elements=e[i-1:i] settionname="mat"+str(i) p.Set(elements=elements,name=settionname) region = p.Set(elements=elements, name=settionname) p = mdb.models['Model-1'].parts['Part-1-mesh-1'] p.SectionAssignment(region=region, sectionName='Section-1', offset=0.0, offsetType=MIDDLE_SURFACE, offsetField='', thicknessAssignment=FROM_SECTION) mdb.saveAs(pathName='C:/Temp/beam') #: Ä£ÐÍÊý¾Ý¿âÒѱ£´æµ½ "C:\Temp\beam.cae".
然后用ABAQUS 运行脚本就好了 祝你好运