#!/usr/bin/env python
# encoding: utf-8
# 如果觉得不错,可以推荐给你的朋友!http://tool.lu/pyc
from abaqus import *
from abaqusConstants import *
def LabelName(index, root):
return root + str(index)
def Get_Cube_dimension(mdb, modelName, instanceName):
node = mdb.models[modelName].rootAssembly.instances[instanceName].nodes
Xmin = 9999
Xmax = -9999
Ymin = 9999
Ymax = -9999
Zmin = 9999
Zmax = -9999
for i in range(len(node)):
x = node[i].coordinates[0]
y = node[i].coordinates[1]
z = node[i].coordinates[2]
if Xmin > x:
Xmin = x
elif Xmax < x:
Xmax = x
if Ymin > y:
Ymin = y
elif Ymax < y:
Ymax = y
if Zmin > z:
Zmin = z
continue
if Zmax < z:
Zmax = z
continue
return (Xmin, Xmax, Ymin, Ymax, Zmin, Zmax)
def CreateSetCube(modelName, instanceName, Dimension):
Xmin = Dimension[0]
Xmax = Dimension[1]
Ymin = Dimension[2]
Ymax = Dimension[3]
Zmin = Dimension[4]
Zmax = Dimension[5]
eps1 = abs(Zmax - Zmin) * 0.0001
eps2 = abs(Zmax - Zmin) * 0.01
BX = Xmax - Xmin
BY = Ymax - Ymin
BZ = Zmax - Zmin
node = mdb.models[modelName].rootAssembly.instances[instanceName].nodes
node_E1 = node[1:1]
node_E2 = node[1:1]
node_E3 = node[1:1]
node_E4 = node[1:1]
node_E5 = node[1:1]
node_E6 = node[1:1]
node_E7 = node[1:1]
node_E8 = node[1:1]
node_E9 = node[1:1]
node_E10 = node[1:1]
node_E11 = node[1:1]
node_E12 = node[1:1]
node_FXP = node[1:1]
node_FXN = node[1:1]
node_FYP = node[1:1]
node_FYN = node[1:1]
node_FZP = node[1:1]
node_FZN = node[1:1]
for i in range(len(node)):
x = node[i].coordinates[0]
y = node[i].coordinates[1]
z = node[i].coordinates[2]
if abs(x - Xmin) < eps1 and abs(y - Ymin) < eps1 and abs(z - Zmin) < eps1:
node_v1 = node[i:i + 1]
continue
if abs(x - Xmax) < eps1 and abs(y - Ymin) < eps1 and abs(z - Zmin) < eps1:
node_v2 = node[i:i + 1]
continue
if abs(x - Xmax) < eps1 and abs(y - Ymax) < eps1 and abs(z - Zmin) < eps1:
node_v3 = node[i:i + 1]
continue
if abs(x - Xmin) < eps1 and abs(y - Ymax) < eps1 and abs(z - Zmin) < eps1:
node_v4 = node[i:i + 1]
continue
if abs(x - Xmin) < eps1 and abs(y - Ymin) < eps1 and abs(z - Zmax) < eps1:
node_v5 = node[i:i + 1]
continue
if abs(x - Xmax) < eps1 and abs(y - Ymin) < eps1 and abs(z - Zmax) < eps1:
node_v6 = node[i:i + 1]
continue
if abs(x - Xmax) < eps1 and abs(y - Ymax) < eps1 and abs(z - Zmax) < eps1:
node_v7 = node[i:i + 1]
continue
if abs(x - Xmin) < eps1 and abs(y - Ymax) < eps1 and abs(z - Zmax) < eps1:
node_v8 = node[i:i + 1]
continue
if abs(x - Xmin) < eps1 and abs(y - Ymin) < eps1 and abs(z - Zmin) > eps2 and abs(z - Zmax) > eps2:
node_E1 = node_E1 + node[i:i + 1]
continue
if abs(x - Xmax) < eps1 and abs(y - Ymin) < eps1 and abs(z - Zmin) > eps2 and abs(z - Zmax) > eps2:
node_E2 = node_E2 + node[i:i + 1]
continue
if abs(x - Xmax) < eps1 and abs(y - Ymax) < eps1 and abs(z - Zmin) > eps2 and abs(z - Zmax) > eps2:
node_E3 = node_E3 + node[i:i + 1]
continue
if abs(x - Xmin) < eps1 and abs(y - Ymax) < eps1 and abs(z - Zmin) > eps2 and abs(z - Zmax) > eps2:
node_E4 = node_E4 + node[i:i + 1]
continue
if abs(x - Xmin) < eps1 and abs(z - Zmin) < eps1 and abs(y - Ymin) > eps2 and abs(y - Ymax) > eps2:
node_E5 = node_E5 + node[i:i + 1]
continue
if abs(x - Xmax) < eps1 and abs(z - Zmin) < eps1 and abs(y - Ymin) > eps2 and abs(y - Ymax) > eps2:
node_E6 = node_E6 + node[i:i + 1]
continue
if abs(x - Xmax) < eps1 and abs(z - Zmax) < eps1 and abs(y - Ymin) > eps2 and abs(y - Ymax) > eps2:
node_E7 = node_E7 + node[i:i + 1]
continue
if abs(x - Xmin) < eps1 and abs(z - Zmax) < eps1 and abs(y - Ymin) > eps2 and abs(y - Ymax) > eps2:
node_E8 = node_E8 + node[i:i + 1]
continue
if abs(y - Ymin) < eps1 and abs(z - Zmin) < eps1 and abs(x - Xmin) > eps2 and abs(x - Xmax) > eps2:
node_E9 = node_E9 + node[i:i + 1]
continue
if abs(y - Ymax) < eps1 and abs(z - Zmin) < eps1 and abs(x - Xmin) > eps2 and abs(x - Xmax) > eps2:
node_E10 = node_E10 + node[i:i + 1]
continue
if abs(y - Ymax) < eps1 and abs(z - Zmax) < eps1 and abs(x - Xmin) > eps2 and abs(x - Xmax) > eps2:
node_E11 = node_E11 + node[i:i + 1]
continue
if abs(y - Ymin) < eps1 and abs(z - Zmax) < eps1 and abs(x - Xmin) > eps2 and abs(x - Xmax) > eps2:
node_E12 = node_E12 + node[i:i + 1]
continue
if abs(x - Xmax) < eps1 and abs(y - Ymin) > eps2 and abs(y - Ymax) > eps2 and abs(z - Zmin) > eps2 and abs(z - Zmax) > eps2:
node_FXP = node_FXP + node[i:i + 1]
continue
if abs(x - Xmin) < eps1 and abs(y - Ymin) > eps2 and abs(y - Ymax) > eps2 and abs(z - Zmin) > eps2 and abs(z - Zmax) > eps2:
node_FXN = node_FXN + node[i:i + 1]
continue
if abs(y - Ymax) < eps1 and abs(x - Xmin) > eps2 and abs(x - Xmax) > eps2 and abs(z - Zmin) > eps2 and abs(z - Zmax) > eps2:
node_FYP = node_FYP + node[i:i + 1]
continue
if abs(y - Ymin) < eps1 and abs(x - Xmin) > eps2 and abs(x - Xmax) > eps2 and abs(z - Zmin) > eps2 and abs(z - Zmax) > eps2:
node_FYN = node_FYN + node[i:i + 1]
continue
if abs(z - Zmax) < eps1 and abs(y - Ymin) > eps2 and abs(y - Ymax) > eps2 and abs(x - Xmin) > eps2 and abs(x - Xmax) > eps2:
node_FZP = node_FZP + node[i:i + 1]
continue
if abs(z - Zmin) < eps1 and abs(y - Ymin) > eps2 and abs(y - Ymax) > eps2 and abs(x - Xmin) > eps2 and abs(x - Xmax) > eps2:
node_FZN = node_FZN + node[i:i + 1]
continue
mdb.models[modelName].rootAssembly.Set(name = 'Master Node 1', nodes = node_v1)
mdb.models[modelName].rootAssembly.Set(name = 'Master Node 2', nodes = node_v2)
mdb.models[modelName].rootAssembly.Set(name = 'Master Node 3', nodes = node_v3)
mdb.models[modelName].rootAssembly.Set(name = 'Master Node 4', nodes = node_v4)
mdb.models[modelName].rootAssembly.Set(name = 'Master Node 5', nodes = node_v5)
mdb.models[modelName].rootAssembly.Set(name = 'Master Node 6', nodes = node_v6)
mdb.models[modelName].rootAssembly.Set(name = 'Master Node 7', nodes = node_v7)
mdb.models[modelName].rootAssembly.Set(name = 'Master Node 8', nodes = node_v8)
mdb.models[modelName].rootAssembly.Set(name = 'edge1 I', nodes = node_E1)
mdb.models[modelName].rootAssembly.Set(name = 'edge2 II', nodes = node_E2)
mdb.models[modelName].rootAssembly.Set(name = 'edge3 III', nodes = node_E3)
mdb.models[modelName].rootAssembly.Set(name = 'edge4 IV', nodes = node_E4)
mdb.models[modelName].rootAssembly.Set(name = 'edge5 V', nodes = node_E5)
mdb.models[modelName].rootAssembly.Set(name = 'edge6 VI', nodes = node_E6)
mdb.models[modelName].rootAssembly.Set(name = 'edge7 VII', nodes = node_E7)
mdb.models[modelName].rootAssembly.Set(name = 'edge8 VIII', nodes = node_E8)
mdb.models[modelName].rootAssembly.Set(name = 'edge9 IX', nodes = node_E9)
mdb.models[modelName].rootAssembly.Set(name = 'edg
- 1
- 2
前往页