+ upp_app_Vars(bevel) upp_app_Profile();
+}
+
+module NearAnchorProfile(){
+ upp_app_Vars(a_bevel) upp_app_Profile();
+}
+
+module AnchorProfile(){
+ upp_app_Vars(a_bevel) {
+
+ upp_app_Profile();
+
+ difference(){
+ hull(){
+ polygon([ $xppE,
+ $xppF,
+ $xppF + [0,1],
+ $xppE + [1,0] ],
+ convexity=10);
+ translate(appM) circle(r= anchor_b);
+ }
+ translate(appM) circle(r= anchor_rad);
+ }
+ }
+}
+
+module AnchorWallProfile(){
+ UsualProfile();
+ NearAnchorProfile();
+ hull(){
+ for (bev = [bevel, a_bevel]) {
+ upp_app_Vars(bev) {
+ polygon([ $xppE,
+ $xppF,
+ $xppI,
+ $xppJ ],
+ convexity=10);
+ }
+ }
+ }
+}
+
+module WebProfile(){
+ upp_app_Vars(a_bevel){
+ if ($gppR[1] <= $gppP[1]) {
+ polygon([ $gppP,
+ $xppE,
+ $gppT,
+ $gppQ ]);
+ polygon([ $gppP,
+ $xppE,
+ $xppF,
+ $gppS,
+ $gppR ],
+ convexity=10);
+ } else {
+ polygon([ $gppP,
+ $xppE,
+ $xppF,
+ $gppS,
+ $gppP + web_height * [1,0] ],
+ convexity=10);
+ }
+ polygon([ $gppS,
+ $xppF,
+ $xppF + [1,0],
+ $gppS + [1,0] ],
+ convexity=10);
+ }
+}
+
+module SomeBaseProfile(I, F){
+ polygon([ I,
+ F,
+ [ hsz+1, F[1] ],
+ [ hsz+1, I[1] ] ]);
+}
+
+module BaseProfile(){
+ SomeBaseProfile($xppI, $xppF);
+}
+
+module SWalls(ymin, ymax, t_bevel) {
+ upp_app_Vars(t_bevel) {
+ translate([0,ymin,0])
+ mirror([0,1,0])
+ rotate([90,0,0])
+ linear_extrude(height= ymax-ymin, convexity=10)
+ for (xm=[0,1])
+ mirror([xm,0])
+ translate([-hsz, 0])
+ children();
+ }
+}
+
+module KsafeBase(){
+ /// corners
+ for (xm=[0,1]) for (ym=[0,1]) {
+ mirror([xm,0,0]) mirror([0,ym,0])
+ translate((hsz - cnr_rad) * [1,1])
+ intersection(){
+ rotate_extrude(convexity=10)
+ translate([-cnr_rad,0])
+ UsualProfile();
+ translate([0,0,-250])
+ cube([50,50,500]);
+ }
+ }
+
+ // side walls and base
+ SWalls(yw6 , yw4 , bevel ) { UsualProfile(); BaseProfile(); }
+ SWalls(yw5 , yw4 , a_bevel) { AnchorWallProfile(); BaseProfile(); }
+ SWalls(yw5 , yw12, a_bevel) { NearAnchorProfile(); BaseProfile(); }
+ SWalls(yw3 , yw2 , a_bevel) { AnchorProfile(); BaseProfile(); }
+ SWalls(yw11, yw12, a_bevel) { AnchorWallProfile(); BaseProfile(); }
+ SWalls(yw11, yw13, bevel ) { UsualProfile(); BaseProfile(); }
+ SWalls(yw1, yw10, a_bevel) { WebProfile(); SomeBaseProfile($gppS, $xppF); }
+}
+
+module DemoProfiles(){
+ translate([0,0,-2]) color("yellow") AnchorWallProfile();
+ color("red") AnchorProfile();
+ translate([0,0,2]) color("black") NearAnchorProfile();
+ translate([0,0,4]) color("blue") UsualProfile();
+ translate([0,0,-4]) color("pink") WebProfile();
+}
+
+//DemoProfiles();
+KsafeBase();