// A 3D-printing shop's quote: what a customer's model measures, what it weighs and costs in PLA or PETG,
// and their OBJ file turned into the STL the slicer takes.
//
//   quillo run models_3d.qwe      then open http://localhost:8080/model and http://localhost:8080/quote

use "models_3d.qwer"

route GET /model = {
    box: model3d_info("models_3d_sample.stl")?,
    pyramid: model3d_info("models_3d_sample.obj")?,
}

route GET /quote {
    let pla = model3d_print_estimate("models_3d_sample.stl", { infill: 0.2, price_per_kg: 25.0 })?
    let petg = model3d_print_estimate("models_3d_sample.stl", { density: 1.27, infill: 1.0, price_per_kg: 30.0, bed: [30.0, 30.0, 30.0] })?
    { pla: pla, petg_solid: petg }
}

route GET /convert {
    let n = model3d_to_stl("models_3d_sample.obj", "data/pyramid.stl", 1.0)?
    model3d_to_stl("models_3d_sample.obj", "data/pyramid-x2.stl", 2.0)?
    { triangles: n, original: model3d_info("data/pyramid.stl")?.volume, doubled: model3d_info("data/pyramid-x2.stl")?.volume }
}
