215 lines
8.6 KiB
Python
215 lines
8.6 KiB
Python
|
# 3D PCBs - JGrogan - V1.0
|
||
|
# V1.0 - Ceated: 18-02-12
|
||
|
from abaqus import *
|
||
|
from abaqusConstants import *
|
||
|
#
|
||
|
zModel=mdb.models['Model-1']
|
||
|
zAssembly=zModel.rootAssembly
|
||
|
zInstance=zAssembly.instances['Part-1-1']
|
||
|
#
|
||
|
# Enter Node Selection Tolerance and a 'Big' Number
|
||
|
Toler=1.e-6
|
||
|
BigNum=1.e6
|
||
|
# Characterize Part
|
||
|
XMax=-BigNum
|
||
|
YMax=-BigNum
|
||
|
ZMax=-BigNum
|
||
|
XMin=BigNum
|
||
|
YMin=BigNum
|
||
|
ZMin=BigNum
|
||
|
for eachNode in zInstance.nodes:
|
||
|
XCor=eachNode.coordinates[0]
|
||
|
YCor=eachNode.coordinates[1]
|
||
|
ZCor=eachNode.coordinates[2]
|
||
|
if XCor>XMax:
|
||
|
XMax=XCor
|
||
|
elif XCor<XMin:
|
||
|
XMin=XCor
|
||
|
if YCor>YMax:
|
||
|
YMax=YCor
|
||
|
elif YCor<YMin:
|
||
|
YMin=YCor
|
||
|
if ZCor>ZMax:
|
||
|
ZMax=ZCor
|
||
|
elif ZCor<ZMin:
|
||
|
ZMin=ZCor
|
||
|
#
|
||
|
# Distribute Nodes into Sets
|
||
|
for eachNode in zInstance.nodes:
|
||
|
XCor=eachNode.coordinates[0]
|
||
|
YCor=eachNode.coordinates[1]
|
||
|
ZCor=eachNode.coordinates[2]
|
||
|
# Front Face, Edges and Nodes
|
||
|
if(XCor<XMax+Toler)and(XCor>XMax-Toler):
|
||
|
if(YCor<YMax+Toler)and(YCor>YMax-Toler):
|
||
|
if(ZCor<ZMax+Toler)and(ZCor>ZMax-Toler):
|
||
|
Node=zInstance.nodes.sequenceFromLabels(labels=(eachNode.label,))
|
||
|
zAssembly.Set(name='B',nodes=Node)
|
||
|
elif(ZCor<ZMin+Toler)and(ZCor>ZMin-Toler):
|
||
|
Node=zInstance.nodes.sequenceFromLabels(labels=(eachNode.label,))
|
||
|
zAssembly.Set(name='C',nodes=Node)
|
||
|
else:
|
||
|
Node=zInstance.nodes.sequenceFromLabels(labels=(eachNode.label,))
|
||
|
zAssembly.Set(name='Temp',nodes=Node)
|
||
|
try:
|
||
|
zAssembly.SetByMerge(name='EdgeBC', sets=(zAssembly.sets['EdgeBC'],zAssembly.sets['Temp']))
|
||
|
except:
|
||
|
zAssembly.Set(name='EdgeBC',nodes=Node)
|
||
|
elif(YCor<YMin+Toler)and(YCor>YMin-Toler):
|
||
|
if(ZCor<ZMax+Toler)and(ZCor>ZMax-Toler):
|
||
|
Node=zInstance.nodes.sequenceFromLabels(labels=(eachNode.label,))
|
||
|
zAssembly.Set(name='B1',nodes=Node)
|
||
|
elif(ZCor<ZMin+Toler)and(ZCor>ZMin-Toler):
|
||
|
Node=zInstance.nodes.sequenceFromLabels(labels=(eachNode.label,))
|
||
|
zAssembly.Set(name='C1',nodes=Node)
|
||
|
else:
|
||
|
Node=zInstance.nodes.sequenceFromLabels(labels=(eachNode.label,))
|
||
|
zAssembly.Set(name='Temp',nodes=Node)
|
||
|
try:
|
||
|
zAssembly.SetByMerge(name='EdgeB1C1', sets=(zAssembly.sets['EdgeB1C1'],zAssembly.sets['Temp']))
|
||
|
except:
|
||
|
zAssembly.Set(name='EdgeB1C1',nodes=Node)
|
||
|
elif(ZCor<ZMax+Toler)and(ZCor>ZMax-Toler):
|
||
|
if(YCor<YMax-Toler)and(YCor>YMin+Toler):
|
||
|
Node=zInstance.nodes.sequenceFromLabels(labels=(eachNode.label,))
|
||
|
zAssembly.Set(name='Temp',nodes=Node)
|
||
|
try:
|
||
|
zAssembly.SetByMerge(name='EdgeBB1', sets=(zAssembly.sets['EdgeBB1'],zAssembly.sets['Temp']))
|
||
|
except:
|
||
|
zAssembly.Set(name='EdgeBB1',nodes=Node)
|
||
|
elif(ZCor<ZMin+Toler)and(ZCor>ZMin-Toler):
|
||
|
if(YCor<YMax-Toler)and(YCor>YMin+Toler):
|
||
|
Node=zInstance.nodes.sequenceFromLabels(labels=(eachNode.label,))
|
||
|
zAssembly.Set(name='Temp',nodes=Node)
|
||
|
try:
|
||
|
zAssembly.SetByMerge(name='EdgeCC1', sets=(zAssembly.sets['EdgeCC1'],zAssembly.sets['Temp']))
|
||
|
except:
|
||
|
zAssembly.Set(name='EdgeCC1',nodes=Node)
|
||
|
else:
|
||
|
Node=zInstance.nodes.sequenceFromLabels(labels=(eachNode.label,))
|
||
|
zAssembly.Set(name='Temp',nodes=Node)
|
||
|
try:
|
||
|
zAssembly.SetByMerge(name='FaceFront', sets=(zAssembly.sets['FaceFront'],zAssembly.sets['Temp']))
|
||
|
except:
|
||
|
zAssembly.Set(name='FaceFront',nodes=Node)
|
||
|
# Back Face, Edges and Nodes
|
||
|
elif(XCor<XMin+Toler)and(XCor>XMin-Toler):
|
||
|
if(YCor<YMax+Toler)and(YCor>YMax-Toler):
|
||
|
if(ZCor<ZMax+Toler)and(ZCor>ZMax-Toler):
|
||
|
Node=zInstance.nodes.sequenceFromLabels(labels=(eachNode.label,))
|
||
|
zAssembly.Set(name='A',nodes=Node)
|
||
|
elif(ZCor<ZMin+Toler)and(ZCor>ZMin-Toler):
|
||
|
Node=zInstance.nodes.sequenceFromLabels(labels=(eachNode.label,))
|
||
|
zAssembly.Set(name='D',nodes=Node)
|
||
|
else:
|
||
|
Node=zInstance.nodes.sequenceFromLabels(labels=(eachNode.label,))
|
||
|
zAssembly.Set(name='Temp',nodes=Node)
|
||
|
try:
|
||
|
zAssembly.SetByMerge(name='EdgeAD', sets=(zAssembly.sets['EdgeAD'],zAssembly.sets['Temp']))
|
||
|
except:
|
||
|
zAssembly.Set(name='EdgeAD',nodes=Node)
|
||
|
elif(YCor<YMin+Toler)and(YCor>YMin-Toler):
|
||
|
if(ZCor<ZMax+Toler)and(ZCor>ZMax-Toler):
|
||
|
Node=zInstance.nodes.sequenceFromLabels(labels=(eachNode.label,))
|
||
|
zAssembly.Set(name='A1',nodes=Node)
|
||
|
elif(ZCor<ZMin+Toler)and(ZCor>ZMin-Toler):
|
||
|
Node=zInstance.nodes.sequenceFromLabels(labels=(eachNode.label,))
|
||
|
zAssembly.Set(name='D1',nodes=Node)
|
||
|
else:
|
||
|
Node=zInstance.nodes.sequenceFromLabels(labels=(eachNode.label,))
|
||
|
zAssembly.Set(name='Temp',nodes=Node)
|
||
|
try:
|
||
|
zAssembly.SetByMerge(name='EdgeA1D1', sets=(zAssembly.sets['EdgeA1D1'],zAssembly.sets['Temp']))
|
||
|
except:
|
||
|
zAssembly.Set(name='EdgeA1D1',nodes=Node)
|
||
|
elif(ZCor<ZMax+Toler)and(ZCor>ZMax-Toler):
|
||
|
if(YCor<YMax-Toler)and(YCor>YMin+Toler):
|
||
|
Node=zInstance.nodes.sequenceFromLabels(labels=(eachNode.label,))
|
||
|
zAssembly.Set(name='Temp',nodes=Node)
|
||
|
try:
|
||
|
zAssembly.SetByMerge(name='EdgeAA1', sets=(zAssembly.sets['EdgeAA1'],zAssembly.sets['Temp']))
|
||
|
except:
|
||
|
zAssembly.Set(name='EdgeAA1',nodes=Node)
|
||
|
elif(ZCor<ZMin+Toler)and(ZCor>ZMin-Toler):
|
||
|
if(YCor<YMax-Toler)and(YCor>YMin+Toler):
|
||
|
Node=zInstance.nodes.sequenceFromLabels(labels=(eachNode.label,))
|
||
|
zAssembly.Set(name='Temp',nodes=Node)
|
||
|
try:
|
||
|
zAssembly.SetByMerge(name='EdgeDD1', sets=(zAssembly.sets['EdgeDD1'],zAssembly.sets['Temp']))
|
||
|
except:
|
||
|
zAssembly.Set(name='EdgeDD1',nodes=Node)
|
||
|
else:
|
||
|
Node=zInstance.nodes.sequenceFromLabels(labels=(eachNode.label,))
|
||
|
zAssembly.Set(name='Temp',nodes=Node)
|
||
|
try:
|
||
|
zAssembly.SetByMerge(name='FaceRear', sets=(zAssembly.sets['FaceRear'],zAssembly.sets['Temp']))
|
||
|
except:
|
||
|
zAssembly.Set(name='FaceRear',nodes=Node)
|
||
|
# Top Face and Edges
|
||
|
elif(YCor<YMax+Toler)and(YCor>YMax-Toler):
|
||
|
if(XCor<XMax-Toler)and(XCor>XMin+Toler):
|
||
|
if(ZCor<ZMax+Toler)and(ZCor>ZMax-Toler):
|
||
|
Node=zInstance.nodes.sequenceFromLabels(labels=(eachNode.label,))
|
||
|
zAssembly.Set(name='Temp',nodes=Node)
|
||
|
try:
|
||
|
zAssembly.SetByMerge(name='EdgeAB', sets=(zAssembly.sets['EdgeAB'],zAssembly.sets['Temp']))
|
||
|
except:
|
||
|
zAssembly.Set(name='EdgeAB',nodes=Node)
|
||
|
elif(ZCor<ZMin+Toler)and(ZCor>ZMin-Toler):
|
||
|
Node=zInstance.nodes.sequenceFromLabels(labels=(eachNode.label,))
|
||
|
zAssembly.Set(name='Temp',nodes=Node)
|
||
|
try:
|
||
|
zAssembly.SetByMerge(name='EdgeCD', sets=(zAssembly.sets['EdgeCD'],zAssembly.sets['Temp']))
|
||
|
except:
|
||
|
zAssembly.Set(name='EdgeCD',nodes=Node)
|
||
|
else:
|
||
|
Node=zInstance.nodes.sequenceFromLabels(labels=(eachNode.label,))
|
||
|
zAssembly.Set(name='Temp',nodes=Node)
|
||
|
try:
|
||
|
zAssembly.SetByMerge(name='FaceTop', sets=(zAssembly.sets['FaceTop'],zAssembly.sets['Temp']))
|
||
|
except:
|
||
|
zAssembly.Set(name='FaceTop',nodes=Node)
|
||
|
# Bottom Face and Edges
|
||
|
elif(YCor<YMin+Toler)and(YCor>YMin-Toler):
|
||
|
if(XCor<XMax-Toler)and(XCor>XMin+Toler):
|
||
|
if(ZCor<ZMax+Toler)and(ZCor>ZMax-Toler):
|
||
|
Node=zInstance.nodes.sequenceFromLabels(labels=(eachNode.label,))
|
||
|
zAssembly.Set(name='Temp',nodes=Node)
|
||
|
try:
|
||
|
zAssembly.SetByMerge(name='EdgeA1B1', sets=(zAssembly.sets['EdgeA1B1'],zAssembly.sets['Temp']))
|
||
|
except:
|
||
|
zAssembly.Set(name='EdgeA1B1',nodes=Node)
|
||
|
elif(ZCor<ZMin+Toler)and(ZCor>ZMin-Toler):
|
||
|
Node=zInstance.nodes.sequenceFromLabels(labels=(eachNode.label,))
|
||
|
zAssembly.Set(name='Temp',nodes=Node)
|
||
|
try:
|
||
|
zAssembly.SetByMerge(name='EdgeC1D1', sets=(zAssembly.sets['EdgeC1D1'],zAssembly.sets['Temp']))
|
||
|
except:
|
||
|
zAssembly.Set(name='EdgeC1D1',nodes=Node)
|
||
|
else:
|
||
|
Node=zInstance.nodes.sequenceFromLabels(labels=(eachNode.label,))
|
||
|
zAssembly.Set(name='Temp',nodes=Node)
|
||
|
try:
|
||
|
zAssembly.SetByMerge(name='FaceBottom', sets=(zAssembly.sets['FaceBottom'],zAssembly.sets['Temp']))
|
||
|
except:
|
||
|
zAssembly.Set(name='FaceBottom',nodes=Node)
|
||
|
# Left Face
|
||
|
elif(ZCor<ZMax+Toler)and(ZCor>ZMax-Toler):
|
||
|
if(XCor<XMax-Toler)and(XCor>XMin+Toler)and(YCor>YMin+Toler)and(YCor>YMin+Toler):
|
||
|
Node=zInstance.nodes.sequenceFromLabels(labels=(eachNode.label,))
|
||
|
zAssembly.Set(name='Temp',nodes=Node)
|
||
|
try:
|
||
|
zAssembly.SetByMerge(name='FaceLeft', sets=(zAssembly.sets['FaceLeft'],zAssembly.sets['Temp']))
|
||
|
except:
|
||
|
zAssembly.Set(name='FaceLeft',nodes=Node)
|
||
|
elif(ZCor<ZMin+Toler)and(ZCor>ZMin-Toler):
|
||
|
if(XCor<XMax-Toler)and(XCor>XMin+Toler)and(YCor>YMin+Toler)and(YCor>YMin+Toler):
|
||
|
Node=zInstance.nodes.sequenceFromLabels(labels=(eachNode.label,))
|
||
|
zAssembly.Set(name='Temp',nodes=Node)
|
||
|
try:
|
||
|
zAssembly.SetByMerge(name='FaceRight', sets=(zAssembly.sets['FaceRight'],zAssembly.sets['Temp']))
|
||
|
except:
|
||
|
zAssembly.Set(name='FaceRight',nodes=Node)
|
||
|
# Clean Up
|
||
|
del zAssembly.sets['Temp']
|
||
|
|