Wednesday, August 30, 2017

Wrap number

Wraps numbers inside boundaries
 Usage:



function wrap(x,x_max=1,x_min=0) = 
(((x-x_min)%(x_max-x_min))+(x_max-x_min))%(x_max-x_min)+x_min; 
// wraps numbers inside boundaries
 

Monday, August 28, 2017

Radius A Regular Polygon By Side And N



function Radius_A_Regular_Polygon_By_Side_And_N(A,N)= A/(2*sin/(180/N));

 

Saturday, August 26, 2017

Area Of A Isosceles Prism By Base Heights



function Area_Of_A_Isosceles_Prism_By_Base_Heights(A,h,H)=
    2*((1/2)*A*h)+ A*sqrt((a/2)*(a/2)+h*h)*H;
 

Thursday, August 24, 2017

Tennis ball curve function.

Tennis ball curve function. Returns a single point at (i) far along a curve in the shape of  the seam on a tennis ball.

function Tennis_ball_Curve(i)=let( 
b=360*i-sin(360*i*4)*25 ,
a=sin(360*i*2)*65)
[cos(a)*sin(b),cos(a)*cos(b),sin(a)] ;

for(i=[0:1/180:1]){
translate(Tennis_ball_Curve(i))sphere(0.02,$fn=30);
} 

Tuesday, August 22, 2017

Log spiral function

Log spiral function. Returns a single point at (a) far along a spiral curve defined by radius  number of turns and exponent for falloff. Both turns and exponent can be negative to positive numbers.


function L_Spiral (a,radius = 50,heigth,turns =  4,xpnt=0.685,start_angle=45)
= let( fx = xpnt<0?
pow(max(0,1-a),1/abs(min(-1,xpnt-1) )): pow(max(0,1-a),max(1,xpnt+1))   ) 
[(radius * fx ) * cos(start_angle+ a* turns*360*sign(turns)),
 (radius * fx ) * sin(start_angle+ a* turns*360*sign(turns)),a*heigth];

for(j=[0:1/60:1]){hull(){
 translate(L_Spiral (j, 50,-150,  4, 1.685, 0 ))sphere();
 translate(L_Spiral (j+1/60, 50,-150, 4, 1.685, 0 ))sphere();
}}
 
 

Lets try The Anet A8 from GearBest

After several bad experiences of low price kits which have taken too many shortcuts, I was very skeptical to try out the Anet A8. I expected a challenge, but the kit arrived complete and in order, slightly unpolished, but a lot better than expected to the price point.


Of course, it takes many hours to assemble an Anet A8, if you want to do it carefully. No steps were particularly difficult, but to make sure to review the inherent quality, not my own sloppiness, I took the time to do everything carefully without haste. The less you pay the more you are expected to do yourself. Sometimes instructions were quite confusing but far from impossible. The whole thing is a good fun assembly experience that most people can manage if they follow the video clips found online.


Anet A8 is a typical Prusa clone with few excesses. Most subsystems are variations of well-proven constructions, albeit in their most affordable form. Reliable, but these clones contributes very little innovation to the 3d printer community. The contribution, instead, is to be able to put affordable machines in the hands of tens of thousands of users who never had the chance before. Much like Clive Sinclair's Z80 computers in the 80's. And just like them, Anet A8 is so slimmed down on parts quality that it just barely works without further upgrades and frequent maintenance. These deliberately cut corners result in a pricing that is absolutely outstanding and an overall printer quality that can, with a little effort, be at least really good, if not top shelf.


To calibrate a printer manually without any automation takes great patience. With the Anet A8, the procedure is very naked, bare metal and you probably need to repeat the steps several times before it's tuned in properly. There are excellent general calibration guides available online, but it is sometimes difficult to understand how the different procedures affect each other. A lot of the money you saved on purchase the Anet A8 shows up here, in time you spend to perform and understand calibration.


Being a clone with excellent heritage, the Anet A8 is a pretty good machine in basic form, but after assembly, further upgrades just feels like a natural continuation. And this is where A8 really shines. For a small sum of money, you can get a foot in the door with 3d printing and can from there on developing the hobby at your own pace and price range. There are lots of printable upgrades for the A8 and even more for its sibling clones that with a little challenge can be adapted to Anet. Do you want to upgrade firmware, mount a bed leveling probe or a sticky PEI sheet on your hotbed? Do you want to remotely control your machine with an OctoPrint module or build an enclosure? The possibilities are endless with upgrades.

