# Tactiverge Academy — companion code for "From sketch to solid"
# Lesson: https://tactiverge.win/academy/mechanical-design/cad-fundamentals/sketch-to-solid/
# Licence: MIT (see https://tactiverge.win/open-engineering/). Examples appear in lesson order.

# ── Example 1 ────────────────────────────────────────
import math

def mass_g(volume_mm3, density_g_cm3):
    return volume_mm3 / 1000 * density_g_cm3

plate = 60 * 40 * 5                      # mm³
hole = math.pi * (6 / 2) ** 2 * 5        # one 6 mm hole through 5 mm
volume = plate - 2 * hole

print(f"Volume: {volume:.0f} mm³")
print(f"PLA plastic (1.24 g/cm³): {mass_g(volume, 1.24):.1f} g")
print(f"Aluminium (2.70 g/cm³):   {mass_g(volume, 2.70):.1f} g")
