Close



Page 6 of 8 FirstFirst ... 45678 LastLast
Results 51 to 60 of 72
  1. #51
    Staff Engineer old man emu's Avatar
    Join Date
    Oct 2013
    Location
    Narellan, New South Wales, Australia
    Posts
    912

    Gleanings from this thread.

    In an attempt to consolidate the important things that have been said, I went through this thread and pulled out the tid-bits of information that advanced the topic. I've indicated who made the post, and the post number.

    I don't expect any replies to this current post. It is meant to be a hold-all so we can move on.

    Roxy Post # 4
    The Polyhedron is difficult to use. The points used to construct it have to be carefully ordered.

    Roxy Post # 6
    the round brackets on Difference() and Union() are just to denote that you are performing a 'function'. But that deviates from their usage in C where you are passing in parameters within the ().
    The square brackets are more consistent. If you see square brackets [], the contents is going to be used as a vector (or a point).

    Roxy Post # 8
    On difference() and union() and intersection() the ()'s have to be there... But nothing goes inside them.
    The curly braces {} enclose lines of code to form a 'statement' or 'block'. Everything within the first set of curly braces gets operated on by difference(), union() and intersection. Instead of parameters
    getting passed within the () as in C, the things that are going to get operated on are in specific places with the {}'s. (ie. things get subtracted from the first object specified in the {}'s of a difference() ).

    But in cube(), sphere(), etc... Parameters are passed inside the ()'s. So you can say something like sphere(r=10); Or cube( [3,4,5] ); Or cylinder(r=4, h=20);

    You can put a # in front of any line of code in OpenScad to see what it is producing.


    Old Man Emu Post # 10
    PUNCTUATION SYMBOL FUNCTION
    //
    /* and */


    // is used to insert Coder’s comments into the coding. Anything written on the same line is invisible to the program. If the comment goes into two or more lines, each line must begin with // to continue hiding its content. If the comment goes on for more than three lines, mark the first comment line with /* and end the comment with */


    { and } Braces hold things in a group. They must be used in pairs with each opening brace { matched with a closing brace }

    ( and ) Parentheses are used to hold the parameters of an object or operator. The parameter could be the radius of a circle or sphere, or it could be the co-ordinates of a point in space. When used with Boolean operations, the parentheses are left empty.

    [ and ] Square Brackets are used to hold the parameters that describe width and height of squares and also the depth of cubes. When used with Transformations, they hold the x,y and z coordinates associated with the particular operator (Translate, Scale, Mirror etc.) within parentheses.

    ; Semi-colons are the symbol that says “Do it!” A semi-colon is placed at the end of the coding that defines the object to be created. If the semi-colon is omitted, nothing is created. The automatic debugging facility in OpenScad will place a marker in the code to indicate where the bug is hiding.


    curious aardvark Post # 12
    1) use diameter NOT radius. ie: cylinder(d=10,h=5);
    2) the hull command.
    This is a brilliant command and answers a lot of questions. Like: how do i make a wedge ? Can i make non equalatrial triangles. And 'how on earth do I make an irregular shape without having to try and understand the polygon command' ?

    curious aardvark Post # 17
    Don't forget that openscad is text based - so you can use normal text tools. I used copy and paste in the above script. But say you haven't made fins a module (which i didn't), but want to change all three at once. Click edit and select Find and Replace. Then put -5 in the find box and -7 in the replace box. Hit all and f5. And the angle of all three fins changes.
    Admittedly this only works if you haven't used a -5 anywhere else.

    Old Man Emu Post #22
    Transformations have to be coded before the object the operate upon.

    Roxy Post #34
    A sphere and cylinder are always generated at (0,0). So when you translate them... what ever amount you translated them... Is where the center's are.
    In OpenScad you should have a 'Top Level' geometry. That is what that first singleduploblock(); is. It references other stuff, but it is at the top level.singleduploblock() does not have any parameters, and certainly does not need its name passed in as a parameter.

    curious aardvark Post #38
    But the really weird thing is that you used a cube command with no square brackets. And it worked. cube (32,32,20);

    Roxy Post # 39
    I suggest you put the [32,32,20] inside of brackets. If for no other reason than everybody else does and expects to see that.

    Roxy Post # 49
    What's a facet command? Searching the OpenScad manual doesn't find any reference to that. Update: I figured out what you meant. I suspect you are talking about the $fn parameter

    Roxy Post # 62 in http://3dprintboard.com/showthread.php?8855-Need-some-geometry-help
    the pow() function takes two parameters. The first number is the base and the second parameter is the exponent. pow(x,y) will raise x^y. Using a pow(3,4) would be equivalent to saying 3*3*3*3. You are raising 3 to the 4th power.


    Old Man Emu
    Last edited by old man emu; 12-09-2014 at 01:19 AM.

  2. #52
    Senior Engineer
    Join Date
    Jun 2014
    Location
    Burnley, UK
    Posts
    1,662
    cube (32,32,20);
    is the same as
    cube (32);
    and is a cube

    cube ([32,32,20]);
    Is not a cube it is a rectangular cuboid.

    ie. without the square brackets the second and third dimensions are ignored.

    "center=true" and "center=false" can be added to most shapes and needs to be watched. It is often easier to set it false/true than to do a translate.


  3. #53
    Super Moderator curious aardvark's Avatar
    Join Date
    Jul 2014
    Posts
    8,818
    yep the $fn= command is the 'number of facets' command. Hence the 'facet command' :-)

    And yes I am definitely a pheasant pluckers son. My dad was a poacher way back when I was a wee sprog (and we are talking a long long time ago). Only way we could afford regular meat.

    You'll never get a shine on that duck doing it that way. Your buffing wheel needs to go faster and use some polishing wax.
    lol - yeah wax could work.
    Apparently you melt a bucket of wax, dip the bird in, wait till it sets and then peel it off with all the feathers.

    Quite where you buy bucket loads of wax from - not a clue.

    We'll see how the mkII de-featherer works when i finally get a chance to make it.

    cube (32,32,20);
    is the same as
    cube (32);
    and is a cube

    cube ([32,32,20]);
    Is not a cube it is a rectangular cuboid.
    Ah - that makes sense. But wouldn't it bugger up the model ?
    I have to admit I never do the shortcut method. Always type the full ([0,0,0]) in before I add the numbers.
    Last edited by curious aardvark; 12-08-2014 at 05:48 AM.

  4. #54
    Senior Engineer
    Join Date
    Jun 2014
    Location
    Burnley, UK
    Posts
    1,662
    Quote Originally Posted by curious aardvark View Post
    lol - yeah wax could work.
    Apparently you melt a bucket of wax, dip the bird in, wait till it sets and then peel it off with all the feathers.

    Quite where you buy bucket loads of wax from - not a clue.

    We'll see how the mkII de-featherer works when i finally get a chance to make it.
    It looks like curiously 'ard wark to me, I'll stick to the butcher for my meat.

  5. #55
    Staff Engineer old man emu's Avatar
    Join Date
    Oct 2013
    Location
    Narellan, New South Wales, Australia
    Posts
    912
    Bugger it!

    I've just spent a good hour or so putting together something about modules and when I went to upload it I had been timed out. Stuff it. I'm going to bed

    Angry emu.jpg

    And by the look of the holes in that bird, a bloke would be a candidate for lead poisoning if he ate it.

    OME

  6. #56
    Super Moderator curious aardvark's Avatar
    Join Date
    Jul 2014
    Posts
    8,818
    lol - nah, game is cheaper, healthier and once you've done a few, the processing is no big deal.
    It's also the cleanest and most human way of killing something.

    I use pigeon breast for a lot of dishes where you'd use good and expensive steak.

    Buy a goose in the shops and it'll cost you upwards of £35
    The one we've currently got didn't cost anything bar a little processing.

    The other night I spent a couple of hours deboning a big muntjac deer. Ended up with 2x3lb haunch joints, 2x2lb shoulder joints, couple racks of ribs, about 2lb fillet (that alone would have cost more than I paid for the whole deer) and about 3lb scraps I'll use in sausage and burgers.

    Total cost= £30 and a couple hours of my time.
    Like I said the fillet alone would have cost more than that from a butcher or shop.

    Game is not only good for you, it's really good for your wallet :-)

  7. #57
    Staff Engineer old man emu's Avatar
    Join Date
    Oct 2013
    Location
    Narellan, New South Wales, Australia
    Posts
    912
    "I'm game, if you are," said the actress to the bishop.

    OME

  8. #58
    Senior Engineer
    Join Date
    Jun 2014
    Location
    Burnley, UK
    Posts
    1,662
    I just ordered my Christmas goose, £65. Gobsmacked I was.

  9. #59
    Super Moderator Roxy's Avatar
    Join Date
    Apr 2014
    Location
    Lone Star State
    Posts
    2,182
    Quote Originally Posted by old man emu View Post
    Bugger it!

    I've just spent a good hour or so putting together something about modules and when I went to upload it I had been timed out. Stuff it. I'm going to bed
    ...
    OME
    This happens to me a alot... If you press the 'Back' button to return to the page before you submitted it... You can highlight all your text, and do a 'Copy' to get it to the clipboard. Then you can start at the top of the forum and drill back down to the thread you are trying to reply to, go to the very end and just do a 'Post Quick Reply' and do a Paste to recover where you were.

    In fact... I left this window open over night... And it just happened on this Reply.

  10. #60
    Staff Engineer old man emu's Avatar
    Join Date
    Oct 2013
    Location
    Narellan, New South Wales, Australia
    Posts
    912

    Modules - OpenScad's answer to toolbar icons?

    I was reading this, http://blog.cubehero.com/2013/12/18/...d-code-part-i/ and came across this example of a module,

    module ring(height, radius, radial_width) {
    difference() {
    cylinder(h = height, r = radius + radial_width / 2);
    translate([0, 0, -1])
    cylinder(h = height + 2, r = radius - radial_width / 2);
    }}

    After studying it for a while, it dawned on me that the module was like an icon on the object creation toolbar of a GUI based progam like Rhino. With Rhino, if I want to create a 3D object, or perform some action on one, I click on an icon on a toolbar, or in a drop-down menu. Then the program prompts me to input the parameters necessary to achieve the particular result at the time. In OpenScad, there is no icon, but a block of text called a "module". These modules are user created and result in the creation of a specific object.

    Having created a general set of steps that OpenScad must take to create an object, it only requires the user to provide the parameters specific to the object being made at the time. This is done by writing this:

    ring (height, radius, radial width) in the body of the code. To keep with convention, this would actually be coded as ring(h,r,rw)

    This would be how it would appear in practice:

    // ring implemented with rotational extrusion
    module ring(height, radius, radial_width) {
    rotate_extrude()
    translate([radius, 0, 0])
    square([radial_width, height]);
    }
    // There might be lines and lines of code before the need to enter specific values //to create the ring
    ring(4,10,5);

    QUESTIONS:

    1. Say I've just created a module to make a whatsit, and I'm going to be making whatsits of various sizes in the future. If I click on <Save As> in Openscad do I save my .scad file here
    C:\Program Files\OpenSCAD\Libraries?
    2. If I've saved my module as whatsit.scad, can i create a whatsit using this bit of code:

    use <whatsit.scad>
    whatsit (parameters);

    3. Which is better practice, putting this in the code:
    module ring(height, radius, radial_width)
    {
    difference()
    {
    cylinder(h = height, r = radius + radial_width / 2);
    translate([0, 0, -1])
    cylinder(h = height + 2, r = radius - radial_width / 2);
    }}

    or this:
    use <ring.scad>
    ring(h,r,rw);

    OME
    Last edited by old man emu; 12-10-2014 at 06:18 AM.

Page 6 of 8 FirstFirst ... 45678 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
  •