m4_dnl ix is a corner number
m4_dnl expands to two comma-separated corners:
m4_dnl that denoted by ix, and the next one anticlockwise
-m4_define(`R_EDGE',`$1[$2],$1[(($2)+1)%4]')
+m4_define(`R_EDGE',`$1[$2], $1[(($2)+1)%4]')
+
+m4_dnl R_CNR(c,ix)
+m4_dnl c is from Rectangle_corners and
+m4_dnl ix is a corner number
+m4_dnl expands to an array of corners as for RoundCorner
+m4_define(`R_CNR',`[ $1[$2], $1[(($2)+1)%4], $1[(($2)+3)%4] ]')
m4_dnl INREFFRAME(left_cnr, right_cnr, morevars) { body; }
m4_define(`INREFFRAME',`
module RoundCorner_selector(ci, adj) {
ROUNDCORNER_VARS;
- echo("RCS",l_uvec,ctr);
- %union(){
- INREFFRAME(this_cnr, right_cnr) {
- cube(bigr*2 + adj, center=true);
- }
- }
intersection(){
union(){
INREFFRAME(ctr3,concat(lp1,[4])){
[ 0, 0]
];
corners = TestPiece_holes2corners(holes);
- rcs = [corners[0], corners[1]];
+ rcs = R_CNR(corners,0);
difference(){
union(){
TileBase(corners[0], corners[2]);
c0 = tile02_tr + -sz;
c = Rectangle_corners(c0, sz);
posts = Rectangle_corners2posts(c);
- rcs = [R_EDGE(c,0)];
+ rcs = R_CNR(c,0);
difference(){
union(){
Rectangle_TileBase(c);
c0 = tile02_tr + [-sz[0], 0];
c = Rectangle_corners(c0, sz);
posts = Rectangle_corners2posts(c);
- rcs = [R_EDGE(c,3)];
+ rcs = R_CNR(c,3);
difference(){
union(){
Rectangle_TileBase(c);
cnr_posts[1] + [ 0, rcy ],
cnr_posts[2],
cnr_posts[3] ];
- rcs = [R_EDGE(c,2)];
+ rcs = R_CNR(c,2);
difference(){
union(){
Rectangle_TileBase(c);
cnr_posts[2] + [ -sz[0] + rearedge_len - cutout_l_end_x, -cty ],
cnr_posts[3] + [ 0, -cty ]
];
- rcs = [R_EDGE(c,1)];
+ rcs = R_CNR(c,1);
+ rc2 = [c1bis,c2bis,c[1]];
difference(){
union(){
difference(){
RoundEdge(c1bis, c2bis);
}
Machine();
+ RoundCornerCut(rc2);
}
RoundCornerAdd(rcs);
- RoundCornerAdd([c1bis,c2bis,c[1]]);
+ RoundCornerAdd(rc2);
}
module FitTest_FrontCurve(){ ////toplevel
}
module RoundCornerDemo(){ ////toplevel
- cnr = [ [0,0], [15,0], [-10,12] ];
+ cnr = [ [-2,-3], [13,-3], [-12,9] ];
translate([0,25,0]) RoundCornerDemo_plat(cnr);
translate([25,0,0]) RoundCornerAdd(cnr);
translate([-25,0,0]) RoundCornerCut(cnr);