############################## ########Marilyn Monroe######## ############################## import rhinoscriptsyntax as rs import random, time, sys, math, os ### #from itertools import combinations #from itertools import permutations import itertools sys.path.append("P:/") ### sys.path.append("L:/") ### sys.path.append("P:/WWW/mori21/DM2/") import DM_lib as dm ### reload(dm) ############################## rs.UnitSystem(4) # meters = 4, cm = 3 etc rs.ShowGrid(None, 0) # grid > 0 = off rs.ShowGridAxes(None, 0) # y/y/z axen display > 0/1 = off/on rs.ViewDisplayMode(rs.CurrentView(), "wireframe") rs.Command("cplane w t enter", 0) dm.PointRadius(displayModeX=0, rad=1, styl=3) dm.printDisplay(0) rs.EnableRedraw(0) dm.newEmptyLayer("Marilyn", [0,120,220]) rs.Redraw() pnts_singt = [[0,15.407 , 0.726], [0, 15.291, 1.889],[0, 15.349, 3.848], [0, 15.194, 5.748], [0, 14.787, 8.289], [0, 14.593, 11.798], [0, 14.225, 13.369], [0, 14.507, 16.422], [0, 16.816, 18.177], [0, 13.787, 16.255], [0, 13.395, 16.422], [0, 12.592, 16.451], [0, 12.156, 16.666], [0, 11.909, 16.929], [0, 11.460, 17.099], [0, 11.126, 17.279], [0, 11.110, 17.371], [0, 10.896, 17.433], [0, 10.710, 17.581], [0, 10.896, 17.800], [0, 11.477, 17.871], [0, 12.216, 17.942], [0, 12.789, 17.854], [0, 13.103, 17.854], [0, 13.563, 17.274], [0, 14.007, 17.416], [0, 14.976, 18.387], [0, 15.103, 18.824], [0, 14.813, 19.470], [0, 14.446, 20.379], [0, 14.462, 20.708], [0, 14.142, 21.135], [0, 13.739, 21.672], [0, 13.827, 22.225], [0, 14.035, 22.433], [0, 14.484, 22.849], [0, 14.484, 23.134], [0, 15.129, 21.723], [0, 15.316, 20.879], [0, 15.359, 20.123],[0, 15.418, 19.163], [0, 15.234, 18.528], [0, 14.976, 18.375],[0, 15.235, 18.528], [0, 15.428, 19.163], [0, 15.359, 20.133], [0, 15.316, 20.89], [0, 15.139, 21.723], [0, 14.859, 23.586], [0, 15.231, 24.096], [0, 15.373, 24.052], [0, 16.207, 23.296], [0, 16.462, 22.558], [0, 16.831, 21.512], [0, 16.920, 19.454], [0, 16.816, 18.194], [0, 16.920, 19.474], [0, 16.831, 21.522], [0, 16.462, 22.568], [0, 16.207, 23.196], [0, 15.373, 24.152], [0, 15.292, 24.144], [0, 15.960, 24.637], [0, 16.035, 24.896], [0, 16.494, 24.979], [0, 16.319, 25.388], [0, 15.388, 25.396], [0, 15.401, 25.572], [0, 15.275, 25.830], [0, 14.282, 25.547], [0, 13.932, 25.739], [0, 13.932, 26.089], [0, 14.593, 26.607], [0, 14.593, 27.216], [0, 14.976, 27.032], [0, 15.476, 27.341], [0, 15.476, 27.558], [0, 16.009, 28.844], [0, 14.747, 29.141], [0, 15.806, 29.905], [0, 16.279, 30.115], [0, 17.429, 30.243], [0, 18.058, 30.216], [0, 19.204, 29.569], [0, 19.802, 29.086], [0, 20.209, 27.597], [0, 20.209, 26.389], [0, 19.840, 25.663], [0, 19.369, 25.065], [0, 18.835, 24.786], [0, 17.664, 24.887], [0, 16.367, 25.371], [0, 16.494, 24.976], [0, 16.367, 25.361], [0, 17.664, 24.877], [0, 18.835, 24.776], [0, 19.960, 24.952], [0, 20.105, 23.746], [0, 20.022, 22.891], [0, 19.466, 21.067], [0, 18.878, 20.077], [0, 18.445, 19.773], [0, 17.796, 19.511], [0, 16.941, 19.748], [0, 17.796, 19.511], [0, 18.445, 19.773], [0, 18.878, 20.077], [0, 18.930, 19.243], [0, 19.136, 18.769], [0, 19.703, 17.534], [0, 19.806, 16.337], [0, 19.569, 13.956], [0, 18.950, 12.348], [0, 18.682, 11.153], [0, 18.509, 9.164], [0, 19.206, 4.082], [0, 19.876, 0.898], [0, 19.756, 0.275], [0, 19.134, 0], [0, 17.056, 0], [0, 16.377, 0.222], [0,15.407 , 0.726]] pnts_wind = [[0, 16.627, 0.153], [0, 17.139, 1.472], [0, 17.338, 5.301], [0, 16.638, 5.979], [0, 15.987, 6.180],[0, 15.278, 6.772], [0, 13.658, 8.350], [0, 13.646, 8.778], [0, 13.541, 10.887], [0, 13.161, 12.300], [0, 13.258, 12.695], [0, 13.485, 11.391], [0, 13.752, 11.175], [0, 14.443, 11.013],[0, 13.752, 11.175],[0, 13.495, 11.391], [0, 13.268, 12.695], [0, 13.171, 12.300], [0, 13.541, 10.897], [0, 13.646, 8.788], [0, 13.277,9.010], [0, 12.463, 9.650], [0, 12.133, 10.814], [0, 12.017, 11.686], [0, 11.474, 13.548], [0, 10.892, 15.797], [0, 11.474, 17.290], [0, 14.618, 21.866], [0, 15.454, 21.567], [0, 15.534, 20.651], [0, 10.909, 17.117], [0, 9.884, 18.105], [0, 8.546, 18.570], [0, 7.479, 19.986], [0, 6.766, 22.126], [0, 8.258, 22.534], [0, 8.839, 22.283], [0, 9.593, 22.283], [0, 12.766, 21.073], [0, 13.740, 20.523], [0, 13.975, 21.073], [0, 14.148, 22.078], [0, 15.028, 22.927], [0, 16.003, 23.298], [0, 15.028, 22.937], [0, 14.148, 22.178], [0, 13.975, 21.073], [0, 13.677, 19.361], [0, 13.677, 17.963], [0, 13.850, 16.864], [0, 15.059, 17.058], [0, 14.824, 17.775], [0, 17.330, 18.705], [0, 19.089, 17.873], [0, 19.262, 22.208], [0, 19.042, 22.224], [0, 17.911, 19.145], [0, 17.330, 18.705], [0, 17.058, 23.026], [0, 17.246, 18.856], [0, 15.363, 18.130], [0, 14.803, 17.825], [0, 14.752, 18.563], [0, 15.109, 20.001], [0, 15.452, 21.069], [0, 15.872, 21.706], [0, 16.597, 22.558], [0, 16.928, 23.130], [0, 16.763, 23.410], [0, 16.241, 23.334], [0, 15.937, 23.519], [0, 15.575, 23.960], [0, 15.575, 24.763], [0, 15.644, 25.406], [0, 16.220, 26.641], [0, 17.114, 27.384], [0, 18.649, 27.518], [0, 19.559, 26.875], [0, 19.943, 25.731], [0, 19.943, 24.972], [0, 19.751, 24.321], [0, 19.982, 23.843], [0, 20.291, 24.778], [0, 20.353, 24.071], [0, 20.212, 23.365], [0, 20.385, 22.438], [0, 20.683, 21.688], [0, 21.170, 21.511], [0, 21.28, 20.867], [0, 21.170, 18.888], [0, 20.636, 20.710], [0, 21.170, 18.898], [0, 21.38, 20.867], [0, 21.170, 21.531], [0, 20.693, 21.688], [0, 20.395, 22.438], [0, 20.212, 23.385], [0, 20.353, 24.171], [0, 19.254, 22.432], [0, 19.804, 21.531], [0, 19.458, 20.484], [0, 19.264, 18.872], [0, 19.223, 18.181], [0, 19.301, 17.789], [0, 19.741, 17.569], [0, 20.228, 17.663], [0, 20.589, 18.024], [0, 21.237, 18.558], [0, 21.237, 19.328], [0, 21.751, 20.474], [0, 24.186, 21.244], [0, 25.458, 21.071], [0, 26.793, 18.000], [0, 27.202, 16.642], [0, 26.605, 14.537], [0, 25.914, 14.145], [0, 25.568, 13.265], [0, 25.631, 12.966], [0, 25.270, 12.055], [0, 25.176, 11.003], [0, 22.757, 8.631], [0, 20.982, 7.076], [0, 20.291, 7.453], [0, 18.076, 7.579], [0, 18.370, 6.365], [0, 17.935, 7.579], [0, 17.762, 8.631], [0, 17.118, 9.307], [0, 16.694, 10.359], [0, 18.406, 12.213], [0, 19.505, 13.830], [0, 19.505, 14.286], [0, 18.453, 15.024], [0, 18.092, 15.024], [0, 17.448, 14.616], [0, 17.039, 13.296], [0, 16.207, 12.605], [0, 15.531, 12.354], [0, 15.406, 10.987], [0, 14.448, 10.469], [0, 14.652, 9.48], [0, 17.338, 5.301], [0, 17.531, 3.667], [0, 17.139, 1.472], [0, 16.678, 0.165], [0, 17.64, 0.86], [0, 18.525, 0.603], [0, 18.783, 1.814], [0, 19.084, 1.964], [0, 19.084, 1.113], [0, 19.317, 1.328], [0, 19.238, 1.971], [0, 19.490, 3.134], [0, 19.364, 3.684], [0, 18.861, 4.280], [0, 18.626, 4.956], [0, 18.390, 6.307], [0, 20.542, 4.013], [0, 20.196, 3.542], [0, 20.306, 2.191], [0, 19.929, 2.191], [0, 19.929, 3.071], [0, 19.490, 3.134]] def makeFigure( pnts=pnts_singt, crv_degree=1, pos=[30.0, 0,0], divis=64, show=1, delIt=1, crv_name="singt", obj_color=[0,200,0]): coords = [ rs.VectorAdd(cor, pos) for cor in pnts ] crvID = rs.AddCurve(coords, crv_degree) rs.ObjectColor( crvID, obj_color ) rs.ObjectName( crvID, crv_name ) coords = rs.DivideCurve( crvID, divis, show ) if delIt: rs.DeleteObject( crvID ) return coords anz = 64*2 showPts = 0 deg = 1 delIt = 0 frames = 25*5 path = "L:/animatzi/MM_tst/" if not os.path.exists(path): os.makedirs(path) #coords_1 = makeFigure( pnts=pnts_singt, crv_degree=deg, pos=[50.0, 10.0,0], divis=anz, show=showPts, delIt=delIt, crv_name="MM_singt", obj_color=[0,200,0]) #coords_2 = makeFigure( pnts=pnts_wind, crv_degree=deg, pos=[00.0, 10.0,0], divis=anz, show=showPts, delIt=delIt, crv_name="MM_wind", obj_color=[210,0,120]) rs.LayerVisible("mori", 1) MM_0 = rs.ObjectsByName("MM_schlank")[0] MM_1 = rs.ObjectsByName("MM_breit")[0] MM_2 = rs.ObjectsByName("MM_arme")[0] coords_0 = rs.DivideCurve(MM_0, anz, 0) coords_1 = rs.DivideCurve(MM_1, anz, 0) coords_2 = rs.DivideCurve(MM_2, anz, 0) rs.LayerVisible("mori", 0) dm.getCameraTarget() #dm.setCameraTarget( [-77.48685689, 11.77273249, 12.05421199], [17.20711797, 25.7546931, 14.05896983], lens=49.99999999, rota=0, upVec=[-0.020714654726424725,-0.003058605226544303,0.999780749971529] ) # ... danke, andi ! ## cam 1 #dm.setCameraTarget( [-3151.51513522, -763.71493147, 419.74295749], [-582.27838656, -384.35640237, -47.55628417], lens=49.99999999, rota=0, upVec=[0.17518845445825773,0.02586730648051854,0.9841950456489659] ) # ... danke, andi ! dm.setCameraTarget( [2282.27449924, -671.8852515, 454.02906213], [-361.78198394, 156.74870715, -257.41642053], lens=49.99999999, rota=0, upVec=[-0.23731190987082756,0.07437235496387741,0.9685823714329036] ) # ... danke, andi ! if 1: if 1: framNumber = 0 fac = 1/frames allCoords = [] for fram in range(0, frames+1): # facX = fac*fram # coords = [] # for j in range(anz): # cor = dm.pntInbetween( coords_1[j], coords_2[j], facX ) # coords.append(cor) coords = [ dm.pntInbetween( coords_0[j], coords_1[j], fac*fram ) for j in range(anz) ] allCoords.append( coords ) #rs.AddPoints(coords) #rs.AddLine( coords[-1], coords[0] ) coords.append(coords[0]) crv = rs.AddCurve(coords, deg) rs.Redraw() #rs.Command("isolate -selId "+str(crv)+" enter enter", 0) nam = dm.makeName("MM", frameNumber=framNumber, anzahl=4, format='jpg') rs.Redraw() rs.Command("-viewCaptureToFile Width=960 Height=540 Scale=1 DrawCPlaneAxes=No TransparentBackground=No "+path+nam, 0) framNumber +=1 print nam dm.esc() ### 2. zu 3. image for fram in range(0, frames+1): # facX = fac*fram # coords = [] # for j in range(anz): # cor = dm.pntInbetween( coords_1[j], coords_2[j], facX ) # coords.append(cor) coords = [ dm.pntInbetween( coords_1[j], coords_2[j], fac*fram ) for j in range(anz) ] allCoords.append( coords ) #rs.AddPoints(coords) #rs.AddLine( coords[-1], coords[0] ) coords.append(coords[0]) crv = rs.AddCurve(coords, deg) rs.Redraw() #rs.Command("isolate -selId "+str(crv)+" enter enter", 0) nam = dm.makeName("MM", frameNumber=framNumber, anzahl=4, format='jpg') framNumber +=1 rs.Redraw() rs.Command("-viewCaptureToFile Width=960 Height=540 Scale=1 DrawCPlaneAxes=No TransparentBackground=No "+path+nam, 0) print nam dm.esc() if 0: radius = 50 center = [200,0,0] dAng = 360.0 / (frames+0) for i, coords in enumerate(allCoords): coords.append(coords[0]) coords = [rs.VectorAdd( cor, [0, radius, 0]) for cor in coords] coords = [rs.VectorRotate( cor, i*dAng, [0,0,1]) for cor in coords] coords = [rs.VectorAdd( cor, center) for cor in coords] Curve_180 = rs.AddCurve (coords, deg) rs.ObjectColor( Curve_180, [255,0,0] ) rs.Redraw() if 0: fac = 1/steps allCoords = [] for k in range(0,steps): facX = fac*k coords = [] for j in range(anz): cor = dm.pntInbetween( coords_1[j], coords_2[j], facX ) coords.append(cor) allCoords.append( coords ) if 0: Angle = -180.0 / (steps+0) for i, coords in enumerate(allCoords): coords.append(coords[0]) coords = [rs.VectorAdd( cor, [0, radius, 0]) for cor in coords] coords = [rs.VectorRotate( cor, i*Angle, [0,0,1]) for cor in coords] coords = [rs.VectorAdd( cor, center) for cor in coords] Curve_180 = rs.AddCurve (coords, deg) rs.ObjectColor( Curve_180, [255,0,0] ) if 0: dm.newEmptyLayer("Metal", [255,0,0]) RotationCenter = [550.478522464829, 82960.335677139, 30] RotationAxis = [0, 0, 1] AngleIncrement = 4.5 LineTemplate = rs.AddLine([550.478522464829, 82960.335677139, 30], [638.478522464829, 82960.335677139, 30.5]) if 0: for _ in range(80): RotatedLine = rs.CopyObject(LineTemplate) rs.RotateObject(RotatedLine, RotationCenter, AngleIncrement, RotationAxis) LineTemplate = RotatedLine rs.CurrentLayer("Default") dm.printDisplay(1) #print round(48/11, 2) #print 48 - round(48/11, 2) #print (48 - round(48/11, 2)) + round(48/11, 2)