kopia lustrzana https://github.com/carson-katri/geometry-script
Enhance repeat_grid function: add spacing parameters for customizable grid spacing
rodzic
08c3cd5d67
commit
24d9930ce0
|
@ -1,15 +1,21 @@
|
||||||
from geometry_script import *
|
from geometry_script import *
|
||||||
|
|
||||||
@tree("Repeat Grid")
|
@tree("Repeat Grid")
|
||||||
def repeat_grid(geometry: Geometry, columns: Int, rows: Int):
|
def repeat_grid(
|
||||||
|
geometry: Geometry,
|
||||||
|
columns: Int,
|
||||||
|
rows: Int,
|
||||||
|
spacing_x: Float = 0.0,
|
||||||
|
spacing_y: Float = 0.0
|
||||||
|
):
|
||||||
# measure your geometry’s bounds
|
# measure your geometry’s bounds
|
||||||
bbox = geometry.bounding_box()
|
bbox = geometry.bounding_box()
|
||||||
span_x = bbox.max.x - bbox.min.x
|
span_x = bbox.max.x - bbox.min.x
|
||||||
span_y = bbox.max.y - bbox.min.y
|
span_y = bbox.max.y - bbox.min.y
|
||||||
|
|
||||||
# total grid size = N * object size
|
# total grid size = N * object size
|
||||||
total_x = columns * span_x
|
total_x = columns * span_x + (columns - 1) * spacing_x
|
||||||
total_y = rows * span_y
|
total_y = rows * span_y + (rows - 1) * spacing_y
|
||||||
|
|
||||||
# one extra vertex gives N cells
|
# one extra vertex gives N cells
|
||||||
g = grid(
|
g = grid(
|
||||||
|
|
Ładowanie…
Reference in New Issue