Posted by appjaws1

poor maths again October 11, 2015 12:22PM |
Registered: 9 years ago Posts: 780 |

I'm trying to construct a small scad to produce 20 holes in a platform of increasing size of 0.05 whilst maintaining the same distance between adjacent hole edges.

this is what I have tried

difference(){

cube ([100,8,3]);

for (x= [1:5:100]){

for (y=[3.0:0.05:4.9]){

translate([x,3+y,-0.1]) cylinder(h=4,r=y+0.05);

}}

It will be obvious that for each value of x it produced all values of y, I only want 1 value of y for each value of x but y increased by 0.05.

My maths is so poor that I can't see how to do this.

Thanks for any help

appjaws - Core XYUV Duet Ethernet Duex5

firmware 3.1.1 Web Interface 3.1.1

Ormerod 1-converted to laser engraver, Duet wifi

OpenSCAD version 2020.07

slic3r-1.3.0, Simplify3D 4.1.2, Cura-4.4.1

this is what I have tried

difference(){

cube ([100,8,3]);

for (x= [1:5:100]){

for (y=[3.0:0.05:4.9]){

translate([x,3+y,-0.1]) cylinder(h=4,r=y+0.05);

}}

It will be obvious that for each value of x it produced all values of y, I only want 1 value of y for each value of x but y increased by 0.05.

My maths is so poor that I can't see how to do this.

Thanks for any help

appjaws - Core XYUV Duet Ethernet Duex5

firmware 3.1.1 Web Interface 3.1.1

Ormerod 1-converted to laser engraver, Duet wifi

OpenSCAD version 2020.07

slic3r-1.3.0, Simplify3D 4.1.2, Cura-4.4.1

Re: poor maths again October 11, 2015 01:52PM |
Registered: 9 years ago Posts: 14,639 |

difference(){ cube([100,8,3]); for(i=[0:19]){ translate([1 + 5*i, 6+0.05*i, -0.1]) cylinder(h=4,r=3.05 + 5*i); } }

Edited 2 time(s). Last edit at 10/11/2015 01:53PM by dc42.

Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].

Re: poor maths again October 11, 2015 02:06PM |
Registered: 9 years ago Posts: 780 |

Thanks, I can see your approach, but it didn't work and even if it did I would end up with some big holes, when the maximum should be 5mm diameter

Just to clarify, the radius of each hole should increase by 0.05 and the distance between holes should increase by 0.05.

Holes should have a diameter in the range 3.0 to 5.0 in steps of 0.1mm.

Hope thats clearer

Thanks for your help.

appjaws - Core XYUV Duet Ethernet Duex5

firmware 3.1.1 Web Interface 3.1.1

Ormerod 1-converted to laser engraver, Duet wifi

OpenSCAD version 2020.07

slic3r-1.3.0, Simplify3D 4.1.2, Cura-4.4.1

Just to clarify, the radius of each hole should increase by 0.05 and the distance between holes should increase by 0.05.

Holes should have a diameter in the range 3.0 to 5.0 in steps of 0.1mm.

Hope thats clearer

Thanks for your help.

appjaws - Core XYUV Duet Ethernet Duex5

firmware 3.1.1 Web Interface 3.1.1

Ormerod 1-converted to laser engraver, Duet wifi

OpenSCAD version 2020.07

slic3r-1.3.0, Simplify3D 4.1.2, Cura-4.4.1

Re: poor maths again October 11, 2015 02:29PM |
Registered: 8 years ago Posts: 590 |

I am not sure if I understand exactly what you are trying to do. But if you are looking for this kind of object

here is how I constructed it:

In your case for holes ranging from 3.0 to 5.0mm with 0.1m increment step and 0.05mm gap, the call would be

here is how I constructed it:

module holes( n, // number of holes r, // initial radius step, // increase step for radius gap, // gap between holes height, // height of holes ){ translate([r,0,0])cylinder(r=r,h=height); if(n>1)translate([2*r+gap,0,0])holes(n-1,r+step,step,gap,height); } module BlockOfHoles( n, // number of holes r, // initial radius step, // increase step for radius gap, // gap between holes height, // height of block margin,// margin outside holes ){ difference(){ cube([2*margin+(2*r+(n-1)*step)*n+(n-1)*gap,2*(r+(n-1)*step+margin),height]); translate([margin,r+(n-1)*step+margin,-1])holes(n,r,step,gap,height+2,$fn=24); } } BlockOfHoles(n=10,r=1,step=1,gap=0.5,height=10,margin=1);

In your case for holes ranging from 3.0 to 5.0mm with 0.1m increment step and 0.05mm gap, the call would be

BlockOfHoles(n=21,r=1.5,step=0.05,gap=0.05,height=3,margin=1);

Re: poor maths again October 11, 2015 03:09PM |
Registered: 9 years ago Posts: 780 |

Re: poor maths again October 11, 2015 05:14PM |
Registered: 9 years ago Posts: 14,639 |

Quoteappjaws1

Thanks, I can see your approach, but it didn't work and even if it did I would end up with some big holes, when the maximum should be 5mm diameter

Just to clarify, the radius of each hole should increase by 0.05 and the distance between holes should increase by 0.05.

Holes should have a diameter in the range 3.0 to 5.0 in steps of 0.1mm.

Hope thats clearer

Thanks for your help.

Sorry, typo in 4th line. The final 5*i should be 0.05*i.

Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].

Re: poor maths again October 12, 2015 05:06AM |
Registered: 9 years ago Posts: 780 |

@dc42 Thanks for this, I like a small solution but it's not quite right yet.

difference(){

cube([200,18,3]);

for(i=[0:19]){

translate([5 + 5*i, 6+0.05*i, -0.1]) cylinder(h=4,r=3.05 + 0.05*i);

}}

This is what I tried and as you can see the gaps between holes are reducing as the holes get larger. What I wanted was the gap between holes to remain the same.

difference(){

cube([200,18,3]);

for(i=[0:19]){

translate([5 + 10*i+3.05 + 0.05*i, 5+0.05*i, -0.1]) cylinder(h=4,r=3.05 + 0.05*i);

}}

Any thoughts?

appjaws - Core XYUV Duet Ethernet Duex5

firmware 3.1.1 Web Interface 3.1.1

Ormerod 1-converted to laser engraver, Duet wifi

OpenSCAD version 2020.07

slic3r-1.3.0, Simplify3D 4.1.2, Cura-4.4.1

difference(){

cube([200,18,3]);

for(i=[0:19]){

translate([5 + 5*i, 6+0.05*i, -0.1]) cylinder(h=4,r=3.05 + 0.05*i);

}}

This is what I tried and as you can see the gaps between holes are reducing as the holes get larger. What I wanted was the gap between holes to remain the same.

difference(){

cube([200,18,3]);

for(i=[0:19]){

translate([5 + 10*i+3.05 + 0.05*i, 5+0.05*i, -0.1]) cylinder(h=4,r=3.05 + 0.05*i);

}}

Any thoughts?

appjaws - Core XYUV Duet Ethernet Duex5

firmware 3.1.1 Web Interface 3.1.1

Ormerod 1-converted to laser engraver, Duet wifi

OpenSCAD version 2020.07

slic3r-1.3.0, Simplify3D 4.1.2, Cura-4.4.1

Re: poor maths again October 12, 2015 06:17AM |
Registered: 9 years ago Posts: 14,639 |

I think you need to increase the X coordinate quadratically. Something like this:

difference(){

cube([200,18,3]);

for(i=[0:19]){

translate([8 + 10*i +**0.1*i*i**, 5+0.05*i, -0.1]) cylinder(h=4,r=3.05 + 0.05*i);

}}

Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].

difference(){

cube([200,18,3]);

for(i=[0:19]){

translate([8 + 10*i +

}}

Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].

Re: poor maths again October 12, 2015 08:28AM |
Registered: 9 years ago Posts: 2,472 |

NumHoles = 20; // Number of holes

Gap = 2; // Gap between holes

First=5; // Radius of first hole

Increase=0.05; // Radius size increase per hole

Margin=5; // Border around block

HolesX=2*(NumHoles*First)+(NumHoles-1)*(Gap+NumHoles*Increase); // Total X length of holes

HolesY=2*(First+(NumHoles-1)*Increase); // Diameter of largest hole

difference()

{

translate([-Margin-First,-Margin-HolesY/2,0])

cube ([2*Margin+HolesX,2*Margin+HolesY,5]);

Holes();

}

module Holes()

{

for(i=[0:NumHoles-1])

{

translate([i*(Gap+2*First+i*Increase),0,-500])

cylinder(r=First+i*Increase, h=1000, $fn=20);

}

}

Gap = 2; // Gap between holes

First=5; // Radius of first hole

Increase=0.05; // Radius size increase per hole

Margin=5; // Border around block

HolesX=2*(NumHoles*First)+(NumHoles-1)*(Gap+NumHoles*Increase); // Total X length of holes

HolesY=2*(First+(NumHoles-1)*Increase); // Diameter of largest hole

difference()

{

translate([-Margin-First,-Margin-HolesY/2,0])

cube ([2*Margin+HolesX,2*Margin+HolesY,5]);

Holes();

}

module Holes()

{

for(i=[0:NumHoles-1])

{

translate([i*(Gap+2*First+i*Increase),0,-500])

cylinder(r=First+i*Increase, h=1000, $fn=20);

}

}

Re: poor maths again October 12, 2015 08:29AM |
Registered: 9 years ago Posts: 780 |

I thought I had managed to solve this but running it shows that the smaller the hole the larger the gap

gap=4;

difference(){

cube([200,18,3]);

for(i=[0:19]){

translate([gap*i+((3.05 + 0.05*i)*2)+((3.05 + 0.05*i+1)*2)+gap*i, 5+0.05*i, -0.1]) cylinder(h=4,r=3.05 + 0.05*i);

}}

This is yours which shows the smaller the hole the smaller the gap

gap=6;

difference(){

cube([200,18,3]);

for(i=[0:19]){

translate([8 + gap*i + 0.1*i*i, 5+0.05*i, -0.1]) cylinder(h=4,r=3.05 + 0.05*i);

}}

I'm just getting confused now, the solution lies somewhere in between but I can't see it

appjaws - Core XYUV Duet Ethernet Duex5

firmware 3.1.1 Web Interface 3.1.1

Ormerod 1-converted to laser engraver, Duet wifi

OpenSCAD version 2020.07

slic3r-1.3.0, Simplify3D 4.1.2, Cura-4.4.1

gap=4;

difference(){

cube([200,18,3]);

for(i=[0:19]){

translate([gap*i+((3.05 + 0.05*i)*2)+((3.05 + 0.05*i+1)*2)+gap*i, 5+0.05*i, -0.1]) cylinder(h=4,r=3.05 + 0.05*i);

}}

This is yours which shows the smaller the hole the smaller the gap

gap=6;

difference(){

cube([200,18,3]);

for(i=[0:19]){

translate([8 + gap*i + 0.1*i*i, 5+0.05*i, -0.1]) cylinder(h=4,r=3.05 + 0.05*i);

}}

I'm just getting confused now, the solution lies somewhere in between but I can't see it

appjaws - Core XYUV Duet Ethernet Duex5

firmware 3.1.1 Web Interface 3.1.1

Ormerod 1-converted to laser engraver, Duet wifi

OpenSCAD version 2020.07

slic3r-1.3.0, Simplify3D 4.1.2, Cura-4.4.1

Re: poor maths again October 12, 2015 08:41AM |
Registered: 9 years ago Posts: 2,472 |

Quoteappjaws1

I'm just getting confused now, the solution lies somewhere in between but I can't see it

My algorithm works fine (try it in my previous post): (NumHoles=total number of holes,First=first hole radius, Gap=gap between holes, Increase=radius increase in each hole size)

for(i=[0:NumHoles-1])

{

translate([i*(Gap+2*First+i*Increase),0,-500])

cylinder(r=First+i*Increase, h=1000, $fn=20);

}

Re: poor maths again October 12, 2015 08:56AM |
Registered: 9 years ago Posts: 780 |

Sorry, only registered users may post in this forum.