Closed gumyr closed 1 year ago
Unlimited levels of nesting is now supported. Grids within Polar will be appropriately rotated.
from build123d import *
with BuildSketch() as nested_grid:
with Locations((-2, -2), (2, 2)):
with GridLocations(1, 1, 2, 2) as grid:
Circle(0.1)
with BuildSketch() as nested_locations:
with Locations((-2, 2), (2, -2)):
with Locations((-0.5, -0.5), (0.5, 0.5)):
Circle(0.1)
with BuildSketch() as nested_hex:
with Locations((-1, 0), (1, 0)):
with HexLocations(0.4, 3, 3):
Circle(0.1)
with BuildSketch() as nested_single_polar:
with PolarLocations(6, 3) as p:
with GridLocations(1, 1, 2, 2) as grid:
Circle(0.1)
with BuildSketch() as nested_double_polar:
with PolarLocations(10, 12):
with GridLocations(2, 2, 2, 2):
with HexLocations(0.4, 3, 3):
Circle(0.1)
if "show_object" in locals():
show_object(nested_grid.sketch, name="nested grid")
show_object(nested_locations.sketch, name="nested locations")
show_object(nested_hex.sketch, name="nested hex")
show_object(nested_single_polar.sketch, name="nested_single_polar")
show_object(nested_double_polar.sketch, name="nested_double_polar")
All of these should produce the same results: