# Welkom bij Q CadLab — een lokale leeromgeving voor CadQuery.
#
# Druk op  ▶ Uitvoeren  (of Ctrl/Cmd+Enter) om dit script uit te voeren.
# Open  Voorbeelden  rechtsboven om de progressieve voorbeelden te bekijken.

import cadquery as cq

Profiel_Z = 50
Profiel_s = 2.9
Profiel_r = 4.35
ProfielLengte = 300

Boringposities = [(0,100),(0,-100)]
Boringdiameter = 20

# LOD = level of detail
# 0 = Virtual reality
# 1 = Virtual reality PCVR
# 2 = Photorealistic rendering (Blender)

LOD = 2

Profiel = (
  cq.Workplane("XY")
  .box(Profiel_Z, Profiel_Z, ProfielLengte)
)

if (LOD == 1):
  Profiel = (
    Profiel.edges("|Z")
    .chamfer(Profiel_r / 2)
    .edges("|Z")
    .chamfer(Profiel_r / 4)
    .faces(">Z or <Z")
    .shell(-1 * Profiel_s)
  )

if (LOD >= 2):
  Profiel = (
    Profiel.edges("|Z")
    .fillet(Profiel_r)
    .faces(">Z or <Z")
    .shell(-1 * Profiel_s)
    .faces("<Y")
    .workplane()
    .pushPoints(Boringposities)
    .hole(Boringdiameter)
  )

result = Profiel