File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 11from  geometry_script  import  * 
22
33@tree ("Repeat Grid" ) 
4- def  repeat_grid (geometry : Geometry , columns : Int , rows : Int ):
4+ def  repeat_grid (
5+     geometry : Geometry ,
6+     columns : Int ,
7+     rows : Int ,
8+     spacing_x : Float  =  0.0 ,
9+     spacing_y : Float  =  0.0 
10+ ):
511   # measure your geometry’s bounds 
612    bbox  =  geometry .bounding_box ()
713    span_x  =  bbox .max .x  -  bbox .min .x 
814    span_y  =  bbox .max .y  -  bbox .min .y 
915
1016    # total grid size = N * object size 
11-     total_x  =  columns  *  span_x 
12-     total_y  =  rows     *  span_y 
17+     total_x  =  columns  *  span_x   +  ( columns   -   1 )  *   spacing_x 
18+     total_y  =  rows     *  span_y   +  ( rows   -   1 )  *   spacing_y 
1319
1420    # one extra vertex gives N cells 
1521    g  =  grid (
1622        size_x = total_x , size_y = total_y ,
17-         vertices_x = columns + 1 , vertices_y = rows + 1 
23+         vertices_x = columns   +   1 , vertices_y = rows   +   1 
1824    ).mesh .mesh_to_points ()
1925
2026    return  g .instance_on_points (instance = geometry )
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments