a=mdb.models['new_write_data'].rootAssembly
a.SurfaceByBoolean(name='Surf-fault1', surfaces=(a.surfaces['Surf1-1'],
a.surfaces['Surf1-2'], a.surfaces['Surf1-3'], a.surfaces['Surf1-4'],
a.surfaces['Surf1-5'], a.surfaces['Surf1-6'], a.surfaces['Surf1-7'],
a.surfaces['Surf1-8'], a.surfaces['Surf1-9'], a.surfaces['Surf1-10'],
a.surfaces['Surf1-11'], a.surfaces['Surf1-12'], a.surfaces['Surf1-13'],
a.surfaces['Surf1-14'], a.surfaces['Surf1-15'], a.surfaces['Surf1-16'],
a.surfaces['Surf1-17'], a.surfaces['Surf1-18'], a.surfaces['Surf1-19'],
a.surfaces['Surf1-20'], a.surfaces['Surf1-21'], a.surfaces['Surf1-22'],
a.surfaces['Surf1-23'], a.surfaces['Surf1-24'], a.surfaces['Surf1-25'],
a.surfaces['Surf1-26'], a.surfaces['Surf1-27'], a.surfaces['Surf1-28'],
a.surfaces['Surf1-29'], a.surfaces['Surf1-30'], a.surfaces['Surf1-31'],
a.surfaces['Surf1-32'], a.surfaces['Surf1-33'], a.surfaces['Surf1-34'],
a.surfaces['Surf1-35'], a.surfaces['Surf1-36'], a.surfaces['Surf1-37'],
a.surfaces['Surf1-38'], a.surfaces['Surf1-39'], a.surfaces['Surf1-40'], ))
在Abaqus设置接触问题时候,需要设置Surface set,在CAE中如果可以直接通过鼠标选择那是极好的。但是在一些特殊情况,需要我们使用Pyhton进行二次开发时候,这个命令就比较友好。通过命令行可以看出,我们在设置Surface set时候,将面的名字进行了统一编码,这样为了方便使用For循环批量化处理,上面代码可以简化为:
def ele_faces_to_fault_face(a,all_fault_surf_name,L,n,model_name):
#后面在多断层的时候还需要修改合并后的Surf名字,比如,Surf-fault-name-str(n)
surf_set = ()
for i in range(0,L,1): #这个可以检验正确性,L是否等于all_fault_surf_name的长度
tmp = a.surfaces[all_fault_surf_name[i]]#必须是Tuple数据类型
surf_set = surf_set + (tmp,)
a=mdb.models[model_name].rootAssembly
a.SurfaceByBoolean(name='Surf-fault'+str(n),surfaces=surf_set)