FoundationPartsPrimitivesRegular Polygon

Regular Polygon

RegularPolygon(center, n_sides, radius) is a 2D primitive: an n_sides-gon inscribed in a circle of radius around center. It expands to a Polygon of N lines and composes with Extrusion, Lathe, Loft, and Sweep.

s = Sketch(self.xy())
                    # RegularPolygon(center, n_sides, radius) inscribes
                    # an n-gon in a circle of given radius.
                    poly = RegularPolygon(s.origin, n_sides=n, radius=10)
                    self.add_operation(Extrusion(poly, end=4))
                    self.translate([0, 0, z])

Hexagons stay available as the Hexagon(center, radius) shorthand; RegularPolygon is the generalization for any side count.