Close



Results 1 to 10 of 72

Threaded View

  1. #11
    Super Moderator curious aardvark's Avatar
    Join Date
    Jul 2014
    Posts
    8,816
    yep and below you can find the FULLY annotated script. Hopefully that should make everything clear. :-)


    //Curious aardvark's fully annotated basic model rocket script - with added vitamin HULL !

    $fn=100; //defines the number of facets for round or spherical shapes. 100 gives you the roundest things. I tend to put this at the top of all my scripts. If you want to speed up rendering drop it to 50 or 75. just remember to change it back to 100 before the final f6 render. Unless of course you want a more angular shape.


    difference() { //removes cylinder from entire ducttaped model. Although this is at the start of the script, it was added last.


    union() { //ducttapes the rocket body and fins together as one shape

    cylinder (d=20,h=40); //creates the main cylinder of the rocket's body: diameter 20mm height 40mm
    translate([0,0,40]) cylinder(d1=20, d2=1, h=20); //adds the pointy top to the rocket body. translate starts the cylinder 40mm up so it sits on top of the body. Height of point is 20mm. Base diameter is 20 and top diameter is 1mm to make the cone shape. Cones slope iorm the first diameter to the second. Inwards if the second diameter is smaller then the first and outwards if it's larger.


    //creates first fin

    hull() { //wraps a shell around the the two rectangles to create a tringular fin shape. the width of the rectangle creates the thickness of the fin

    translate([-1,0,0]) cube([2,25,0.1]); //sticks a long thin rectangle out from the base of the rocket to create the long base of the fin

    translate([-5,0,40]) cube([1.5,0.1,0.1]); //places a small rectangle at the top of the rocket to create the top of the fin
    } // indicates the end of the hull command


    //second fin - code was simply copied and pasted to make a second fin and a rotate commad added to, well rotate the fin.

    rotate([0,0,120]) { //rotates second fin 120 degrees (3 fins: 360/3 = 120 degree rotation to get evenly spaced fins
    hull() { //wraps shell round rectangles
    translate([-1,0,0]) cube([2,25,0.1]); //bottom rectangle
    translate([-5,0,40]) cube([1.5,0.1,0.1]); //top rectangle
    } //end of hull command
    } //end of rotate

    //third fin - see above :-)

    rotate([0,0,240]) { //rotated 240 degrees
    hull() {
    translate([-1,0,0]) cube([2,25,0.1]);
    translate([-5,0,40]) cube([1.5,0.1,0.1]);
    } //end of hull
    } //end of rotate
    } //end of union to stitch the whole model together
    cylinder (d=16,h=38); // removes a smaller cylinder from the ducttaped (unioned) model for insertion of a rocket motor - I have no idea how big these actually are - this script is currently just for tutorial purposes. Removed cylinder is 16mm in diameter to give a wall thickness of 2mm. And 38mm in height to give a solid 2mm before the start of the cone. probably not actually necessary. But I'm a belt and braces kind of designer.


    } //end of difference to remove hole for motor
    Essentially this is just a model with 6 elements. 2 cylinders, 1 cone and three triangles.
    Think of it as using childs building blocks. I stacked a cone on top of a hollow cylinder and then leant three triangles against it.
    Future rocket scripts will demonstrate modules and loop commands and variables and scaling and resize - just not in that order :-)
    Not to mention adding text to the rocket - I've got an easy way to change fonts used with writescad.

    And as I learn more stuff (there are a whole bunch of commands I haven't used yet) I'll add more bits to it. Also bear in mind that while I can do arithmitic - I have bugger all higher maths (took the courses - just never really understood them).
    So you can pretty much guarentee that my scripts will not have 'cos' or 'tan' or anything of that nature - as I have absolutely no idea what they are or how they work :-)
    The beauty of openscad is that you can make the same model any number of ways. You really don't need to understand complicated maths. Otherwise I wouldn't be able to use it :-)

    @Mjoilnir - what os and version of openscad are you using ?

    One thing I would recommend to print out and keep to hand is the 'cheat' sheet.
    http://www.openscad.org/cheatsheet/index.html

    It helps keep the different syntax for the various commands clear.

    I can also use this model to explain 'my' design process in very simple steps.

    Probably should have done that first, right ?
    Just thought an actual design would be a good place to start.
    lol
    Last edited by curious aardvark; 12-01-2014 at 09:48 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •