def ptFromBox(box):
crv = rs.DuplicateEdgeCurves(box)
corpt = []
for i in crv:
endpt = rs.CurveEndPoint(i)
corpt.append(endpt)
xA = []
yA = []
zA = []
for i in corpt:
x,y,z = i
xA.append(x)
yA.append(y)
zA.append(z)
xA.sort()
yA.sort()
zA.sort()
p1 = [xA[0],yA[0],zA[0]]
p2 = [xA[-1],yA[-1],zA[-1]]
return p1,p2
def ptChoice(pt01,pt02):
xA = random.choice((pt01[0],pt02[0]))
yA = random.choice((pt01[1],pt02[1]))
zA = random.choice((pt01[2],pt02[2]))
return xA,yA,zA
for i in range(loc): ##carveMode face=1 edge=2 corner=3
nChoice = random.choice(plist)
plist.remove(nChoice)
pt[nChoice] = codC[nChoice]
for i in plist:
nRange = i
pt[nRange] = codR[nRange]
return pt
block = rs.GetObject()
for i in range(100):
x=0
while x<100:
x = x+1
boxblock = rs.AddBox(rs.BoundingBox(block))
pot = ptLocation(boxblock,0)
rs.DeleteObject(boxblock)
if rs.IsPointInSurface(block,pot,True,3):break