From 87d58150036b59e3cd5f70e0c294a6bdddd6c921 Mon Sep 17 00:00:00 2001 From: Doug Hawkins Date: Wed, 25 Mar 2020 14:07:35 -0600 Subject: [PATCH] Update libraries to fix deprecated child() & assign() calls. --- fonts.scad | 19 ++++++++++++------- gridbeam.scad | 6 +----- involute_gears.scad | 29 ++++++++++++----------------- layouts.scad | 4 ++-- multiply.scad | 9 ++++----- 5 files changed, 31 insertions(+), 36 deletions(-) diff --git a/fonts.scad b/fonts.scad index 91e2d17..770bc21 100644 --- a/fonts.scad +++ b/fonts.scad @@ -24,12 +24,15 @@ module bold_2d(bold,width=0.2,resolution=8) { for(j=[0:$children-1]) { if(bold) { union() { - child(j); - for(i=[0:resolution-1]) assign(dx=width*cos(360*i/resolution),dy=width*sin(360*i/resolution)) - translate([dx,dy]) child(j); + children(j); + for(i=[0:resolution-1]) { + dx=width*cos(360*i/resolution); + dy=width*sin(360*i/resolution); + translate([dx,dy]) children(j); + } } } else { - child(j); + children(j); } } } @@ -47,7 +50,9 @@ module polytext(charstring,size,font,line=0,justify=1,align=-1 char_shift_height=-char_height/2-align*char_height/2; char_thickness=font[0][2]; char_index_map=search(charstring,font[2],1,1); - for(i=[0:len(char_index_map)-1]) assign( thisCharIndex=char_index_map[i], x_pos=i*size+line_shift_x*size/char_width) { + for(i=[0:len(char_index_map)-1]) { + thisCharIndex=char_index_map[i]; + x_pos=i*size+line_shift_x*size/char_width; translate([x_pos,line*size+char_shift_height*size/char_height]) scale([size/char_width,size/char_height]) { if(char_thickness==0) bold_2d(bold,width=bold_width,resolution=bold_resolution) @@ -578,8 +583,8 @@ module braille_ascii_spec800(inString,dot_backing=true,cell_backing=false,justif x_shift=thisFont[0][0]; y_shift=thisFont[0][1]; theseIndicies=search(inString,thisFont[2],1,1); - for( i=[0:len(theseIndicies)-1]) translate([i*x_shift-(1-justify)*x_shift*len(theseIndicies)/2,-y_shift*(align+1)/2]) - assign(dotPattern=thisFont[2][theseIndicies[i]][6]) { + for( i=[0:len(theseIndicies)-1]) translate([i*x_shift-(1-justify)*x_shift*len(theseIndicies)/2,-y_shift*(align+1)/2]) { + dotPattern=thisFont[2][theseIndicies[i]][6]; if(dot_backing) translate([cell_d2d_spacing/2-dot_spacing/2-dot_d/2,line_d2d_spacing/2-dot_spacing-dot_d/2,-dot_h]) cube(size=[dot_spacing+dot_d,2*dot_spacing+dot_d,dot_h],center=false); if(cell_backing) translate([0,0,-dot_h]) diff --git a/gridbeam.scad b/gridbeam.scad index 33b7f6b..b7fd0b3 100644 --- a/gridbeam.scad +++ b/gridbeam.scad @@ -113,11 +113,7 @@ if (mode == "dxf") { } } -module translateBeam(v) { - for (i = [0 : $children - 1]) { - translate(v * beam_width) child(i); - } -} +module translateBeam(v) translate(v * beam_width) children([0 : $children - 1]); module topShelf(width, depth, corners) { if (mode == "model") { diff --git a/involute_gears.scad b/involute_gears.scad index c3fe21e..4a4ff07 100644 --- a/involute_gears.scad +++ b/involute_gears.scad @@ -400,11 +400,11 @@ module linear_exturde_flat_option(flat =false, height = 10, center = false, conv { if(flat==false) { - linear_extrude(height = height, center = center, convexity = convexity, twist= twist) child(0); + linear_extrude(height = height, center = center, convexity = convexity, twist= twist) children(0); } else { - child(0); + children(0); } } @@ -459,21 +459,16 @@ module involute_gear_tooth ( union () { - for (i=[1:res]) - assign ( - point1=involute (base_radius,start_angle+(stop_angle - start_angle)*(i-1)/res), - point2=involute (base_radius,start_angle+(stop_angle - start_angle)*i/res)) - { - assign ( - side1_point1=rotate_point (centre_angle, point1), - side1_point2=rotate_point (centre_angle, point2), - side2_point1=mirror_point (rotate_point (centre_angle, point1)), - side2_point2=mirror_point (rotate_point (centre_angle, point2))) - { - polygon ( - points=[[0,0],side1_point1,side1_point2,side2_point2,side2_point1], - paths=[[0,1,2,3,4,0]]); - } + for (i=[1:res]) { + point1=involute (base_radius,start_angle+(stop_angle - start_angle)*(i-1)/res); + point2=involute (base_radius,start_angle+(stop_angle - start_angle)*i/res); + side1_point1=rotate_point (centre_angle, point1); + side1_point2=rotate_point (centre_angle, point2); + side2_point1=mirror_point (rotate_point (centre_angle, point1)); + side2_point2=mirror_point (rotate_point (centre_angle, point2)); + polygon ( + points=[[0,0],side1_point1,side1_point2,side2_point2,side2_point1], + paths=[[0,1,2,3,4,0]]); } } } diff --git a/layouts.scad b/layouts.scad index bec8de7..99496aa 100644 --- a/layouts.scad +++ b/layouts.scad @@ -31,7 +31,7 @@ module list(iHeight) { for (i = [0 : $children-1]) - translate([0,i*iHeight]) child(i); + translate([0,i*iHeight]) children(i); } module grid(iWidth,iHeight,inYDir = true,limit=3) { @@ -39,6 +39,6 @@ module grid(iWidth,iHeight,inYDir = true,limit=3) { translate([(inYDir)? (iWidth)*(i%limit) : (iWidth)*floor(i/limit), (inYDir)? (iHeight)*floor(i/limit) : (iHeight)*(i%limit)]) - child(i); + children(i); } } \ No newline at end of file diff --git a/multiply.scad b/multiply.scad index bca12c3..3bdb63e 100644 --- a/multiply.scad +++ b/multiply.scad @@ -13,17 +13,16 @@ use // Duplicate everything $no of times around an $axis, for $angle/360 rounds module spin(no, angle=360, axis=Z){ for (i = [1:no]){ - rotate(normalized_axis(axis)*angle*no/i) union(){ - for (i = [0 : $children-1]) child(i); - } + rotate(normalized_axis(axis)*angle*no/i) + union() children([0 : $children-1]); } } //Doesn't work currently -module duplicate(axis=Z) spin(no=2, axis=axis) child(0); +module duplicate(axis=Z) spin(no=2, axis=axis) children(0); module linear_multiply(no, separation, axis=Z){ for (i = [0:no-1]){ - translate(i*separation*axis) child(0); + translate(i*separation*axis) children(0); } }