Gas station without pumps

2019 August 11

Star-of-stars, another large pendant

I’ve previously posted about my 3D-printed stage jewelry: the 3D slugs , the diamond, the chain of office, and large pendants printed on my Monoprice Delta Mini printer using CC3D Silk Gold PLA filament.

I designed another pendant yesterday, and printed it today—this one using stars instead of spheres as the main design element.

Once again, I had to clean up the stringing and blobbing using a riffler.

// Star of stars
// by Kevin Karplus
//  Creative Commons Attribution-ShareAlike  (CC BY-SA 3.0)
// 2019 Aug 10

use <BOSL2/std.scad>
// BOSL2 from https://github.com/revarbat/BOSL2/
// used for offset

function inner_radius(r_outer, n, k) =
    assert(k<n/2) assert(k>0)
    let(straight_ratio = cos(180/n) + sin(180/n)*tan(180*k/n))
    r_outer/ straight_ratio;
    
function star_points(r_outer=5, n=5, k=2)=
   // Points on circle centered at (0,0) with radius r_outer.
   // First point on positive x axis.
   // k determines how far out the inner points of the star are, 
   //   with k<1 making a convex polygon with 2n sides,
   //   k=1 making a regular n-gon
   //   k=2 making a star that connects alternate points
   //   k=3 making a star that connects every third point, ...
   // k need not be integer
   // You can get a nice, fat star with k=(n-2)/2
   let(r_inner = inner_radius(r_outer, n, k))
    [for (i=[0:2*n-1]) 
        (i%2==0? r_outer: r_inner)*[cos(i*180/n), sin(i*180/n)]];
    
    
module star(r_outer=5, n=5, k=2)
   // Make a polyhedral star with n points.
{   points = star_points(r_outer=r_outer,n=n,k=k);
    polygon(points=points, convexity=n);
}


module star_outline(n=5, r=50, line=2,k=undef)
{
    k_star = k==undef? (n-2)/2: k;
    points = star_points(r_outer=r,n=n,k=k_star);
    echo(points=points);
    inner = offset(points, delta=-line, closed=true);
    echo(inner=inner);
    difference()
    {   polygon(points);
        polygon(inner);
    }
    
}

module star_of_stars(n=5, r=50, line=2, k=undef)
{
    k_star = k==undef? (n-1)/2: k;
    r_sub = inner_radius(r, n, k_star);
    star_outline(n=n, r= 2*r_sub, line=line, k=k_star);
    for (i=[0:n-1])
    {
        rotate((2*i+1)*180/n)
            translate([2*cos(180/n)*r_sub,0])
                rotate(((n+1)%2)*180/n)
                    star_outline(n=n,r=r_sub+0.001, line=line, k=k_star);
    }
}



module solid_star(n=5, r=50, k=undef, height=undef)
// Make a solid star with n points and outer radius r
//    k is a skinniness parameter (0 to n/2), as defined in star
//      default value is (n-2)/2, which makes a slightly fat star
//      (try n/2 for a skinny star)
//    height is the height of the star, default is r/3
{
    k_star = k==undef? (n-2)/2: k;
    h = height==undef? r/3: height;

    linear_extrude(height=h, scale=0)
       star(n=n,k=k_star, r_outer=r);
}


module solid_star_of_stars(n=5, line=2, r=50)
{   
    small_r = 3*line;
    r_sub = inner_radius(r, n, (n-1)/2);
    outer_center= [(2*cos(180/n)+1)*r_sub-small_r,0];
    
    difference()
    {   union()
        {
            linear_extrude(line)
               star_of_stars(r=r, n=n, line=line);
            intersection()
            {   translate([0,0,0.0015]) cylinder(r=1.2*r, h=2*line, $fn=20);
                
                for (i=[0:n-1])
                {    rotate([0,0,i*360/n])
                        translate([r_sub,0,0])
                        {   linear_extrude(line) star(r_outer=3*line,n=n, k=(n-2)/2);
                            color("blue") translate([0,0,line])
                                solid_star(r=small_r, height=2*line, n=n, k=(n-2)/2);
                        }
                }
            }
            intersection()
            {   translate([0,0,0.001]) cylinder(r=1.2*r, h=2*line, $fn=20);
                
                for (i=[0:n-1])
                {   
                    rotate((2*i+1)*180/n)  translate(outer_center)
                     {  rotate(((n+1)%2)*180/n)
                        {   linear_extrude(line) star(r_outer=3*line,n=n, k=(n-2)/2);
                            color("red") translate([0,0,line])
                                solid_star(r=3*line, height=2*line, n=n, k=(n-2)/2);
                        }
                    }
                }
            }
        }
        
        for (i=[0:n-1])
        {   
            rotate((2*i+1)*180/n)  translate(outer_center)
               cylinder(d=line, h=5*line, center=true, $fn=30);
        }
    }
}

solid_star_of_stars(n=5);

Released on Thingiverse as https://www.thingiverse.com/thing:3805111

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: