import rhinoscriptsyntax as rs import random rs.EnableRedraw( 0 ) alleObjekte = rs.AllObjects() rs.DeleteObjects(alleObjekte) light_blue_color = [173, 216, 230] strong_yellow_color = [255, 255, 0] top_pyramid_pts = [] levels = 50 center_x = 50 center_y = 50 center_z = 50 lvl_length = 1 x = center_x y = center_y z = center_z for lvl in range(levels + 1): z = center_z + lvl_length x_min = center_x - int(lvl_length / 2) x_max = center_x + int(lvl_length / 2) for x in range(x_min, x_max + 1): y_min = center_y - int(lvl_length / 2) y_max = center_y + int(lvl_length / 2) if x == x_min or x == x_max: for y in range(y_min, y_max): pt = [x,y,z] top_pyramid_pts.append(pt) else: pt_1 = [x, y_min, z] pt_2 = [x, y_max, z] top_pyramid_pts.append(pt_1) top_pyramid_pts.append(pt_2) if lvl == levels: line_id = rs.AddLine(pt_1, pt_2) rs.ObjectColor(line_id, strong_yellow_color) lvl_length += 2 top_pyramids_pts_id = rs.AddPoints(top_pyramid_pts) rs.ObjectColor(top_pyramids_pts_id, light_blue_color) bottom_pyramid_pts = [] lvl_length = 1 x = center_x y = center_y z = center_z for lvl in range(levels + 1): z = center_z - lvl_length x_min = center_x - int(lvl_length / 2) x_max = center_x + int(lvl_length / 2) for x in range(x_min, x_max + 1): y_min = center_y - int(lvl_length / 2) y_max = center_y + int(lvl_length / 2) if x == x_min or x == x_max: for y in range(y_min, y_max): pt = [x,y,z] bottom_pyramid_pts.append(pt) else: pt_1 = [x, y_min, z] pt_2 = [x, y_max, z] bottom_pyramid_pts.append(pt_1) bottom_pyramid_pts.append(pt_2) if lvl == levels: line_id = rs.AddLine(pt_1, pt_2) rs.ObjectColor(line_id, strong_yellow_color) lvl_length += 2 bottom_pyramids_pts_id = rs.AddPoints(bottom_pyramid_pts) rs.ObjectColor(bottom_pyramids_pts_id, light_blue_color) center_pt_id = rs.AddPoint([center_x, center_y, center_z]) rs.ObjectColor(center_pt_id, strong_yellow_color) rs.ZoomExtents()