262 lines
4.5 KiB
Python
262 lines
4.5 KiB
Python
|
# 3D PCBs - JGrogan - V1.0
|
||
|
# V1.0 - Ceated: 18-02-12
|
||
|
from abaqus import *
|
||
|
from abaqusConstants import *
|
||
|
#
|
||
|
# Define Tolerance for Node Matching:
|
||
|
Toler = 0.0001
|
||
|
#
|
||
|
zModel=mdb.models['Model-1']
|
||
|
zAssembly=zModel.rootAssembly
|
||
|
#
|
||
|
# Constraints
|
||
|
for j in range(0,3):
|
||
|
if j == 0:
|
||
|
Name1='FaceBottom'
|
||
|
Name2='FaceTop'
|
||
|
Coeff11=1.
|
||
|
Coeff12=-1.
|
||
|
Coeff13=0.
|
||
|
Coeff21=1. #
|
||
|
Coeff22=-1.
|
||
|
Coeff23=-1.
|
||
|
Coeff31=1. #
|
||
|
Coeff32=-1.
|
||
|
Coeff33=0.
|
||
|
elif j == 1:
|
||
|
Name1='FaceFront'
|
||
|
Name2='FaceRear'
|
||
|
Coeff11=1.
|
||
|
Coeff12=-1.
|
||
|
Coeff13=-1.
|
||
|
Coeff21=1. #
|
||
|
Coeff22=-1.
|
||
|
Coeff23=0.
|
||
|
Coeff31=1. #
|
||
|
Coeff32=-1.
|
||
|
Coeff33=0.
|
||
|
elif j == 2:
|
||
|
Name1='FaceLeft'
|
||
|
Name2='FaceRight'
|
||
|
Coeff11=1.
|
||
|
Coeff12=-1.
|
||
|
Coeff13=0.
|
||
|
Coeff21=1. #
|
||
|
Coeff22=-1.
|
||
|
Coeff23=0.
|
||
|
Coeff31=1. #
|
||
|
Coeff32=-1.
|
||
|
Coeff33=-1.
|
||
|
elif j == 3:
|
||
|
Name1='EdgeCC1'
|
||
|
Name2='EdgeBB1'
|
||
|
Coeff11=1.
|
||
|
Coeff12=-1.
|
||
|
Coeff13=0.
|
||
|
Coeff21=1. #
|
||
|
Coeff22=-1.
|
||
|
Coeff23=0.
|
||
|
Coeff31=1. #
|
||
|
Coeff32=-1.
|
||
|
Coeff33=1.
|
||
|
elif j == 4:
|
||
|
Name1='EdgeBB1'
|
||
|
Name2='EdgeAA1'
|
||
|
Coeff11=1.
|
||
|
Coeff12=-1.
|
||
|
Coeff13=-1.
|
||
|
Coeff21=1. #
|
||
|
Coeff22=-1.
|
||
|
Coeff23=0.
|
||
|
Coeff31=1. #
|
||
|
Coeff32=-1.
|
||
|
Coeff33=0.
|
||
|
elif j == 5:
|
||
|
Name1='EdgeAA1'
|
||
|
Name2='EdgeDD1'
|
||
|
Coeff11=1.
|
||
|
Coeff12=-1.
|
||
|
Coeff13=0.
|
||
|
Coeff21=1. #
|
||
|
Coeff22=-1.
|
||
|
Coeff23=0.
|
||
|
Coeff31=1. #
|
||
|
Coeff32=-1.
|
||
|
Coeff33=-1.
|
||
|
elif j == 6:
|
||
|
Name1='EdgeCD'
|
||
|
Name2='EdgeAB'
|
||
|
Coeff11=1.
|
||
|
Coeff12=-1.
|
||
|
Coeff13=0.
|
||
|
Coeff21=1. #
|
||
|
Coeff22=-1.
|
||
|
Coeff23=0.
|
||
|
Coeff31=1. #
|
||
|
Coeff32=-1.
|
||
|
Coeff33=1.
|
||
|
elif j == 6:
|
||
|
Name1='EdgeAB'
|
||
|
Name2='EdgeA1B1'
|
||
|
Coeff11=-1.
|
||
|
Coeff12=1.
|
||
|
Coeff13=0.
|
||
|
Coeff21=-1. #
|
||
|
Coeff22=1.
|
||
|
Coeff23=-1.
|
||
|
Coeff31=-1. #
|
||
|
Coeff32=-1.
|
||
|
Coeff33=0.
|
||
|
elif j == 7:
|
||
|
Name1='EdgeA1B1'
|
||
|
Name2='EdgeC1D1'
|
||
|
Coeff11=1.
|
||
|
Coeff12=-1.
|
||
|
Coeff13=0.
|
||
|
Coeff21=1. #
|
||
|
Coeff22=-1.
|
||
|
Coeff23=0.
|
||
|
Coeff31=1. #
|
||
|
Coeff32=-1.
|
||
|
Coeff33=-1.
|
||
|
elif j == 7:
|
||
|
Name1='EdgeAD'
|
||
|
Name2='EdgeBC'
|
||
|
Coeff11=-1.
|
||
|
Coeff12=1.
|
||
|
Coeff13=-1.
|
||
|
Coeff21=-1. #
|
||
|
Coeff22=1.
|
||
|
Coeff23=0.
|
||
|
Coeff31=1. #
|
||
|
Coeff32=-1.
|
||
|
Coeff33=0.
|
||
|
elif j == 8:
|
||
|
Name1='EdgeBC'
|
||
|
Name2='EdgeB1C1'
|
||
|
Coeff11=-1.
|
||
|
Coeff12=1.
|
||
|
Coeff13=0.
|
||
|
Coeff21=-1. #
|
||
|
Coeff22=1.
|
||
|
Coeff23=-1.
|
||
|
Coeff31=1. #
|
||
|
Coeff32=-1.
|
||
|
Coeff33=0.
|
||
|
elif j == 8:
|
||
|
Name1='EdgeB1C1'
|
||
|
Name2='EdgeA1D1'
|
||
|
Coeff11=1.
|
||
|
Coeff12=-1.
|
||
|
Coeff13=-1.
|
||
|
Coeff21=1. #
|
||
|
Coeff22=-1.
|
||
|
Coeff23=0.
|
||
|
Coeff31=1. #
|
||
|
Coeff32=-1.
|
||
|
Coeff33=0.
|
||
|
elif j == 9:
|
||
|
Name1='B'
|
||
|
Name2='C'
|
||
|
Coeff11=1.
|
||
|
Coeff12=-1.
|
||
|
Coeff13=0.
|
||
|
Coeff21=1. #
|
||
|
Coeff22=-1.
|
||
|
Coeff23=0.
|
||
|
Coeff31=1. #
|
||
|
Coeff32=-1.
|
||
|
Coeff33=-1.
|
||
|
elif j == 10:
|
||
|
Name1='A'
|
||
|
Name2='D'
|
||
|
Coeff11=1.
|
||
|
Coeff12=-1.
|
||
|
Coeff13=0.
|
||
|
Coeff21=-1. #
|
||
|
Coeff22=1.
|
||
|
Coeff23=0.
|
||
|
Coeff31=1. #
|
||
|
Coeff32=-1.
|
||
|
Coeff33=-1.
|
||
|
elif j == 11:
|
||
|
Name1='C'
|
||
|
Name2='C1'
|
||
|
Coeff11=1.
|
||
|
Coeff12=-1.
|
||
|
Coeff13=0.
|
||
|
Coeff21=1. #
|
||
|
Coeff22=-1.
|
||
|
Coeff23=1.
|
||
|
Coeff31=1. #
|
||
|
Coeff32=-1.
|
||
|
Coeff33=-0.
|
||
|
elif j == 12:
|
||
|
Name1='D'
|
||
|
Name2='D1'
|
||
|
Coeff11=1.
|
||
|
Coeff12=-1.
|
||
|
Coeff13=0.
|
||
|
Coeff21=1. #
|
||
|
Coeff22=-1.
|
||
|
Coeff23=1.
|
||
|
Coeff31=1. #
|
||
|
Coeff32=-1.
|
||
|
Coeff33=-0.
|
||
|
elif j == 13:
|
||
|
Name1='C1'
|
||
|
Name2='B1'
|
||
|
Coeff11=1.
|
||
|
Coeff12=-1.
|
||
|
Coeff13=0.
|
||
|
Coeff21=1. #
|
||
|
Coeff22=-1.
|
||
|
Coeff23=0.
|
||
|
Coeff31=1. #
|
||
|
Coeff32=-1.
|
||
|
Coeff33=1.
|
||
|
elif j == 14:
|
||
|
Name1='D1'
|
||
|
Name2='A1'
|
||
|
Coeff11=1.
|
||
|
Coeff12=-1.
|
||
|
Coeff13=0.
|
||
|
Coeff21=1. #
|
||
|
Coeff22=-1.
|
||
|
Coeff23=0.
|
||
|
Coeff31=1. #
|
||
|
Coeff32=-1.
|
||
|
Coeff33=1.
|
||
|
elif j == 15:
|
||
|
Name1='A1'
|
||
|
Name2='B1'
|
||
|
Coeff11=-1.
|
||
|
Coeff12=1.
|
||
|
Coeff13=-1.
|
||
|
Coeff21=-1. #
|
||
|
Coeff22=-1.
|
||
|
Coeff23=0.
|
||
|
Coeff31=1. #
|
||
|
Coeff32=-1.
|
||
|
Coeff33=0.
|
||
|
i=1
|
||
|
entity1=zAssembly.sets[Name1].nodes
|
||
|
entity2=zAssembly.sets[Name2].nodes
|
||
|
for eachNode1 in entity1:
|
||
|
cor1x=eachNode1.coordinates[0]
|
||
|
cor1y=eachNode1.coordinates[1]
|
||
|
cor1z=eachNode1.coordinates[2]
|
||
|
for eachNode2 in entity2:
|
||
|
distx=abs(cor1x-eachNode2.coordinates[0])
|
||
|
disty=abs(cor1y-eachNode2.coordinates[1])
|
||
|
distz=abs(cor1z-eachNode2.coordinates[2])
|
||
|
if (distx<Toler and disty<Toler)or(disty<Toler and distz<Toler)or(distx<Toler and distz<Toler) :
|
||
|
Node1=entity1.sequenceFromLabels(labels=(eachNode1.label,))
|
||
|
Node2=entity2.sequenceFromLabels(labels=(eachNode2.label,))
|
||
|
ZAssembly.Set(name=Name1+str(i),nodes=Node1)
|
||
|
ZAssembly.Set(name=Name2+str(i),nodes=Node2)
|
||
|
ZModel.Equation(name=Name1+Name2+'1'+str(i),terms=((Coeff11,Name1+str(i),1),(Coeff12,Name2+str(i),1),(Coeff13,'Dummy',1)))
|
||
|
ZModel.Equation(name=Name1+Name2+'2'+str(i),terms=((Coeff21,Name1+str(i),2),(Coeff22,Name2+str(i),2),(Coeff23,'Dummy',2)))
|
||
|
ZModel.Equation(name=Name1+Name2+'3'+str(i),terms=((Coeff31,Name1+str(i),3),(Coeff32,Name2+str(i),3),(Coeff33,'Dummy',3)))
|
||
|
i=i+1
|