The Anet A8 can become the first printer that you quickly move on from after your first taste of 3d printing and are ready to take the plunge with something more expensive. Or you could continue to build and upgrade this machine far into the future. Building and operating an Anet A8 is a highly educational experience that will take the user through a curious labyrinth of soft and hardware challenges. A truly entertaining path that is likely to imprint a lasting passion for the 3D printer hobby. Get one with a coupon at:
Anet A8: http://www.gearbest.com/3d-printers-3d-printer-kits/pp_343643.html Coupon code: "A8SUPER" / $149.89 (will expire on Aug, 31th) Category (Electrical & Tools ): http://www.gearbest.com/electrical-tools-c_11347/show.html?odr=trending Coupon code: "GBTE" / 12% OFF

Sunday, August 20, 2017

Area Of Two Intersecting Circles


function Area_Of_Two_Intersecting_Circles(P1, P2,P1r,P2r) =
let(p1 = P1r * P1r,p2 = P2r * P2r )
(PI*p1+PI*p2)-
(
let(d = max(1e-32,norm(P2 -  P1)))
(d >= P1r + P2r) ?0:
d < abs(P2r - P1r)?PI * min(p1, p2):    
let( x = (p1 - p2 + d * d) / (2 * d),
z = x * x,  y = sqrt(p1 - z)) 
p1 * asin(y / P1r)/57.2958 + p2 * 
     asin(y / P2r)/57.2958 - y * 
     (x + sqrt(z + p2 - p1))             );
////////////////////////////////////////////////
p1=rands(0,40,2);
p2=rands(0,40,2);
r1=rands(1,20,1)[0];
r2=rands(1,20,1)[0];

echo(str(" Area 1 : ",PI*r1*r1," "));
echo(str(" Area 2 : ",PI*r2*r2," "));
echo(str(" Area ∑ : ",PI*r1*r1+PI*r2*r2)  );
echo(str(" Area  I : ",Area_Of_Two_Intersecting_Circles(p1,p2,r1,r2)));

linear_extrude(1) union(){
translate(p1)circle(r1,$fn=50);
translate(p2)circle(r2,$fn=50);
}
if(  norm(p2 -  p1)< r1 + r2 )color("red")linear_extrude(1.01)
intersection(){
translate(p1)circle(r1,$fn=50);
translate(p2)circle(r2,$fn=50);
}

 

Friday, August 18, 2017

Points inside a ellipsoid

Generates a list of random points that lie inside a ellipsoid

function random_points_inside_ellipsoid(rx,ry,rz,n)=
[for(i=[1:n])ellipsoid_point(rx,ry,rz)];

function ellipsoid_point(rx,ry,rz)=
let (
r=[rx,ry,rz],
p=[
rands(-rx,rx,1)[0],
rands(-ry,ry,1)[0],
rands(-rz,rz,1)[0] 
] ,
d= ((
sq2(p.x)/sq2(r.x)+
sq2(p.y)/sq2(r.y)+
sq2(p.z)/sq2(r.z)) - 1) * min(r.x,r.y,r.z)  ) 
 (d)>0?ellipsoid_point(rx,ry,rz):p;
function sq2(v)=pow(v,2);

p=random_points_inside_ellipsoid(50,50,100,1000);
for(t=p)translate(t)sphere(4);
echo(p);
 

Wednesday, August 16, 2017

Randomly Shuffle A List

Put Items of a list in random sequence.

Deck=["Ace of Spades","Two of Spades","Three of Spades",
"Four of Spades","Five of Spades","Six of Spades","Seven of Spades",
"Eight of Spades","Nine of Spades","Ten of Spades","Jack of Spades",
"Queen of Spades","King of Spades","Ace of Hearts","Two of Hearts",
"Three of Hearts","Four of Hearts","Five of Hearts","Six of Hearts",
"Seven of Hearts","Eight of Hearts","Nine of Hearts","Ten of Hearts",
"Jack of Hearts","Queen of Hearts","King of Hearts","Ace of Clubs",
"Two of Clubs","Three of Clubs","Four of Clubs","Five of Clubs",
"Six of Clubs","Seven of Clubs","Eight of Clubs","Nine of Clubs",
"Ten of Clubs","Jack of Clubs","Queen of Clubs","King of Clubs",
"Ace of Diamonds","Two of Diamonds","Three of Diamonds",
"Four of Diamonds","Five of Diamonds","Six of Diamonds",
"Seven of Diamonds","Eight of Diamonds","Nine of Diamonds",
"Ten of Diamonds","Jack of Diamonds","Queen of Diamonds",
"King of Diamonds"];

