Close



Page 2 of 8 FirstFirst 1234 ... LastLast
Results 11 to 20 of 74
  1. #11
    Senior Engineer
    Join Date
    Jun 2014
    Location
    Burnley, UK
    Posts
    1,662
    rotate(a = [90, 0, 0]) {
    linear_extrude(height = 4, center = true, convexity = 10, twist = 0)
    translate([1, 0, 0])
    square(r = 1);}


    rotate (a = [0, 0, 90]){
    rotate(a = [90, 0, 0]) {
    linear_extrude(height = 4, center = true, convexity = 10, twist = 0)
    translate([1, 0, 0])
    square(r = 1);}
    }


    rotate (a = [0, 0, 180]){
    rotate(a = [90, 0, 0]) {
    linear_extrude(height = 4, center = true, convexity = 10, twist = 0)
    translate([1, 0, 0])
    square(r = 1);}
    }




    rotate (a = [0, 0, 270]){
    rotate(a = [90, 0, 0]) {
    linear_extrude(height = 4, center = true, convexity = 10, twist = 0)
    translate([1, 0, 0])
    square(r = 1);}
    }

  2. #12
    Staff Engineer old man emu's Avatar
    Join Date
    Oct 2013
    Location
    Narellan, New South Wales, Australia
    Posts
    912
    That coding just makes cubes at various locations around the Z axis. I want to make whizzo things like this:



    and at the moment i's stumped by not having the answer to this question:

    how do I get OpenScad to automatically use all the values for theta and phi in their respective ranges (0 to 2 pi)?

    How about doing it this way?
    iteration over a range specifying an increment:
    // Note: The middle parameter in the range designation
    // ('0.2' in this case) is the 'increment-by' value
    // Warning: Depending on the 'increment-by' value, the
    // real end value may be smaller than the given one.
    for ( i = [0 : 0.2 : 5] )
    {
    rotate( i * 360 / 6, [1, 0, 0])
    translate([0, 10, 0])
    sphere(r = 1)


    OME


    Last edited by old man emu; 12-02-2014 at 08:13 PM.

  3. #13
    Senior Engineer
    Join Date
    Jun 2014
    Location
    Burnley, UK
    Posts
    1,662
    OK, then you have to do it this way for circular ones.

    rotate_extrude(convexity = 10, $fn=100)
    translate([6, 0, 0])
    polygon(points=[[0,0],[0,10],[10,10],[10,0]], paths=[[0,1,2,3]]);

    The polygon defining your cross sectional shape.

  4. #14
    Senior Engineer
    Join Date
    Jun 2014
    Location
    Burnley, UK
    Posts
    1,662
    Hmm, it seems square ones are a lot more complicated because of the parts where they touch.

    First attempt:

    for (i=[1:4]){


    rotate (a = [0, 0, i*90]){
    translate ([0,15,0])
    rotate(a = [90, 0, 0]) {
    linear_extrude(height = 35, convexity = 10, $fn=100)
    translate([10, 0, 0])
    polygon(points=[[0,0],[3,3],[0,10],[7,7],[8,8],[10,0]], paths=[[0,1,2,3,4,5]]);
    }}}

    It needs more polygons defining the ends of the shape I think

  5. #15
    Staff Engineer old man emu's Avatar
    Join Date
    Oct 2013
    Location
    Narellan, New South Wales, Australia
    Posts
    912
    My question is:

    Can this formula
    http://paulbourke.net/geometry/torus/supertoroid3.gif

    be written in a way that OpenScad can produce an object from it?

    If so,
    how do I get OpenScad to automatically use all the values for theta and phi in their respective ranges (0 to 2 pi)?

    Old Man Emu

  6. #16
    Senior Engineer
    Join Date
    Jun 2014
    Location
    Burnley, UK
    Posts
    1,662
    Because you can only define variables to work on primatives the only way this can be done is to define a very small sphere (or cube) and then move that through the values of x y z that you want. I will give you any shape but it will take massive processing power to do anything complex.

    For that sort of manipulation it would be a lot easier to work with straight Gcode than anything else. This is because Gcode naturally joins specific dots where Openscad does not.

  7. #17
    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
    My question is:

    Can this formula
    http://paulbourke.net/geometry/torus/supertoroid3.gif

    be written in a way that OpenScad can produce an object from it?
    Quote Originally Posted by Mjolinor View Post
    Because you can only define variables to work on primatives the only way this can be done is to define a very small sphere (or cube) and then move that through the values of x y z that you want. I will give you any shape but it will take massive processing power to do anything complex.
    This is an interesting test of the powers of OpenScad. I think Mjolinor is right about it taking a lot of processing power. But I think it can be done very successfully. At the highest level, I would define a module that used a 'for' loop on n1 and n2 to send them through their range. (That way, you can generate each shape in your table up above.) I would have this module call the toriod() module that I wrote. And I would display this torroid and some suitable translate() based on n1 and n2 so I could generate the same table.

    In the toriod() module I would use a nested 'for' loop to vary theta and phi over their range. I would generate a small sphere at each of the (x,y,z) coordinates that got generated from these loops. And here is the difference from what Mjolinor suggests.

    All of that logic inside the toriod() module's loops would be inside a hull() statement. I think OpenScad will draw a hull around those points so you get a nice, smooth skin.

  8. #18
    Senior Engineer
    Join Date
    Jun 2014
    Location
    Burnley, UK
    Posts
    1,662
    That is what I did. A very small sphere redrawn for 1 degree movements and you do end up with a toroid but you had better have a Cray handy if you want to do anything with it other than grow your fingernails and hair while you wait.

  9. #19
    Super Moderator Roxy's Avatar
    Join Date
    Apr 2014
    Location
    Lone Star State
    Posts
    2,182
    Quote Originally Posted by Mjolinor View Post
    That is what I did. A very small sphere redrawn for 1 degree movements and you do end up with a toroid but you had better have a Cray handy if you want to do anything with it other than grow your fingernails and hair while you wait.
    Can you post the code? I would like to play with it.... (Without doing all the work to write it! )

  10. #20
    Senior Engineer
    Join Date
    Jun 2014
    Location
    Burnley, UK
    Posts
    1,662
    You have a Cray then.



    r0 = 4;
    r1 = 2;


    for (v = [0:360])
    {
    for (u = [0:360])
    {
    assign (A = ((r0 + r1 * cos(v)) * cos (u)), B = ((r0 + r1 * cos(v)) * sin (u)), C = (r1 * sin(v)))
    {
    translate ([A,B,C])
    sphere (r=1);
    }
    }
    }

    I think it is right.
    AB and C are xy and z (I thought xyz maybe special within Openscad), your angles are u and v, radii are r0 and r1.

Page 2 of 8 FirstFirst 1234 ... 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
  •