wobblyhead hg > 3dprints > hinged_box
changeset 9:4b89f95689a8
preview: turn the model so the front faces the default camera
part_view turns the preview 90 degrees about z so the front faces -y.
preview_cut now removes the +x half of the turned model, the right half
seen from the front, which keeps the hinge and latch profiles in the cut
face. Exports are not turned.
| author | ark |
|---|---|
| date | 2026-11-17 12:37 +0100 |
| parents | ac8f2ecb6c18 |
| children | a7a1b12fd6bf |
| files | main.scad |
| diffstat | 1 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/main.scad Tue Nov 17 12:32:19 2026 +0100 +++ b/main.scad Tue Nov 17 12:37:14 2026 +0100 @@ -1,11 +1,12 @@ // hinged box with filament hinge at the back and a hinged latch in front. // sized by its inner dimensions, e.g. for standing notepad paper. // x runs front (-x) to back (+x), y left to right, z up. +// the preview turns the model 90 degrees so the front faces -y. /* [part selection] */ // part to show or export part = "all"; // [all, body, lid, latch] -// cut away the -y half in preview +// cut away the +x half in preview, the right half seen from the front preview_cut = false; // show a content mockup in each cell in the assembly view preview_content = false; @@ -521,13 +522,16 @@ if (preview_content && $preview) _content(); } +// in preview, turn the model so its front faces the default camera at -y, +// and with preview_cut remove the +x half, the right half seen from the +// front. exports stay unturned module part_view() { cut_s = max(out_x/2 + latch_front_u, top_z) + (preview_lid_angle > 0 ? out_x : 0) + 1; - if ($preview && preview_cut) + if ($preview) difference() { - children(); - translate([-cut_s, -cut_s, -cut_s]) cube([2*cut_s, cut_s, 2*cut_s]); + rotate([0, 0, 90]) children(); + if (preview_cut) translate([0, -cut_s, -cut_s]) cube([cut_s, 2*cut_s, 2*cut_s]); } else children();