echo( shuffle(Deck));
function shuffle(il,repeat=2)=len(il)<=1?il:
let(l=repeat>0?shuffle(il,repeat-1):il, p=split(l))
round(rands(0,2,1)[0])==0?
concat( shuffle(p[0]),shuffle(p[1])):
concat( shuffle(p[1]),shuffle(p[0]));

function split(l)=[
[for(i=[0:2:len(l)-1])l[i]],
[for(i=[1:2:len(l)-1])l[i]]]  ;
 

Monday, August 14, 2017

Recursive For Loop Workaround

State can be a singel variable or a vector of variables


echo(rfor (50,10,-10,[0,1]));

function rfor(i,to,stepsize=1,state)=
abs(i-to)<abs(stepsize)?/* are there space left to take next step */
state :  /* if done return state or what ever value you like*/
let(newstate=myFunction(state,i ))
rfor(i+stepsize,to,stepsize,newstate) // call next recursive step
;

/*your code here, reassign state as you like */
function myFunction (state,i)=  [state[0]+sqrt(i),state[1]];
 

Saturday, August 12, 2017

True/False Dice

Random true/false value

function dice()=round(rands(1,2,1)[0])==1?false:true;

 

Thursday, August 10, 2017

Volume Of A Cone By Radius And Height



function Volume_Of_A_Cone_By_Radius_And_Height(r,h )= 
    PI*r*r*h*(1/3);
 

Wednesday, August 9, 2017

0 - 1 Remapping Functions: Arc1

/* remapping functions */


for(i=[-0:1/160:1])translate([i,0])square([1/160,  (arc1(  (i)))]);
    function arc1 (x,n=0) = let(a= n>0? arc1(x,(n-1)):x) clamp(sqrt(1-(1-a)*(1-a)));
    function clamp(a, b = 0, c = 1) = min(max(a, b), c);
 

Tuesday, August 8, 2017

Points Inside A Cylinder


Generates a list of random points that lie inside a cylinder

function random_points_inside_cylinder(r,h,n)=
[for(i=[1:n])cylinder_point(r,h)];

function cylinder_point(r,h)=
let (p=[
rands(-r,r,1)[0],
rands(-r,r,1)[0],
rands(0,h,1)[0] ],
d=(pow(p.x,2) + pow(p.y,2) )) 
d > pow(r,2)?cylinder_point(r,h):p;


p=random_points_inside_cylinder(50,100,1000);
for(t=p)translate(t)sphere(4);
echo(p);
 

Sunday, August 6, 2017

Points inside a tube


Generates a list of random points that lie inside a tube

function random_points_inside_tube(r,r2,h,n)=
          [for(i=[1:n])tube_point(r,r2,h)];

function tube_point(r,r2,h)=
let (p=[
rands(-r,r,1)[0],
rands(-r,r,1)[0],
rands(0,h,1)[0] ],
d=(pow(p.x,2) + pow(p.y,2) ))

 d > pow(r,2)||d < pow(r2,2)?tube_point(r,r2,h):p;


p=random_points_inside_tube(50,30,100,1000);
for(t=p)translate(t) sphere(4);
echo(p);
 

Friday, August 4, 2017

Points inside a cone

Generates a list of random points that lie inside a cone

function random_points_inside_cone(r,h,n)=
   [for(i=[1:n])cone_point(r,h)];

function cone_point(r,h)=
let (p=[
rands(-r,r,1)[0],
rands(-r,r,1)[0],
rands(0,h,1)[0] ],
d=sqrt(pow(p.x,2) + pow(p.y,2) ) 
)  
d > r-r*(p.z/h)?cone_point(r,h):p;


p=random_points_inside_cone(50,150,2000);
for(t=p)translate(t)rotate(rands(0,360,3))cube(5,center=true);
echo(p);
 

Wednesday, August 2, 2017

Tuesday, August 1, 2017

3D Printer review

I currently has a Anet A8 home for review.
Very affordable, good looking and Straightforward assembly.
Updates on operations will be posted as soon as possible.