Close



Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18
  1. #11
    Super Moderator curious aardvark's Avatar
    Join Date
    Jul 2014
    Posts
    8,818
    couple of things that should make it easier.
    You can use diameters instead of radii. This means that you don't have to mentally double the size of a sphere or cylinder every time you want one.
    That and putting a module before you've defined it - make no sense to me :-)
    I'm not a programmer, so a lot of the ways other people use openscad just strikes me as confusing and the wrong way round.
    But that's the beauty of openscad - everyone can use it the way that makes sense to them.

    Also for a rounder shape use a higher '$fn=' value.
    I usually use the max: $fn-100;
    Which gives you very round things. Takes a little longer to f6 render. But the models are better.

    Another thing you can do is to use variables to create parametric objects.
    $fn=100;

    sd=10; //sphere diameter
    wt=2; // thickness of sphere wall
    hs=3; // hole size


    difference() {
    sphere(d=sd); //create sphere with diameter set by sd
    sphere(d=sd-(2*wt)); //remove sphere from centre of original sphere - size defined by wt
    translate([0,0,-sd/2])cylinder(d=hs,h=wt*4); // remove hole from bottom of sphere - diameter defined by hs
    }
    Because I used variables - whenever you change one of the numbers - the other automatically adapt.
    Also for printing you want the sphere to be hole down.
    The other thing that I find essential is to put a lot of coments into a script.
    // can be put anywhere to write a comment to explain what you've done. Otherwise you'll come back to a script and it won't make any sense at all :-)
    I know the maths can probably be improved - but the above script does work :-)
    Last edited by curious aardvark; 05-29-2015 at 10:37 AM.

  2. #12
    howdy folks,

    sorry for the delay in responding. thank you for everyone's input.

    thank you, curious aardvark, for your suggestions. i was about to post where i had gotten to when i saw your post and knew i should
    rework my approach. using variables as you did makes it easier to enter the variables that one uses and receives from the formula.
    also creating the sphere upside down. thanx...

    there are two sphere types i am concerned with. one with just a sound hole and one with a hollow cylindrical neck as a sound hole.

    here is the scad code for the first one, adapted with your help.

    // Spherical Resonator

    // The formula below can be entered into a
    // calculator that can do expressions, like google,
    // and the result will be the diameter of the sphere in meters.

    // 17.87*((d/(f^2))^(1/3))

    // Where:
    // d= diameter of sound hole in meters
    // f= frequency(Hz)

    // Example: A 220Hz
    // in millimeters

    $fn=100;

    sd=143.38; //sphere diameter
    wt=2; // thickness of sphere wall
    hs=25; // hole size


    difference() {
    sphere(d=sd); //create sphere with diameter set by sd
    sphere(d=sd-(2*wt)); //remove sphere from centre of original sphere - size defined by wt
    translate([0,0,-sd/2])cylinder(d=hs,h=wt*2); // remove hole from bottom of sphere - diameter defined by hs
    }
    here was my approach for spheres with a neck.

    // Spherical Resonator With Neck

    // The formula below can be entered into any
    // calculator that can do expressions, like google, and the
    // result will be the diameter of the sphere in meters.

    // ((3*(d^2)*(343.59^2))/(8*L*(f^2)*(3.14^2)))^(1/3)

    // Where:
    // d= diameter of sound hole in meters
    // L= length of the neck in meters
    // f= frequency(Hz)

    // Example: A 220Hz
    // in millimeters

    //Sphere

    difference() {
    sphere(r=68.24, $fn=40);
    sphere(r=66.24, $fn=40); // The radius of the second sphere is the target radius
    cylinder(r=12.5, h=68.24, $fn=50); // The height of the cylinder is the radius of the first sphere
    }

    //Neck

    difference() {

    translate([0,0,66.24]) // Cylinders are translated the radius of the second sphere.
    cylinder(r=14.5, h=25, $fn=50);
    translate([0,0,66.24])
    cylinder(r=12.5, h=25, $fn=50); // Second cylinder radius is the target radius.
    }
    i attempted to use your variable approach for the neck in the following manner and was unsuccessful.

    $fn=100;

    sd=132.48; //sphere diameter
    wt=2; // thickness of sphere wall
    hs=25; // hole size
    ln=25; // length of neck

    //Sphere

    difference() {
    sphere(d=sd); //create sphere with diameter set by sd
    sphere(d=sd-(2*wt)); //remove sphere from centre of original sphere - size defined by wt
    translate([0,0,-sd/2])cylinder(d=hs,h=wt*2); // remove hole from bottom of sphere - diameter defined by hs
    }

    //Neck

    difference() {
    translate([0,0,-sd/2])cylinder(d=hs+wt,h=ln);
    translate([0,0,-sd/2])cylinder(d=hs,h=ln);
    }
    and thank you roxy. your help gave me a base to work from and the courage to think i could actually do this.

    "most magic tricks are easy once you know the secret"
    -marshall broudien
    Last edited by urglik; 06-03-2015 at 01:44 AM.

  3. #13
    Super Moderator curious aardvark's Avatar
    Join Date
    Jul 2014
    Posts
    8,818
    I see what you mean the neck shouldn't be that hard to fit to the hole.
    Right try this:
    $fn=100;

    sd=132.48; //sphere diameter
    wt=2; // thickness of sphere wall
    hs=25; // hole size
    ln=25; // length of neck

    //Sphere

    %difference() {
    sphere(d=sd); //create sphere with diameter set by sd
    sphere(d=sd-(2*wt)); //remove sphere from centre of original sphere - size defined by wt
    translate([0,0,-sd/2])cylinder(d=hs,h=wt*2); // remove hole from bottom of sphere - diameter defined by hs
    }

    //Neck

    difference() {
    translate([0,0,-ln-(sd/2)+wt])cylinder(d=hs+wt,h=ln);
    translate([0,0,-ln-(sd/2)+wt])cylinder(d=hs,h=ln);
    }
    Basically you have to move the cylinder by it's own height and then by half the diameter and then by the wall thickness. If you see I've got % in front of the sphere script. This makes the sphere transparent so you can see where the cylinder actually is. Very useful.
    But you must remove the '%' before f6 rendering, otherwise it ignores everything with % in front of it.

    so final renderable script:
    $fn=100;

    sd=132.48; //sphere diameter
    wt=2; // thickness of sphere wall
    hs=25; // hole size
    ln=29; // length of neck

    //Sphere

    difference() {
    sphere(d=sd); //create sphere with diameter set by sd
    sphere(d=sd-(2*wt)); //remove sphere from centre of original sphere - size defined by wt
    translate([0,0,-sd/2])cylinder(d=hs,h=wt*2); // remove hole from bottom of sphere - diameter defined by hs
    }

    //Neck

    difference() {
    translate([0,0,-ln-(sd/2)+wt])cylinder(d=hs+wt,h=ln);
    translate([0,0,-ln-(sd/2)+wt])cylinder(d=hs,h=ln);
    }


    Looks like a classic anarchist's bomb All we need is a plug, some black powder and a fuse :-)
    Also looks like the gourd Asterix carries his magic potion in :-)

  4. #14
    reminds me of the bombs in the game stratego and of course these two instruments

    balifon
    balafon+frame+1+copy.jpg

    timbila with an unseen necked sound hole and a membrane covered trumpet

    5b8d6a15a38361dda3b3829f0f993bbf.jpg

    tanx eh?

    oh, and i haven't met this asterix individual of which you speak.

  5. #15
    a couple thoughts came to mind.

    the inner diameter of the sphere is the target diameter.
    so i added twice the wall thickness to the diameter of the first sphere.

    also, if a 25mm long neck is placed on top of a 2mm thick sphere
    the effective length of the neck will be 27mm. so i tried
    subtracting the wall thickness from neck length for the cylinder height.
    seems functional.

    also, aren't variables actually constants? sorta like constant variables...

    // Example: A 220Hz

    $fn=100; // fragment number

    sd=132.48; // sphere diameter from formula
    wt=2; // wall thickness
    hd=25; // sound hole diameter
    nl=25; // neck length

    // Sphere

    difference() {
    sphere(d=sd+(2*wt)); // create sphere to be hollowed
    sphere(d=sd); // hollow the sphere to diameter from formula
    translate([0,0,-(sd/2)-wt])cylinder(d=hd,h=wt*2); // create sound hole
    }

    // Neck

    difference() {
    translate([0,0,-nl-(sd/2)+wt])cylinder(d=hd+(2*wt),h=nl-wt);
    translate([0,0,-nl-(sd/2)+wt])cylinder(d=hd,h=nl-wt);
    }

  6. #16
    Super Moderator curious aardvark's Avatar
    Join Date
    Jul 2014
    Posts
    8,818
    yeah if you want to be pedantic they're not what programmers call variables. I call them variables because you can vary them and I'm not a programmer and couldn't give a rats arse what the technical term should or shouldn't be:-)
    length of neck would probably be 25mm.

    You have to embed the neck into the shell to form a solid join. It doesn't actually sit directly on top of the hole. It wouldn't seal if you did that.

    Seriously you've never heard of Asterix The Gaul ?
    https://en.wikipedia.org/wiki/Asterix_%28character%29
    Last edited by curious aardvark; 06-04-2015 at 08:24 AM.

  7. #17
    Super Moderator Roxy's Avatar
    Join Date
    Apr 2014
    Location
    Lone Star State
    Posts
    2,182
    Quote Originally Posted by urglik View Post
    also, aren't variables actually constants? sorta like constant variables...
    Quote Originally Posted by curious aardvark View Post
    yeah if you want to be pedantic they're not what programmers call variables. I call them variables because you can vary them and I'm not a programmer and couldn't give a rats arse what the technical term should or shouldn't be:-)
    length of neck would probably be 25mm.
    One of the big 'flaws' in OpenScad was the fact symbols could not change value. The current version has addressed this issue. I'm not sure the OpenScad people would call those 'variables', but they are getting pretty close to that now.

  8. #18
    Super Moderator curious aardvark's Avatar
    Join Date
    Jul 2014
    Posts
    8,818
    it's not a flaw if you're not a programmer :-)

    The biggest issue with the new version I've got is it can't render more than about 6 facets (okay maybe 6,000).
    Trying to make a golf ball (I have my reasons lol) and it just crashes long before I even get close to a decent number of dimples.
    Worse than the pinboard.

    Just signed up for the openscad 'forum' - not a frigging forum it's a bloody mailing list.
    I really don't want a thousand bloody emails a day from openscad. And from what I've seen I can't post without signing up to the poxy mailing list.
    Think I'm going to reinstall an older version and see if it can handle basic iterations.

Page 2 of 2 FirstFirst 12

Posting Permissions

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