Skip to content

Instantly share code, notes, and snippets.

@stephensmitchell
Created October 14, 2025 10:35
Show Gist options
  • Select an option

  • Save stephensmitchell/e0282ab2f93268ca56308a3b85b438ca to your computer and use it in GitHub Desktop.

Select an option

Save stephensmitchell/e0282ab2f93268ca56308a3b85b438ca to your computer and use it in GitHub Desktop.
Polygon Incircle
#https://help.alibre.com/articles/#!alibre-help-v28/polygon-incircle
import math
# diameter of circle that fits inside polygon
Diameter = 100
# number of sides
Sides = 6
# calculate exterior diameter of polygon
EDia = Diameter / math.cos(math.pi / Sides)
# create part, create polygon sketch, extrude
P = Part('Hex')
S = P.AddSketch('Hexagon', P.GetPlane('XY-Plane'))
S.AddPolygon(0, 0, EDia, Sides, False)
P.AddExtrudeBoss('Hex Head', S, 10, False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment