Advertisement
andreatomalini

Untitled

Jul 6th, 2022
674
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.25 KB | None
  1. import Rhino.Geometry as rg
  2. import math
  3.  
  4. import System.Drawing as SD
  5. import ghpythonlib.treehelpers as th
  6.  
  7.  
  8. def main(_pts, _front_door, _exterior_wall, _path, _filename):
  9.    
  10.     pts_list = th.tree_to_list(_pts, retrieve_base=lambda x: x)
  11.     full_path = _path + "\\" + _filename
  12.     image_out = SD.Bitmap(len(pts_list), len(pts_list[0]))
  13.    
  14.    
  15.    
  16.     for x in range(len(pts_list)):
  17.         for y in range(len(pts_list[x])):
  18.            
  19.             pt = pts_list[x][y]
  20.             col = SD.Color.FromArgb(255,0,0,0)
  21.            
  22.             cp_t = _exterior_wall.ClosestPoint(pt)[1]  
  23.             cp = _exterior_wall.PointAt(cp_t)          
  24.             if pt.DistanceTo(cp) < wall_dist:
  25.                
  26.                 inside_door = _front_door.Contains(pt, rg.Plane.WorldXY, 0.1)
  27.                 if inside_door == rg.PointContainment.Inside or inside_door == rg.PointContainment.Coincident:
  28.                     col= SD.Color.FromArgb(255,255,0,0)     #front door
  29.                 else:
  30.                     col= SD.Color.FromArgb(255,127,0,0)
  31.            
  32.             image_out.SetPixel(x, image_out.Height-y-1, col)
  33.            
  34.    
  35.    
  36.     image_out.Save(full_path);
  37.  
  38. if save:
  39.     main(points, front_door, exterior_wall, path, filename)
Advertisement
RAW Paste Data Copied
Advertisement