Intersection of sets in bash
code myAssembly
cool
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | #!python
myAssembly = myModel.rootAssembly
myInstance = myAssembly.Instance(name='finalInstance-1-1', part=myPart, dependent=OFF)
# RIGID STUFF
iterr=0
rigidRefs = []
for j in dataCirc:
entered = False
#add the ref point, dziwko!
isRefPoint = 0
#search for the edges, dziwko!
vars()['rigidSet'+str(iterr)] = []
for i in myModel.rootAssembly.instances['finalInstance-1-1'].edges:
if norma(i.pointOn[0], [j[0], j[1]]) > j[2]*1.001:
continue
else:
try:
radiuz = i.getRadius()
except:
continue
entered = True
#stuff concerning the reference points
if isRefPoint == 0:
try:
raz=myModel.rootAssembly.InterestingPoint(i, CENTER)
isRefPoint = 1
tmpRef = myModel.rootAssembly.ReferencePoint(point=raz)
rigidRefs += [ [j[0], j[1], 0.0] ]
except:
print "Buba z InteresingPointem, ale jade dalej"
idx = i.index
if len(vars()['rigidSet'+str(iterr)]) == 0:
vars()['rigidSet'+str(iterr)] = myModel.rootAssembly.instances['finalInstance-1-1'].edges[idx:idx+1]
else:
vars()['rigidSet'+str(iterr)] += myModel.rootAssembly.instances['finalInstance-1-1'].edges[idx:idx+1]
#print "ten nalezy"
if entered == True:
try:
regionRef = regionToolset.Region(referencePoints=(myAssembly.referencePoints[tmpRef.id],))
regionEdg = regionToolset.Region(edges=vars()['rigidSet'+str(iterr)])
mdb.models['test'].RigidBody(name='RIGID-'+str(iterr), refPointRegion=regionRef, bodyRegion=regionEdg)
del vars()['rigidSet'+str(iterr)]
except:
print "cos poszlo nie tak"
if entered == True:
iterr += 1
else:
continue
|