import rhinoscriptsyntax as rs import math rs.DeleteObjects(rs.AllObjects()) rs.EnableRedraw(False) #### BOXEN #### boxes = {"box": [60, 65, 0.5]} #### SPIRALE #### point0 = [0, 0, 0] point1 = [0, 0, 1] height = 200 turns = 1 radius1 = 20 radius0 = radius1 spiral = rs.AddSpiral(point0, point1, height, turns, radius0, radius1) #### PUNKTE #### segments = 40 pts = rs.DivideCurve(spiral, segments, False, True) rs.DeleteObject(spiral) ########## COMMANDS ########## #### box skaliert #### def create_scaled_box(box_size, scale_factor): xsize, ysize, zsize = [dim * scale_factor for dim in box_size] return [[0, 0, 0], [xsize, 0, 0], [xsize, ysize, 0], [0, ysize, 0], [0, 0, zsize], [xsize, 0, zsize], [xsize, ysize, zsize], [0, ysize, zsize]] # box_size = (xsize, ysize, zsize) --> corners of the box # scale_factor = factor by which the box will be scaled #### ARRANGE AND ROTATE #### scale_factor = 0.4 for i, p in enumerate(pts): scafa = 1 - (p[2] / height) * scale_factor scaled_box = create_scaled_box(boxes["box"], scafa) box = rs.AddBox(scaled_box) rs.MoveObject(box, p) rot = i / float(segments) angle = rot * 2 * math.pi * turns rs.RotateObject(box, p, math.degrees(angle), [0, 0, 1]) ####ZYLINDER#### plane = [0,0,0] hoehe = height top_plane = [0, 0, hoehe] radius = radius0 #anfangskreis unten# cir = rs.AddCircle(plane, radius) path = rs.AddLine([0,0,0],[0,0,hoehe]) rs.ExtrudeCurve(cir, path) #endkreis oben# top_circle = rs.AddCircle(top_plane, radius) top_path = rs.AddLine([0,0,hoehe], [0,0,hoehe+1]) top_surface = rs.ExtrudeCurve(top_circle, top_path) rs.CapPlanarHoles(top_surface) crvs = {cir,path,top_circle} rs.DeleteObjects(crvs)