import rhinoscriptsyntax as rs #delete everything and start from scratch allobjs = rs.AllObjects() if allobjs: rs.DeleteObjects(allobjs) #ABDOMEN #abdomen side view pt_sa1 = rs.AddPoint(0, 0, 0) pt_sa2 = rs.AddPoint(0, 5, 4) #changeable z-coordinate (originally (0, 5, 4)) pt_sa3 = rs.AddPoint(0, 10, 4) #changeable z-coordinate (originally (0, 10, 4)) pt_sa4 = rs.AddPoint(0, 12, -2) pt_sa5 = rs.AddPoint(0, 8, -1) pt_sa6 = rs.AddPoint(0, 2, -1) pts_sa = [pt_sa1, pt_sa2, pt_sa3, pt_sa4, pt_sa5, pt_sa6, pt_sa1] ac_side = rs.AddCurve(pts_sa, degree=3) #abdomen curve side #split curve along y_line y_line = rs.AddLine((0, 0, 0), (0, 12, 0)) int_pts = rs.CurveCurveIntersection(ac_side, y_line) params = [pt[5] for pt in int_pts if pt[0] == 1] split_curves = rs.SplitCurve(ac_side, params) if split_curves and len(split_curves) == 2: csp2 = split_curves[0] csp1 = split_curves[1] #abdomen top view pt_ta1 = rs.AddPoint(0, 1, 0) pt_ta2 = rs.AddPoint(4, 4, 0) #changeable x-coordinate (originally (4, 4, 0)) pt_ta3 = rs.AddPoint(4, 9, 0) #changeable x-coordinate (originally (4, 9, 0)) pt_ta4 = rs.AddPoint(0, 11.068, 0) pts_ta = [pt_ta1, pt_ta2, pt_ta3, pt_ta4] ac_top = rs.AddCurve(pts_ta, degree=2) #points for sweep2 (abdomen) #side curve top half div_points1 = rs.DivideCurve(csp1, 15,create_points=True, return_points=True) if div_points1 and len(div_points1) == 16: div_opt1 = div_points1[0] div_opt2 = div_points1[1] #side curve bottom half div_points2 = rs.DivideCurve(csp2, 15,create_points=True, return_points=True) if div_points2 and len(div_points2) == 16: div_upt1 = div_points2[14] #abdomen top curve div_points3 = rs.DivideCurve(ac_top, 15,create_points=True, return_points=True) if div_points3 and len(div_points3) == 16: div_top1 = div_points3[0] div_top2 = div_points3[1] #sweep2 top half sweepc1=rs.AddCurve((div_opt2,(0.5,1.2,0.7),div_top2)) sweepc11=rs.AddCurve((div_points1[8], (4,div_points1[8][1],3.5),div_points3[8])) a_1_4 = rs.AddSweep2([csp1,ac_top],[sweepc1,sweepc11 ],False) a_2_4 = rs.AddSweep2([csp1,ac_top],[sweepc11 ],False) rs.ReverseCurve(csp2) #sweep2 bottom half sweepc2=rs.AddCurve((div_upt1,(0.3,1.5,-0.4),div_top2)) sweepc21=rs.AddCurve((div_points2[8], (2,div_points1[8][1],-2),div_points3[8])) a_3_4 = rs.AddSweep2([csp2,ac_top],[sweepc2,sweepc21],False) a_4_4 = rs.AddSweep2([csp2,ac_top],[sweepc21],False) #HEAD #head top view pt_th1 = rs.AddPoint(0, -2, 0) pt_th2 = rs.AddPoint(1.7, -1, 0) #changeable x-coordinate (originally (1.7, -1, 0)) pt_th3 = rs.AddPoint(1.3, 1, 0) #changeable x-coordinate (originally (1.3, 1, 0)) pt_th4 = rs.AddPoint(0, 2, 0) pts_th = [pt_th1, pt_th2, pt_th3,pt_th4] hc_top = rs.AddCurve(pts_th, degree=2) #head side view top pt_sh1 = rs.AddPoint(0, -2, 0) pt_sh2 = rs.AddPoint(0, -2.2, 1.7) #changeable y-coordinate (originally (0, -2.2, 1.7)) pt_sh3 = rs.AddPoint(0, 1.8, 1.3) #changeable y-coordinate (originally (0, 1.8, 1.3)) pt_sh4 = rs.AddPoint(0, 2, 0) pts_sh = [pt_sh1, pt_sh2, pt_sh3,pt_sh4] hc_side = rs.AddCurve(pts_sh, degree=2) #head side view bottom pt_sh1b = rs.AddPoint(0, -2, 0) pt_sh2b = rs.AddPoint(0, -2, -0.4) #changeable y-coordinate (originally (0, -2, -0.4)) pt_sh3b = rs.AddPoint(0, 1.8, -0.8) #changeable y-coordinate (originally (0, 1.8, -0.8)) pt_sh4b = rs.AddPoint(0, 2, 0) pts_shb = [pt_sh1b, pt_sh2b, pt_sh3b,pt_sh4b] hc_sideb = rs.AddCurve(pts_shb, degree=2) #divide and sweep top half div_points4 = rs.DivideCurve(hc_top,12, True,True) if div_points4 and len(div_points4) == 13: div_ht1 = div_points4[11] div_points5 = rs.DivideCurve(hc_side,12, True,True) if div_points5 and len(div_points5)== 13: div_hs1 = div_points5[11] rs.ReverseCurve(hc_side) rs.ReverseCurve(hc_sideb) rs.ReverseCurve(hc_top) sweeph1=rs.AddCurve((div_ht1,(0.5,1.8,0.4),div_hs1)) h_1_4 = rs.AddSweep2([hc_side,hc_top],[sweeph1],False) #divide and sweep bottom half div_points6 = rs.DivideCurve(hc_sideb,12, True,True) if div_points6 and len(div_points6) == 13: div_hs1b = div_points6[2] sweeph2=rs.AddCurve((div_ht1,(0.3,1.8,-0.1),div_hs1b)) h_2_4 = rs.AddSweep2([hc_sideb,hc_top],[sweeph2],False) #LEG #parametr for legs rg = 0.5 #radius joint | change to make leg thicker/thinner (originally 0.5) rb = rg/2 #radius leg pt0 = rs.AddPoint(0.5,0,-0.3) pt1 = rs.AddPoint(1.5,0,-0.5) pt2 = rs.AddPoint(6,0.5,5) pt3 = rs.AddPoint(12,0,3) pt4 = rs.AddPoint(16,-1.5,-5) #changeable | longer/shorter/crocked leg (originally (16,-1.5,-5)) points = (pt0,pt1, pt2, pt3) leg_line = rs.AddPolyline(points) leg_p = rs.AddPipe(leg_line,0,rb) #leg end l_end = rs.AddCone(pt3, pt4, rb, cap=True) #joints #joint1 = rs.AddSphere(pt1,rg) #joint2 = rs.AddSphere(pt2,rg - 0.2) joint3 = rs.AddSphere(pt3,rg - 0.25) #joints = joint1, joint2, joint3 #array leg (4 on each side) leg_0 = rs.RotateObjects((leg_p,joint3,l_end),(0,0,0),-65, None, False) #changeable degree (org. 65) leg_2 = rs.RotateObjects(leg_0, (0,0,0), 45, None, True) #changeable degree (org. 45) leg_3_4 = rs.MirrorObjects((leg_0+leg_2),(0,0,0),(50,-2.5,0),True) leg_01 = rs.RotateObjects(leg_0,(0,0,0),- 25, (1,0,0),False) leg_1 = rs.RotateObjects(leg_01,(0,0,0),20, (0,1,0),False) legs = leg_1+leg_2+leg_3_4 #DETAILS #eyes eye_1 = rs.AddSphere((0.25,-2,0.5),0.2) eye_2 = rs.AddSphere((0.55,-1.95,0.6),0.15) #mouth mouth_c = rs.AddCurve(((0.25,-1.5,0.3),(0.25,-2.5,0),(0.4,-2.5,-0.7)),degree=3) mouth = rs.AddPipe(mouth_c, 0, 0.1,True) #spinnerets spin_pt1= rs.AddPoint(0.3,10,0) spin_pt2= rs.AddPoint(0.5,12,0) spin = rs.AddCone(spin_pt1,spin_pt2, 0.4, True) #MIRROR rs.MirrorObjects((a_1_4,a_2_4,a_3_4,a_4_4,h_1_4,h_2_4,eye_1,eye_2,mouth,spin),(0,0,0),(0,30,0),True) rs.MirrorObjects(legs,(0,0,0),(0,30,0),True) # Delete all points points = rs.ObjectsByType(rs.filter.point) if points: rs.DeleteObjects(points) # Delete all curves curves = rs.ObjectsByType(rs.filter.curve) if curves: rs.DeleteObjects(curves)