import rhinoscriptsyntax as rs import Rhino.Geometry as rg import math as m import random as ran def draw_cctv(): rs.EnableRedraw(False) cctv_bounds = [4,4,6] cctv_origin = rg.Point3d(-10,0,0) corner_1 = cctv_origin corner_2 = cctv_origin + rg.Vector3d.XAxis*cctv_bounds[0] corner_3 = cctv_origin + rg.Vector3d.XAxis*cctv_bounds[0] + rg.Vector3d.YAxis*cctv_bounds[1] corner_4 = cctv_origin + rg.Vector3d.YAxis*cctv_bounds[1] corner_5 = cctv_origin + rg.Vector3d.ZAxis*cctv_bounds[2] corner_6 = cctv_origin + rg.Vector3d.XAxis*cctv_bounds[0] + rg.Vector3d.ZAxis*cctv_bounds[2] corner_7 = cctv_origin + rg.Vector3d.XAxis*cctv_bounds[0] + rg.Vector3d.YAxis*cctv_bounds[1] + rg.Vector3d.ZAxis*cctv_bounds[2] corner_8 = cctv_origin + rg.Vector3d.YAxis*cctv_bounds[1] + rg.Vector3d.ZAxis*cctv_bounds[2] vx, vy, vz = rg.Vector3d.XAxis, rg.Vector3d.YAxis, rg.Vector3d.ZAxis length, width, height, thick = 4, 4, 1, 1 draw_L_left(cctv_origin, length, width, height, thick) draw_L_left_vert(cctv_origin, length, width, height, thick) draw_L_left(cctv_origin + vz*height, length, width, height, thick) draw_L_left_vert(cctv_origin + vz*height, length, width, height, thick) draw_L_left(cctv_origin + vz*height*2, length, width, height, thick) draw_pillars(cctv_origin + vz*height*2, length, width, height, thick) draw_pillars_vert(cctv_origin + vz*height*2, length, width, height, thick) draw_pillars(cctv_origin + vz*height*3, length, width, height, thick) draw_pillars_vert(cctv_origin+ vz*height*3, length, width, height, thick) draw_pillars(cctv_origin + vz*height*4, length, width, height, thick) draw_L_right(cctv_origin + vz*height*4, length, width, height, thick) draw_L_right_vert(cctv_origin + vz*height*4, length, width, height, thick) draw_L_right(cctv_origin + vz*height*5, length, width, height, thick) draw_L_right_vert(cctv_origin + vz*height*5, length, width, height, thick) draw_L_right(cctv_origin + vz*height*6, length, width, height, thick) return corner_1, corner_2, corner_3, corner_4, corner_5, corner_6, corner_7, corner_8 def draw_L_left(o, l, w, h, t): vx, vy, vz = rg.Vector3d.XAxis, rg.Vector3d.YAxis, rg.Vector3d.ZAxis rs.AddLine(o, o + vx*t) rs.AddLine(o, o + vy*w) rs.AddLine(o + vx*t, o + vx*t + vy*(w-t)) rs.AddLine(o + vy*w, o + vx*l + vy*w) rs.AddLine(o + vx*t + vy*(w-t), o + vx*l + vy*(w-t)) rs.AddLine(o + vx*l + vy*w, o + vx*l + vy*(w-t)) def draw_L_left_vert(o, l, w, h, t): vx, vy, vz = rg.Vector3d.XAxis, rg.Vector3d.YAxis, rg.Vector3d.ZAxis rs.AddLine(o, o + vz*h) rs.AddLine(o + vx*t, o + vx*t + vz*h) rs.AddLine(o + vy*w, o + vy*w + vz*h) rs.AddLine(o + vx*t + vy*(w-t), o + vx*t + vy*(w-t) + vz*h) rs.AddLine(o + vx*l + vy*w, o + vx*l + vy*w + vz*h) rs.AddLine(o + vx*l + vy*(w-t), o + vx*l + vy*(w-t) + vz*h) def draw_L_right(o, l, w, h, t): vx, vy, vz = rg.Vector3d.XAxis, rg.Vector3d.YAxis, rg.Vector3d.ZAxis rs.AddLine(o, o + vx*l) rs.AddLine(o, o + vy*t) rs.AddLine(o + vy*t, o + vy*t + vx*(l-t)) rs.AddLine(o + vx*l, o + vx*l + vy*w) rs.AddLine(o + vy*t + vx*(l-t), o + vx*(l-t) + vy*w) rs.AddLine(o + vx*l + vy*w, o + vx*(l-t) + vy*w) def draw_L_right_vert(o, l, w, h, t): vx, vy, vz = rg.Vector3d.XAxis, rg.Vector3d.YAxis, rg.Vector3d.ZAxis rs.AddLine(o, o + vz*h) rs.AddLine(o + vx*l, o + vx*l + vz*h) rs.AddLine(o + vy*t, o + vy*t + vz*h) rs.AddLine(o + vy*t + vx*(l-t), o + vy*t + vx*(l-t) + vz*h) rs.AddLine(o + vx*l + vy*w, o + vx*l + vy*w + vz*h) rs.AddLine(o + vx*(l-t) + vy*w, o + vx*(l-t) + vy*w + vz*h) def draw_pillars(o, l, w, h, t): vx, vy, vz = rg.Vector3d.XAxis, rg.Vector3d.YAxis, rg.Vector3d.ZAxis rs.AddLine(o, o + vx*t) rs.AddLine(o, o + vy*t) rs.AddLine(o + vx*t, o + vx*t + vy*t) rs.AddLine(o + vy*t, o + vx*t + vy*t) rs.AddLine(o + vx*(l-t) + vy*(w-t), o + vx*l + vy*(w-t)) rs.AddLine(o + vx*(l-t) + vy*(w-t), o + vy*w + vx*(l-t)) rs.AddLine(o + vx*l + vy*(w-t), o + vx*l + vy*w) rs.AddLine(o + vx*(l-t) + vy*w, o + vx*l + vy*w) def draw_pillars_vert(o, l, w, h, t): vx, vy, vz = rg.Vector3d.XAxis, rg.Vector3d.YAxis, rg.Vector3d.ZAxis rs.AddLine(o, o + vz*h) rs.AddLine(o + vx*t, o + vx*t + vz*h) rs.AddLine(o + vy*t, o + vy*t + vz*h) rs.AddLine(o + vx*t + vy*t, o + vx*t + vy*t + vz*h) rs.AddLine(o + vx*(l-t) + vy*(w-t), o + vx*(l-t) + vy*(w-t) + vz*h) rs.AddLine(o + vx*l + vy*(w-t), o + vx*l + vy*(w-t) + vz*h) rs.AddLine(o + vx*(l-t) + vy*w, o + vx*(l-t) + vy*w + vz*h) rs.AddLine(o + vx*l + vy*w, o + vx*l + vy*w + vz*h) objects = rs.ObjectsByLayer("Default") rs.DeleteObjects(objects) draw_cctv()