Fix for render

This commit is contained in:
Sébastien Dante Ursini 2025-02-17 12:08:01 -03:00
parent a13e2a7399
commit 350b76c867

View File

@ -5,7 +5,6 @@ include <Typography/typo.scad>
A4_LANDSCAPE= [297,210]; A4_LANDSCAPE= [297,210];
title_block_debugging = false; title_block_debugging = false;
experimental = true; experimental = true;
@ -31,35 +30,32 @@ module titleBlock(
) { ) {
w = rect[0]; w = rect[0];
h = rect[1]; h = rect[1];
interline = 7;
_inset = inset> 0 ? inset : h/20; _inset = inset> 0 ? inset : h/20;
//path = rect([w,h], chamfer=0 /*, anchor=FRONT*/); //path = rect([w,h], chamfer=0 /*, anchor=FRONT*/);
attachable(anchor,spin,orient, size=[w,h,50]) { attachable(anchor,spin,orient, size=[w,h,50]) {
color(color) union() { projection( cut = false ) recolor(color) union() {
//recolor("Yellow") stroke(path, closed=true,width=strokeWidth); // ************ Frame ***************
rect_tube(size=[w,h], wall=0.5, h=0.1); rect_tube(size=[w,h], wall=0.5, h=0.1);
// Title
l1 = h/2 - _inset; l1 = h/2 - _inset;
l2 = l1 - interline- 2*_inset ;
// ************ Project *************** // ************ Project ***************
translate([-w /2+_inset, l1 ]) translate([-w /2+_inset, l1 ])
linear_extrude(0.1) text(project, size=textSize,halign="left",anchor=TOP,font="Saira Stencil One"); linear_extrude(0.1)
text(project, size=textSize,halign="left",anchor=TOP,font="Saira Stencil One");
metrics = textmetrics(project, size=textSize, font="Saira Stencil One");
// Scale
//translate([w/2-_inset, h/2 - _inset])
// ************ Scale *************** // ************ Scale ***************
translate([w/2-_inset, l1]) translate([w/2-_inset, l1])
linear_extrude(0.1) text(str("Scale: 1/",scale), size=textSize*2/5,halign="right",anchor=TOP); linear_extrude(0.1)
text(str("Scale: 1/",scale), size=textSize*2/5,halign="right",anchor=TOP);
// ************ Title *************** // ************ Title ***************
l2 = l1 - metrics.size[1]- 2*_inset ; //metrics = textmetrics(project, size=textSize, font="Saira Stencil One");
//l2 = l1 - metrics.size[1]- 2*_inset ;
if ( title ) if ( title )
translate([-w /2+_inset, l2 ]) translate([-w /2+_inset, l2 ])
linear_extrude(0.1) text( title, size=textSize*2/3,halign="left",anchor=TOP,font="Arial Black"); linear_extrude(0.1) text( title, size=textSize*2/3,halign="left",anchor=TOP,font="Arial Black");
// ************ Description *************** // ************ Description ***************
echo ("Description",description); if ( description ) {
if ( description && false ) {
translate([ -8, l2 - _inset/2 ]) translate([ -8, l2 - _inset/2 ])
linear_extrude(0.1) linear_extrude(0.1)
smartText( smartText(
@ -67,36 +63,25 @@ module titleBlock(
size=textSize*1/4, size=textSize*1/4,
halign="left", halign="left",
font="Arial", font="Arial",
//style="italic", style="italic",
max_width = 51 max_width = 51
); );
} }
h1 = h/2-2*_inset - interline;
// ********** Horizontal line ********* translate([-w/2+_inset,h1,0]) cube([w-2*_inset,0.1,0.1]);
h1 = h/2-2*_inset - metrics.size[1]; // ************ Vertical sep ***************
translate([10,interline-1*_inset/2,0]) cube([0.1,interline,0.1]);
if (false) stroke([
[-w /2+_inset, h1],
[+w /2-_inset, h1]
],
width=0.2);
// Vertical sep
if (false) stroke([
[-w/2+3*_inset+metrics.size[0] ,h/2-_inset],
[-w/2+3*_inset+metrics.size[0] ,h/2-2*_inset - metrics.size[1]]]
,width=0.2);
// ************ Revision *************** // ************ Revision ***************
translate([-w /2+_inset, -h/2 + _inset]) translate([-w /2+_inset+14, -h/2 + 2*_inset]) {
linear_extrude(0.1) text(str("Revision:",revision), size=textSize*2/5/*,anchor=BOTTOM*/); linear_extrude(0.1) text("Revision:", size=textSize*2/5, anchor = RIGHT, font = "Arial:style=Italic");
linear_extrude(0.1) text(str(revision), size=textSize*2/5, anchor = LEFT,font = "Arial:style=Bold");
}
// ************ Date *************** // ************ Date ***************
translate([w/2-_inset, -h/2 + _inset]) translate([w/2-_inset-16, -h/2 + 2*_inset]) {
linear_extrude(0.1) text(str("Date:",date), size=textSize*2/5,halign="right"); linear_extrude(0.1) text("Date:", size=textSize*2/5,halign="right", anchor = RIGHT, font = "Arial:style=Italic");
linear_extrude(0.1) text(str(date), size=textSize*2/5, anchor = LEFT,font = "Arial:style=Bold");
}
}; };
children(); children();
}; };
} }
@ -112,9 +97,9 @@ module A4( margin = 10, landscape = true, onlyMargin = true, anchor=CENTER, spin
projection( cut = false ) union(){ projection( cut = false ) union(){
if (!onlyMargin) if (!onlyMargin)
color("Orange") color("Orange")
rect_tube(size=[w,h], wall=0.5, h=0.1); rect_tube(size=[w,h], wall=0.1, h=0.1);
color("Red") color("Red")
rect_tube(size=[marginW,marginH], wall=0.5, h=0.1); rect_tube(size=[marginW,marginH], wall=0.1, h=0.1);
}; };
children(); children();
} }
@ -129,21 +114,18 @@ module plan(
scale = 1, scale = 1,
revision = "1a", revision = "1a",
page = "A4" page = "A4"
) )
{ {
//rect=[90,30];
A4( onlyMargin = false, anchor=LEFT+FWD, scale=2 ) { A4( onlyMargin = false, anchor=LEFT+FWD, scale=2 ) {
//align(align=TOP+LEFT+FWD,spin=[0, 0, 0],inside=true) //align(align=TOP+LEFT+FWD,spin=[0, 0, 0],inside=true)
//attach(LEFT+FWD,/*RIGHT,inside=true*/) //attach(LEFT+FWD,/*RIGHT,inside=true*/)
//align(LEFT,inside=true) //align(LEFT,inside=true)
align(FWD+RIGHT,inside=true) { if (true) align( FWD+RIGHT,inside=true ) {
titleBlock( titleBlock(
project, project,
title = title, title = title,
description = description, description = description,
textSize = 7, //textSize = 7,
rect = [90,30], rect = [90,30],
inset = 2 inset = 2
); );
@ -152,12 +134,6 @@ module plan(
align(BACK+LEFT,inside=true) { align(BACK+LEFT,inside=true) {
children(); children();
} }
//cuboid([50,20,10],anchor=TOP);
//cube([100,100,100]);
//align(FWD+RIGHT,spin=[0, 0, 1],orient=UP) {
//}
} }
} }
@ -171,13 +147,9 @@ if ( title_block_debugging ) {
"Title Block", "Title Block",
title="Sub title", title="Sub title",
description=lorem, description=lorem,
textSize=7,
//spin = 0
//rect=[90,30],
//inset=2
) { ) {
projection( cut = false ) cube([100,100,100]); //projection( cut = false ) cube([100,100,100]);
} }