Update libraries to fix deprecated child() & assign() calls.

This commit is contained in:
Doug Hawkins 2020-03-25 14:07:35 -06:00
parent ad7fbd6809
commit 87d5815003
5 changed files with 31 additions and 36 deletions

View file

@ -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])

View file

@ -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") {

View file

@ -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]]);
}
}
}

View file

@ -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);
}
}

View file

@ -13,17 +13,16 @@ use <utilities.scad>
// 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);
}
}