Close



Results 1 to 10 of 18

Threaded View

  1. #9
    Super Moderator Roxy's Avatar
    Join Date
    Apr 2014
    Location
    Lone Star State
    Posts
    2,182
    Quote Originally Posted by urglik View Post
    hey roxy,
    this is fun. i like entering code to get models or a mesh i guess. new to all this. the openscad user manual seems well written. this is making sense.
    i played with the code you gave me because i need a sphere with one hole only.
    i was able to accomplish this as shown, but had some questions.
    i don't understand why the second hole would not disappear until i reduced the cylinder height to 60
    and how is this connected to the translate variables?
    and i was wondering what makes the cylinder a child of the sphere?

    Clipboard01.jpg
    Normally, it is easier to see what is going on in OpenScad. But you picked a particularly difficult idea to see. However, if you go back to the original code I posted I'll walk you through it. Grab that original code and put it back into OpenScad. Then change this line to have a # in front of it:

    # translate([0,0,-50]) cylinder(r=5, h=100,$fn=50);

    When ever you put a # in front of something it will display that object. So you will see a cylinder translated down to z=-50 and going up to z=+50. That object is being subtracted from the hollow sphere. You might have to do a Design/Render followed by a View/Animate to see the # object.

    You can't see inside of the hollow sphere very well, but you could make it so you just get one hole by changing that line to:

    # cylinder(r=5, h=100,$fn=50);

    Now the cylinder is just as tall but it starts with its bottom at the origin. If you want to see inside the sphere and how the cylinder is positioned, you might try cutting away the first quadrant. Try this code so you can look inside:

    sphere_with_holes();


    module sphere_with_holes() {
    difference() {
    sphere(r=20, $fn=40);
    sphere(r=18, $fn=40);
    #cylinder(r=3.375, h=100, $fn=50);

    cube([500,500,500]); // cut away the 1st quadrant
    }
    }
    Last edited by Roxy; 05-22-2015 at 09:56 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
  •