import rhinoscriptsyntax as rs import sys, random ### #sys.path.append("C:/Hue03/") ### add path where "DM_lib.py" can be found !!! sys.path.append("P:/DM2/") ### add path where "DM_lib.py" can be found !!! #sys.path.append("P:/dm2/") ### add path where "DM_lib.py" can be found !!! import DM_lib as dm ### reload(dm) ############################## print " ,--. ,--. ' ' ,--. ,--. " print "| .' /,--.,--.,--.--.| |-. `--' ,---. " print "| . ' | || || .--'| .-. ',--.( .-' " print "| |\ \' '' ' | | | `-' || |.-' `) " print "`--' '--' `----' `--' `---' `--'`----' " print "\n" rs.UnitSystem(3) dm.PointRadius(displayModeX=1, rad=2, styl=3, verbose=1) if 1: rs.EnableRedraw(0) #delete absolutely all dm.eA() #print "pntRandVec",dm.pntRandVec(-1,1) anz = 5500 deltaAngle = 360/anz rad = random.uniform(5.0, 10) vec = [rad, 0,0] #rs.AddPoint(vec) #vecX = rs.VectorRotate(vec,29.0,[0,1,1]) #rs.AddPoint(vecX) coords = [] for i in range(anz): vecX = rs.VectorRotate(vec, random.uniform(0,270), [0,0,1]) vecX = rs.VectorRotate(vecX, random.uniform(0,180), [0,1,0]) coords.append( vecX ) newPoints = rs.AddPoints(coords) for pnt in newPoints : colo = [random.randint(200,255), random.randint(0,160), random.randint(0,10) ] rs.ObjectColor( pnt, colo ) pln0 =rs.PlaneFromNormal([0,0,0], [0,1,1], xaxis=[0,1,0]) pln1 =rs.PlaneFromNormal([0,0,0], [-1,-1,0], xaxis=[0,1,0]) # Add Arc0 #circ0 = rs.AddCircle( pln0, rad) circ0 = rs.AddArc(pln0, rad, 180) rs.RotateObject(circ0, [0,0,0], 90,[0,0,1]) rs.ObjectPrintColor(circ0, [0,200,0]) rs.ObjectPrintWidth(circ0, 0.2 ) # Add Arc1 circ1 = rs.AddArc(pln1, rad, 180) rs.RotateObject(circ1, [0,0,0], 90,[0,0,1]) rs.ObjectPrintColor(circ1, [0,200,0]) rs.ObjectPrintWidth(circ1, 0.2 ) #print deltaAngle*i #coords upper jaw dm.printDisplay(state=1, scale=10, thickness=1, color='Display') lin0 = rs.AddLine( rs.CurveStartPoint(circ0), rs.CurveEndPoint(circ0)) rs.ObjectPrintColor(lin0, [0,200,220]) rs.ObjectPrintWidth(lin0, 0.2 ) coordsC = rs.DivideCurve(circ0, 1001, 0) coordsL = rs.DivideCurve(lin0, 1001, 0) #coords lower jaw lin1 = rs.AddLine( rs.CurveStartPoint(circ0), rs.CurveEndPoint(circ0)) rs.ObjectPrintColor(lin1, [0,200,220]) rs.ObjectPrintWidth(lin1, 0.2 ) coordsC1 = rs.DivideCurve(circ1, 1001, 0) coordsL1 = rs.DivideCurve(lin1, 1001, 0) fuellCoords = [] for i in range(1001): pC = random.choice(coordsC) pL = random.choice(coordsL) pC1 = random.choice(coordsC1) pL1 = random.choice(coordsL1) #rs.AddCurve( [pC, pL] ) pX = dm.pntInbetween(pC, pL, random.uniform(0,1)) fuellCoords.append( pX ) pX1 = dm.pntInbetween(pC1, pL1, random.uniform(0,1)) fuellCoords.append( pX1 ) rs.ObjectColor(rs.AddPoints(fuellCoords), [60,170,15] ) xRange = int(rad)*2 yRange = random.randint(7,13) zRange = random.randint(7,13) #dm.PointRadius(displayModeX=1, rad=2, styl=3, verbose=1) count = -2 start = -2 end = -1 newCoords = [] for x in range(xRange): #if x > xRange * 0.5: x += -rad+1 for y in range(yRange): y += 1 for z in range(zRange): cor = [-x,-y,-z] #print cor newCoords.append(cor) #dotted line count += 1 start += 1 end +=1 # print "count",count # print "start",start # print "end",end # print "count mod 3",count % 3 if count % 3 == 0: l1 = newCoords[start] l2 = newCoords[end] rs.AddLine(l1,l2) # #rs.AddPoints(newCoords) #print len(newCoords) #c1 = newCoords[0] #c2 = newCoords[1] #rs.AddLine(c1,c2) #rs.Addline(newCoords[0],newCoords[1]) #rs.AddCurve(newCoords) #shuffle# #random.shuffle(newCoords) #rs.AddCurve(newCoords)