2018-12-29 18:44:08 -05:00
|
|
|
import cadquery as cq
|
|
|
|
|
|
|
|
# 1. Establishes a workplane that an object can be built on.
|
|
|
|
# 1a. Uses the named plane orientation "front" to define the workplane, meaning
|
|
|
|
# that the positive Z direction is "up", and the negative Z direction
|
|
|
|
# is "down".
|
|
|
|
# 2. Creates a 3D box that will have a hole placed in it later.
|
|
|
|
result = cq.Workplane("front").box(3, 2, 0.5)
|
|
|
|
|
|
|
|
# 3. Select the lower left vertex and make a workplane.
|
|
|
|
# 3a. The top-most Z face is selected using the >Z selector.
|
|
|
|
# 3b. The lower-left vertex of the faces is selected with the <XY selector.
|
|
|
|
# 3c. A new workplane is created on the vertex to build future geometry on.
|
2021-01-31 19:00:21 +01:00
|
|
|
result = result.faces(">Z").vertices("<XY").workplane(centerOption="CenterOfMass")
|
2018-12-29 18:44:08 -05:00
|
|
|
|
|
|
|
# 4. A circle is drawn with the selected vertex as its center.
|
|
|
|
# 4a. The circle is cut down through the box to cut the corner out.
|
|
|
|
result = result.circle(1.0).cutThruAll()
|
|
|
|
|
|
|
|
# Displays the result of this script
|
|
|
|
show_object(result)
|