Close



Page 3 of 8 FirstFirst 12345 ... LastLast
Results 21 to 30 of 72

Hybrid View

  1. #1
    Senior Engineer
    Join Date
    Jun 2014
    Location
    Burnley, UK
    Posts
    1,662
    This is what I have in finned-rocket.scad taken from gedit.

    $fn=100;


    difference() { //removes cylinder from entire ducttaped model


    union() {
    cylinder (d=20,h=40);
    translate([0,0,40]) cylinder(d1=20, d2=1, h=20);


    hull() {
    translate([-1,0,0]) cube([2,25,0.1]);
    translate([-5,0,40]) cube([1.5,0.1,0.1]);
    }


    //second fin
    rotate([0,0,120]) {
    hull() {
    translate([-1,0,0]) cube([2,25,0.1]);
    translate([-5,0,40]) cube([1.5,0.1,0.1]);
    }
    } //end of rotate


    //third fin
    rotate([0,0,240]) {
    hull() {
    translate([-1,0,0]) cube([2,25,0.1]);
    translate([-5,0,40]) cube([1.5,0.1,0.1]);
    }
    } //end of rotate
    } //end of union to stitch the whole model together
    cylinder (d=16,h=38); //removes hole for rocket motor
    } //end of difference to remove hole for motor
    It seems that "d" does not work on my scad.
    Last edited by Mjolinor; 11-30-2014 at 01:24 PM.

  2. #2
    Super Moderator curious aardvark's Avatar
    Join Date
    Jul 2014
    Posts
    8,818
    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.

  3. #3
    Senior Engineer
    Join Date
    Jun 2014
    Location
    Burnley, UK
    Posts
    1,662
    OpenSCAD version 2013.05.28 (The latest in the Mint feeds)

    XFCE version 4.10

    Kernel:
    3.11.0-26-generic #45-Ubuntu SMP Tue Jul 15 04:04:15 UTC 2014 i686 i686 i686 GNU/Linux

    Linux Mint: 17.1 Rebecca

  4. #4
    Super Moderator curious aardvark's Avatar
    Join Date
    Jul 2014
    Posts
    8,818
    I did say the manual is useless.

    But what i see is you concentrating on things that are not necessary to know the 'why' of.

    The brackets are always there and always in the same order. That's all you need to know. Trying to get your head around why there are () brackets after things is pointless. Just type the buggers and move on :-)

    Colours ?
    why on earth have you skipped all the useful basics and gone on to colour ?
    That fits into what i like to call the: 'advanced and pointless' category.

    You can't designate colours for a multi colour print (well you sort of can, but not in the way most people would think) They are there purely for cosmetic use. So untill you know what you're doing - ignore them.

    There's no point injecting unnecessary code into a script when you're learning.

    You had already stated that semi-colons come after commands, as well as where brackets are used and why. So I'm not going to repeat it every time I write a script.
    You soon get used to adding the semi-colon.
    I always type the whole command with brackets and semi-colon before adding any numbers.

    I assume people start from the beginning of the thread and work their way down. If they choose not to do that - it's not my fault :-)

    Hmm, pretty sure the diameter command should work in your version of 'scad. mjoilnir.
    Last edited by curious aardvark; 12-01-2014 at 09:53 AM.

  5. #5
    Senior Engineer
    Join Date
    Jun 2014
    Location
    Burnley, UK
    Posts
    1,662
    The colours and transparency are essential when designing things otherwise you can't see what you have.

  6. #6
    Super Moderator curious aardvark's Avatar
    Join Date
    Jul 2014
    Posts
    8,818
    colours are pretty pointless.

    If you are designing a print for dual extrusion. You simply comment out the parts for the second colour when your render the commands for the first.
    And vice versa.
    I guess you could make them different colours - but I don't. I'm not a colour focused person.
    I never know when friends have decorated or bought new stuff. It's not important to me so i don't generally take notice of it.

    Transparency is potentially useful if you're designing mechanisms within a shell. Otherwise - again - just unnecessary window dressing.
    haven't used it yet - or felt any need to.

    When i start doing encapsulated hinges I'll probably play with transparency.
    But for most models - you don't need it.

    I know a lot of cad packages are colour focused. Architecture packages use different colours for different line types and thicknesses.
    I suspect this is one - of many - reasons i don't get on with conventional cad packages :-)
    Last edited by curious aardvark; 12-01-2014 at 10:24 AM.

  7. #7
    Super Moderator Roxy's Avatar
    Join Date
    Apr 2014
    Location
    Lone Star State
    Posts
    2,182
    Quote Originally Posted by curious aardvark View Post
    colours are pretty pointless.

    Transparency is potentially useful if you're designing mechanisms within a shell. Otherwise - again - just unnecessary window dressing.
    haven't used it yet - or felt any need to.
    I usually use a difference() to look inside things. I subtract off a huge cube([]) so I can see a cross sectional view of what is being built. I have a couple of examples, like a whistle and a pump jack where unless you can see inside, you won't know that you have things right.

  8. #8
    Super Moderator curious aardvark's Avatar
    Join Date
    Jul 2014
    Posts
    8,818
    a basic millenium flacon is pretty simple. A flattened sphere for the body, cylinder for the front roundy bit, dimple on the top.

    But if you're trying to duplicate what you can do on a package you know well in openscad after a couple weeks - you're just going to get frustrated.

    You need to start with simple things. I find that the more I use openscad the more I learn and the more I can actually make it do.

    But it's not a program where you can just leap in at the deep end.

    Start with differences and unions. Then add variables, loops and modules.

    The best way to learn is to build a simple model - a rocket for example ;-)
    And keep tweaking the script as you learn different functions.

    I reckon I can probably get the rocket script down to about half a dozen lines of code eventually and make it fully parametric.

    And for the record it prints great too - used it to test a cheap roll of white pla.

    But I do think you're trying to get too complicated too quick.

  9. #9
    Staff Engineer old man emu's Avatar
    Join Date
    Oct 2013
    Location
    Narellan, New South Wales, Australia
    Posts
    912
    Quote Originally Posted by curious aardvark View Post
    a basic millenium flacon is pretty simple.
    I'm going to have to be careful how I write. That wasn't meant that I wanted to model an Millennium Falcon. I just used that thing as an image to represent a complicated object.

    Quote Originally Posted by curious aardvark View Post
    You need to start with simple things. I find that the more I use openscad the more I learn and the more I can actually make it do.

    But it's not a program where you can just leap in at the deep end. The best way to learn is to build a simple model And keep tweaking the script as you learn different functions. But I do think you're trying to get too complicated too quick.
    I'm in full agreement with these statements. We let this thread get too complicated, too fast. We need to go back and start at the very beginning.

    Here's my thought:
    Let's each download the OpenScad Cheat Sheet and, starting with Syntax , go through it explaining what each of the underlined words means, and the correct way to write it into some code.
    If an object is needed to illustrate a the way something works, then let's standardize to a cube and/or a sphere whose size/radius is 5. (And allow arguments in favour of diameter instead of radius).

    If you are happy with my explanation of the way I explained the use of brackets and semicolons, then let it be Syntax .1, and move on to var as Syntax .2., and so on.

    OME

  10. #10
    Technologist dacb's Avatar
    Join Date
    Aug 2014
    Location
    Edmonds, WA
    Posts
    139
    Not to hijack, but I just want to put in a quick plug for openjscad instead of openscad. It performs way better (render time), doesn't have the wonky syntax and variable scoping oddities. I have switched over completely.

Page 3 of 8 FirstFirst 12345 ... LastLast

Posting Permissions

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