学习Abaqus/Python时,添加约束出现问题,如何解决?
浏览:1779 回答:5
问题描述:
#* TypeError: referencePoint; found 'AbaqusMethod', expecting a recognized type filling string dict
# -*- coding: mbcs -*- from abaqus import * from abaqusConstants import * from caeModules import * s = mdb.models['Model-1'].ConstrainedSketch(name='__profile__', sheetSize=2000.0) g, v, d, c = s.geometry, s.vertices, s.dimensions, s.constraints s.rectangle(point1=(-100.0, 10.0), point2=(100.0, -10.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.BaseShell(sketch=s) mdb.models['Model-1'].Material(name='Material-1', description='MATERIAL') mdb.models['Model-1'].materials['Material-1'].Density(table=((7.85e-09, ), )) mdb.models['Model-1'].materials['Material-1'].Elastic(table=((206000.0, 0.3), )) mdb.models['Model-1'].materials['Material-1'].Plastic(table=((235.0, 0.0), )) a = mdb.models['Model-1'].rootAssembly p = mdb.models['Model-1'].Part(name='Part-2', objectToCopy=mdb.models['Model-1'].parts['Part-1']) p = mdb.models['Model-1'].Part(name='Part-3', objectToCopy=mdb.models['Model-1'].parts['Part-2']) p = mdb.models['Model-1'].Part(name='Part-4', objectToCopy=mdb.models['Model-1'].parts['Part-3']) a.regenerate() a.Instance(name='Part-1-1', part=p, dependent=OFF) a.Instance(name='Part-2-1', part=p, dependent=OFF) a.Instance(name='Part-3-1', part=p, dependent=OFF) a.Instance(name='Part-4-1', part=p, dependent=OFF) a.rotate(instanceList=('Part-2-1', ), axisPoint=(0.0, 10.0, 0.0), axisDirection=(100.0, 0.0, 0.0), angle=-90.0) a.rotate(instanceList=('Part-3-1', ), axisPoint=(0.0, -10.0, 0.0), axisDirection=(100.0, 0.0, 0.0), angle=90.0) a.translate(instanceList=('Part-4-1', ), vector=(0.0, 0.0, 20.0)) mdb.models['Model-1'].StaticStep(name='Step-1', previous='Initial', initialInc=0.01, maxInc=0.05) mdb.models['Model-1'].FieldOutputRequest(name='F-Output-1', createStepName='Step-1', variables=('S', 'E', 'U')) mdb.models['Model-1'].HomogeneousShellSection(name='Section-1', material='Material-1', thickness=1.0) faces = mdb.models['Model-1'].parts['Part-1'].faces[0:1] region = regionToolset.Region(faces=faces) p = mdb.models['Model-1'].parts['Part-1'] p.SectionAssignment(region=region, sectionName='Section-1') faces = mdb.models['Model-1'].parts['Part-2'].faces[0:1] region = regionToolset.Region(faces=faces) p = mdb.models['Model-1'].parts['Part-2'] p.SectionAssignment(region=region, sectionName='Section-1') faces = mdb.models['Model-1'].parts['Part-3'].faces[0:1] region = regionToolset.Region(faces=faces) p = mdb.models['Model-1'].parts['Part-3'] p.SectionAssignment(region=region, sectionName='Section-1') faces = mdb.models['Model-1'].parts['Part-4'].faces[0:1] region = regionToolset.Region(faces=faces) p = mdb.models['Model-1'].parts['Part-4'] p.SectionAssignment(region=region, sectionName='Section-1') a.ReferencePoint(point=(-100.0, 0.0, 10.0)) r1 = a.ReferencePoint refPoints1=(r1 ) region1=regionToolset.Region(ReferencePoint=r1) a = mdb.models['Model-1'].rootAssembly e1 = a.instances['Part-1-1'].edges edges1 = e1.getSequenceFromMask(mask=('[#2 ]', ), ) v1 = a.instances['Part-1-1'].vertices verts1 = v1.getSequenceFromMask(mask=('[#6 ]', ), ) e2 = a.instances['Part-2-1'].edges edges2 = e2.getSequenceFromMask(mask=('[#8 ]', ), ) v2 = a.instances['Part-2-1'].vertices verts2 = v2.getSequenceFromMask(mask=('[#9 ]', ), ) e3 = a.instances['Part-3-1'].edges edges3 = e3.getSequenceFromMask(mask=('[#8 ]', ), ) v3 = a.instances['Part-3-1'].vertices verts3 = v3.getSequenceFromMask(mask=('[#9 ]', ), ) e4 = a.instances['Part-4-1'].edges edges4 = e4.getSequenceFromMask(mask=('[#8 ]', ), ) v4 = a.instances['Part-4-1'].vertices verts4 = v4.getSequenceFromMask(mask=('[#9 ]', ), ) r5 = a.referencePoints refPoints5=(r5) region2=regionToolset.Region(vertices=verts1+verts2+verts3+verts4, edges=edges1+edges2+edges3+edges4, referencePoints=refPoints5) mdb.models['Model-1'].MultipointConstraint(name='Constraint-1', controlPoint=region1, surface=region2, mpcType=BEAM_MPC, userMode=DOF_MODE_MPC, userType=0, csys=None)
请问该如何解决?
另外请问我现有的这段代码有没有可以精简的?