include A4_LANDSCAPE= [297,210]; debugging = false; module titleBlock( project, textSize=6, date="2025-01-01", scale=1, revision="1a", rect=[90,30], inset=10, anchor=CENTER, spin=0, orient=UP //anchor=CENTER,spin=0,orient=LEFT ) { w = rect[0]; h = rect[1]; _inset = inset> 0 ? inset : h/20; echo("w",w); echo("h",h); echo("inset",_inset); // Border path = rect([w,h], chamfer=0 /*, anchor=FRONT*/); //color("Blue") //back(-50/2) //square(rect, center=true); //attachable( anchor,orient,/*anchor, spin, orient,*/size=[w,h,0] /*,axis=RIGHT*/ ) { attachable(anchor,spin,orient, size=[w,h,50]) { union() { stroke(path, closed=true); // Title translate([-w /2+_inset, h/2 - _inset ]) text(project, size=textSize,halign="left",anchor=TOP); // Revision translate([-w /2+_inset, -h/2 + _inset]) text(str("Revision:",revision), size=textSize*2/3/*,anchor=BOTTOM*/); // Scale translate([w/2-_inset, h/2 - _inset]) text(str("Scale: 1:",scale), size=textSize*2/3,halign="right",anchor=TOP); // Date translate([w/2-_inset, -h/2 + _inset]) text(str("Date:",date), size=textSize*2/3,halign="right"); }; children(); }; } module A4( margin = 10, landscape = true, onlyMargin = true, anchor=CENTER, spin=0, orient=UP ){ //a4= [297,210]; w = A4_LANDSCAPE[0]; h = A4_LANDSCAPE[1]; marginW = w-2*margin; marginH = h-2*margin; contour = rect([w,h]); //translate([w/2,h/2,0]) //attachable(size=[100,200,0] ) { // attachable( /*anchor=anchor, , spin, orient,*/size=[marginW,marginH,0] ) { attachable(anchor,spin,orient, size=[marginW,marginH,50]) { union(){ if (!onlyMargin) color("Orange") stroke(contour, closed=true); marginPath = rect([marginW,marginH]); color("Red") stroke(marginPath, closed=true); }; //} children(); } } if ( debugging ) { //titleBlock("My First Project"); A4( onlyMargin = false,anchor=LEFT+FWD ) //align(align=TOP+LEFT+FWD,spin=[0, 0, 0],inside=true) //attach(LEFT+FWD,/*RIGHT,inside=true*/) //align(LEFT,inside=true) align(FWD+RIGHT,inside=true) titleBlock("Metal Desk",textSize=7,rect=[90,30],inset=2); //cuboid([50,20,10],anchor=TOP); }