gumyr/build123d

Add major_radius bool to HexLocations

Closed this issue · 2 comments

Currently RegularPolygon supports bool major_radius that defaults to True. In order to place hexagonal regular polygons with sides touching with the default option, one must use math to convert the major radius to minor radius (aka the apothem). I propose adding HexLocations(... major_radius: bool = False) which will preserve the existing default behavior, while allowing for better interoperability between RegularPolygon and HexLocations.

with BuildSketch() as s:
    with HexLocations(1,3,3):
        RegularPolygon(1,6)

image

If one does this:

with BuildSketch() as s:
    with HexLocations(1, 3, 3):
        RegularPolygon(1, 6, major_radius=False)

the hexes touch each other. Is the problem that you want to work with a major radius for both HexLocations and RegularPolygon?

Yes, that is the use-case that I would like to make a bit easier.