Need help Modeling a Sun's Ray

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Need help Modeling a Sun's Ray

CraigLindley
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Need help Modeling a Sun's Ray

LenStruttmann
here's a start



//***********************************
$fn = 24;

for ( a=[0:1:3*360] )
{
  translate( [ a, 10*sin(a), 0 ] )
  scale( [ 1, 10-.009*a, 1 ] )
  segment();
}


module segment()
{
  rotate( [ 0, 90, 0 ] )
  linear_extrude( 4 )
  hull()
  for (i=[-1:2:1])
  {
    translate( [ 0, i*5, 0 ] )
    circle( 5 );
  }
}


Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Need help Modeling a Sun's Ray

CraigLindley
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Need help Modeling a Sun's Ray

LenStruttmann
Adding a few more lines of code turns it into a sun.  Thanks!  This has been fun!



//*********************************
$fn = 24;

rotate( [ 0, 0, 45 ] )
fourRays( 600 );

fourRays( 1000 );

module fourRays( r )
{
  for (a=[0:90:270])
  {
    rotate( [ 0, 0, a ] )
    ray(r);
  }
}


module ray( r )
{
  k = r / (3*360);
  for ( a=[0:1:3*360] )
  {
    translate( [ k*a, 10*sin(a), 0 ] )
    scale( [ 1, 10-.009*a, 1 ] )
    segment();
  }
}

module segment()
{
  rotate( [ 0, 90, 0 ] )
  linear_extrude( 4 )
  hull()
  for (i=[-1:2:1])
  {
    translate( [ 0, i*5, 0 ] )
    circle( 5 );
  }
}


Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Need help Modeling a Sun's Ray

LenStruttmann
WARNING: Before you actually try to Render (F6) that, change these two lines:

module ray( r )
{
  k = r / (3*360);
  for ( a=[0:20:3*360] )  // <------------------- CHANGE TO THIS
  {
    translate( [ k*a, 10*sin(a), 0 ] )
    scale( [ 1, 10-.009*a, 1 ] )
    segment();
  }
}

module segment()
{
  rotate( [ 0, 90, 0 ] )
  linear_extrude( 20 )  // <-------------------  CHANGE TO THIS
  hull()
  for (i=[-1:2:1])
  {
    translate( [ 0, i*5, 0 ] )
    circle( 5 );
  }
}


Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Need help Modeling a Sun's Ray

CraigLindley
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Need help Modeling a Sun's Ray

LenStruttmann
Ha-ha!  Coincidentally, that was the exact question I had for myself.

So, here's the final version of the sun.  The scale() at the top gives a final result that I could, if I wanted, print on my 3D printer: 202mm x 202mm x 10mm, which is a little bit less that 1/2 inch.

Enjoy!

//*********************************
$fn = 24;

scale( [ 0.1, 0.1, 1 ] )
sun();


module sun()
{
  rotate( [ 0, 0, 45 ] )
  fourRays( 600 );

  fourRays( 1000 );
}


module fourRays( r )
{
  for (a=[0:90:270])
  {
    rotate( [ 0, 0, a ] )
    ray(r);
  }
}


module ray( r )
{
  k = r / (3*360);
  for ( a=[0:10:3*360] )  
  {
    translate( [ k*a, 10*sin(a), 0 ] )
    scale( [ 1, 10-.009*a, 1 ] )
    segment();
  }
}


module segment()
{
  rotate( [ 0, 90, 0 ] )
  linear_extrude( 10 )  
  hull()
  for (i=[-1:2:1])
  {
    translate( [ 0, i*3, 0 ] )
    circle( 5 );
  }
}


Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Need help Modeling a Sun's Ray

CraigLindley
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Need help Modeling a Sun's Ray

LenStruttmann
Just start with the lowest module, segment().  You can call it by itself and see what it does.  Then, each higher module does something with the previously developed modules, step by step.

Actually, I've only been using my 3D printer and OpenSCAD for about 6 months.  Yes, there is a bit of a learning curve.  But, I've been programming for over 45 years; I usually find OpenSCAD easier to use than the graphics-oriented systems.  Enjoy!  Don't be afraid to ask questions here and in other forums.

Len

Sent from the OpenSCAD mailing list archive at Nabble.com.

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
dpa
Reply | Threaded
Open this post in threaded view
|

Re: Need help Modeling a Sun's Ray

dpa
I waited for the BOSL2 solution ;) but tried myself Lens cool approach to make it cleaner (less 'steppy')

this is the result: exchange the module ray():
// <--
module ray( r ) {
  step = 10;
  k = r / (3*360);
  for ( a=[0:step:3*360-step] )  
  {
    hull() {
        translate( [ k*a, 10*sin(a), 0 ] )
        scale( [ 1, 10-.009*a, 1 ] )
        segment();
        b = a + step;
        translate( [ k*b, 10*sin(b), 0 ] )
        scale( [ 1, 10-.009*b, 1 ] )
        segment();
    }
  }
}

// >

You could now set the segment extrusion from 10 to something little (e.g. 0.1) but it works also with 10.


Am Di., 11. Mai 2021 um 03:55 Uhr schrieb LenStruttmann <[hidden email]>:
Just start with the lowest module, segment().  You can call it by itself and see what it does.  Then, each higher module does something with the previously developed modules, step by step.

Actually, I've only been using my 3D printer and OpenSCAD for about 6 months.  Yes, there is a bit of a learning curve.  But, I've been programming for over 45 years; I usually find OpenSCAD easier to use than the graphics-oriented systems.  Enjoy!  Don't be afraid to ask questions here and in other forums.

Len

Sent from the OpenSCAD mailing list archive at Nabble.com.
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]