cadquery-freecad-module/CadQuery/Examples/Ex008_Polygon_Creation.py

17 lines
578 B
Python

#This example is meant to be used from within the CadQuery module of FreeCAD.
import cadquery
import Part
#The dimensions of the model. These can be modified rather than changing the box's code directly.
width = 3.0
height = 4.0
thickness = 0.25
polygon_sides = 6
polygon_dia = 1.0
#Create a plate with two polygons cut through it
result = cadquery.Workplane("front").box(width, height, thickness).pushPoints([(0, 0.75), (0, -0.75)]) \
.polygon(polygon_sides, polygon_dia).cutThruAll()
#Boiler plate code to render our solid in FreeCAD's GUI
Part.show(result.toFreecad())