gumyr / build123d

A python CAD programming library
Apache License 2.0
382 stars 72 forks source link

Add major_radius bool to HexLocations and rename apothem parameter to radius #643

Closed jdegenstein closed 1 week ago

jdegenstein commented 1 week ago

This PR fixes https://github.com/gumyr/build123d/issues/633 by adding a major_radius: bool to HexLocations that defaults to False (to preserve current behavior). This PR is technically breaking because the prior apothem parameter had to be named to a more generic radius which can be either a major radius or minor radius (aka apothem).

Here is an example of the new functionality:

hex = RegularPolygon(1, 6)
with BuildSketch() as s:
    with HexLocations(1, 3, 3, False) as hloc:
        add(hex)
    with Locations((6,0)):
        with HexLocations(1, 3, 3, True) as hloc2:
            add(hex)

image

gumyr commented 1 week ago

Looks good to me. Your use case for this was something I didn't envision but is perfectly valid. Two of the examples would be broken though.

jdegenstein commented 1 week ago

Fixed the two examples and merged.