discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: [OpenSCAD] Splines for drawing fan blades?

N
Neon22
Wed, Mar 30, 2016 5:58 AM

You might want to persevere with @parkinbots nspline library.
Specifically the example here: http://www.thingiverse.com/thing:1208001

I wrote some more about it here:

http://forum.openscad.org/Trying-to-incorporate-equation-based-shapes-td3116.html#a16625

Have a read and see if you can work out what's going on.

First thing to sort out is all the names are mangled.

  • Rudolf uses linux and all uppercase letters are autoconverted to
    lowercase.
  • Also the zip file contains mangled long hash style filenames.

Look inside each one and make sure you rename them to match the following
files(taken from the boat propeller file):
use <Naca4.scad>
use <Shortcuts.scad>
use <Naca_sweep.scad>
use <splines.scad>

You know its working when the boat propeller appears.
http://forum.openscad.org/file/n16812/2prv6mc.jpg

One of the hased files is the boat propeller scad file.
Inside you will see these things:

  • module axis -
  • module boat_prop with a function called gen_dat inside it
  • A variable called A which holds the shapes
    and these global variables:
    N = 100;        // refinement
    R_axis = 100;  // radius of axle
    r_bore = 50;    // radius of axle bore
    size = .1;      // sizing factor
    slices = false;  // set true to view interpolation slices
    ty = 50;        // common y-distancing of blades

So what's going on and how do you control it:

  1. if you set slices to true you will see the NACA airfoils spread out along
    a single one of the propeller blades. There are 4 but the last one is not
    visible as its scaled vey small.

  2. The functoin gen_dat takes teh A variable and uses it to make teh data to
    build each blade.

  3. The A variable holds the shape definition
    // core data to be interpolated by nSpline()
    //      transform data            airfoil nacaXYZZ
    //--------------------------------------------------
    A = [ // Tx    Ty  Tz  Rz  Ry  |  L    X    ZZ
    [0,    ty,  60, -25,  0,  300,  .12,  .1],
    [-50,  ty,  200, -50,  0,  600,  .2,  .08],
    [-100, ty,  500, -75,  0,  700,  .1,  .06],
    [00,  ty,  660, -82,  10,  10,  .01,  .1],
    ];
    As indicated in the comment the first 5 values translate and rotate the
    shape into the proper position.
    The second set of three values (L,X,ZZ) define teh airfoil shape.
    Rather than use the NACA number @parkinbot has put in the bvalues that are
    extracted from eth NACA number directly. (see more about NACA numbers in my
    post referenced at top of this post)

So

  • you can change these three values and get different airfoils.
  • you can use different Translate, roatte values to get different overall
    blade shape
  • you can alter the shl value (270 degrees) to get other numbers of
    blades...

Good luck

--
View this message in context: http://forum.openscad.org/Splines-for-drawing-fan-blades-tp16784p16812.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

You might want to persevere with @parkinbots nspline library. Specifically the example here: http://www.thingiverse.com/thing:1208001 I wrote some more about it here: - http://forum.openscad.org/Trying-to-incorporate-equation-based-shapes-td3116.html#a16625 Have a read and see if you can work out what's going on. First thing to sort out is all the names are mangled. - Rudolf uses linux and all uppercase letters are autoconverted to lowercase. - Also the zip file contains mangled long hash style filenames. Look inside each one and make sure you rename them to match the following files(taken from the boat propeller file): use <Naca4.scad> use <Shortcuts.scad> use <Naca_sweep.scad> use <splines.scad> You know its working when the boat propeller appears. <http://forum.openscad.org/file/n16812/2prv6mc.jpg> One of the hased files is the boat propeller scad file. Inside you will see these things: - module axis - - module boat_prop with a function called gen_dat inside it - A variable called A which holds the shapes and these global variables: N = 100; // refinement R_axis = 100; // radius of axle r_bore = 50; // radius of axle bore size = .1; // sizing factor slices = false; // set true to view interpolation slices ty = 50; // common y-distancing of blades So what's going on and how do you control it: 1. if you set slices to true you will see the NACA airfoils spread out along a single one of the propeller blades. There are 4 but the last one is not visible as its scaled vey small. 2. The functoin gen_dat takes teh A variable and uses it to make teh data to build each blade. 3. The A variable holds the shape definition // core data to be interpolated by nSpline() // transform data airfoil nacaXYZZ //-------------------------------------------------- A = [ // Tx Ty Tz Rz Ry | L X ZZ [0, ty, 60, -25, 0, 300, .12, .1], [-50, ty, 200, -50, 0, 600, .2, .08], [-100, ty, 500, -75, 0, 700, .1, .06], [00, ty, 660, -82, 10, 10, .01, .1], ]; As indicated in the comment the first 5 values translate and rotate the shape into the proper position. The second set of three values (L,X,ZZ) define teh airfoil shape. Rather than use the NACA number @parkinbot has put in the bvalues that are extracted from eth NACA number directly. (see more about NACA numbers in my post referenced at top of this post) So - you can change these three values and get different airfoils. - you can use different Translate, roatte values to get different overall blade shape - you can alter the shl value (270 degrees) to get other numbers of blades... Good luck -- View this message in context: http://forum.openscad.org/Splines-for-drawing-fan-blades-tp16784p16812.html Sent from the OpenSCAD mailing list archive at Nabble.com.
P
Parkinbot
Wed, Mar 30, 2016 2:07 PM

A simpler approach letting you design your own fan would be:
http://www.thingiverse.com/thing:1016047

@Neon22: Thanks for exploring and explaining the design. I know it is a bit
sophisticated, but it lets you do so much. Meanwhile I have corrected the
upper/lowercase mismatch. Sorry for that. Please let me know if there is
some problem left.

Rudolf

--
View this message in context: http://forum.openscad.org/Splines-for-drawing-fan-blades-tp16784p16818.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

A simpler approach letting you design your own fan would be: http://www.thingiverse.com/thing:1016047 @Neon22: Thanks for exploring and explaining the design. I know it is a bit sophisticated, but it lets you do so much. Meanwhile I have corrected the upper/lowercase mismatch. Sorry for that. Please let me know if there is some problem left. Rudolf -- View this message in context: http://forum.openscad.org/Splines-for-drawing-fan-blades-tp16784p16818.html Sent from the OpenSCAD mailing list archive at Nabble.com.
N
Neon22
Thu, Mar 31, 2016 11:04 AM

@parkinbot its a very nice layout you have.
Its the sort of thing that would be good to see slightly simplified and
formalised for OpenSCAD2 maybe.

The idea of defining a structure containing shapes and transforms is useful.
Also the trick in splines of splining across however many items you put in
the array is very clever.

So if you want a three point spline or 100 points - its the same function
applied the same way.

I like your http://www.thingiverse.com/thing:1016047 but I'd humbly suggest:

  • some explanation of Repeller vs Propeller. One is not quite the inverse of
    the other (still need to negate twist etc. so perhaps explain what it is
    reversing. Maybe its just CCW vs CW.
    (https://en.wikipedia.org/wiki/Repeller suggests this is unusual usage of
    the term)

  • I would not have used the same name with just a change of case for two
    modules - even though one only calls the other. I'd humbly suggest using a
    different name. Like in your other airfoil code you used airfoil_data() and
    airfoil().
    Maybe Propeller is the internal module and Prop_CW and Prop_CCW are the
    upper level modules ??

  • Only users of your shortcuts will relise the D() examples are differencing
    the propeller from a Ring and that this code is to round the propeller tips.
    Its obvious once you know, but on initial examination its not clear. Nice
    trick BTW.

--
View this message in context: http://forum.openscad.org/Splines-for-drawing-fan-blades-tp16784p16843.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

@parkinbot its a very nice layout you have. Its the sort of thing that would be good to see slightly simplified and formalised for OpenSCAD2 maybe. The idea of defining a structure containing shapes and transforms is useful. Also the trick in splines of splining across however many items you put in the array is very clever. So if you want a three point spline or 100 points - its the same function applied the same way. I like your http://www.thingiverse.com/thing:1016047 but I'd humbly suggest: - some explanation of Repeller vs Propeller. One is not quite the inverse of the other (still need to negate twist etc. so perhaps explain what it is reversing. Maybe its just CCW vs CW. (https://en.wikipedia.org/wiki/Repeller suggests this is unusual usage of the term) - I would not have used the same name with just a change of case for two modules - even though one only calls the other. I'd humbly suggest using a different name. Like in your other airfoil code you used airfoil_data() and airfoil(). Maybe Propeller is the internal module and Prop_CW and Prop_CCW are the upper level modules ?? - Only users of your shortcuts will relise the D() examples are differencing the propeller from a Ring and that this code is to round the propeller tips. Its obvious once you know, but on initial examination its not clear. Nice trick BTW. -- View this message in context: http://forum.openscad.org/Splines-for-drawing-fan-blades-tp16784p16843.html Sent from the OpenSCAD mailing list archive at Nabble.com.
P
Parkinbot
Thu, Mar 31, 2016 12:47 PM

Neon22 wrote

  • some explanation of Repeller vs Propeller. One is not quite the inverse
    of the other (still need to negate twist etc. so perhaps explain what it
    is reversing. Maybe its just CCW vs CW.
    (https://en.wikipedia.org/wiki/Repeller suggests this is unusual usage of
    the term)

Good point. I followed your suggestion. Not everyone (writing a wiki entry)
had latin in school. Indeed one is the kinematic inversion of the other like
electrical generator vs. motor.

  • I would not have used the same name with just a change of case for two
    modules - even though one only calls the other. I'd humbly suggest using a
    different name. Like in your other airfoil code you used airfoil_data()
    and airfoil().
    Maybe Propeller is the internal module and Prop_CW and Prop_CCW are the
    upper level modules ??

Well, naming and programming styles are a big mess. That's why I hate to
read foreign code. For instance I don't like variable names like
thisIsTheHeightOfMyFirstShape=1. This makes code unreadable for me as the
structure disappears within line breaks and monster names. Thus I am using
short cuts and short names, but a lot of functions and modules with local
variables. When I share code, I usually spend some amount of time to comment
it, give examples for the API and even offer help() modules echoing the
prototypes and default values to the console, but I am not prepared to start
renaming or even refactor the code. Or writing tons of explanations why I
used which construction. If someone wants to reuse it, he will have to spend
time playing with it anyway ;-)

  • Only users of your shortcuts will relise the D() examples are
    differencing the propeller from a Ring and that this code is to round the
    propeller tips. Its obvious once you know, but on initial examination its
    not clear. Nice trick BTW.

Not a trick, but bad programming. I should have used intersection() with a
cylinder (executes faster). I guess typing D(){Ri(r1, r2, h);... } was
faster ;-)
In the mean time OpenSCAD also allows for a I() shortcut - which I haven't
implemented yet. This might change my programming a lot :-)

--
View this message in context: http://forum.openscad.org/Splines-for-drawing-fan-blades-tp16784p16849.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Neon22 wrote > - some explanation of Repeller vs Propeller. One is not quite the inverse > of the other (still need to negate twist etc. so perhaps explain what it > is reversing. Maybe its just CCW vs CW. > (https://en.wikipedia.org/wiki/Repeller suggests this is unusual usage of > the term) Good point. I followed your suggestion. Not everyone (writing a wiki entry) had latin in school. Indeed one is the kinematic inversion of the other like electrical generator vs. motor. > - I would not have used the same name with just a change of case for two > modules - even though one only calls the other. I'd humbly suggest using a > different name. Like in your other airfoil code you used airfoil_data() > and airfoil(). > Maybe Propeller is the internal module and Prop_CW and Prop_CCW are the > upper level modules ?? Well, naming and programming styles are a big mess. That's why I hate to read foreign code. For instance I don't like variable names like thisIsTheHeightOfMyFirstShape=1. This makes code unreadable for me as the structure disappears within line breaks and monster names. Thus I am using short cuts and short names, but a lot of functions and modules with local variables. When I share code, I usually spend some amount of time to comment it, give examples for the API and even offer help() modules echoing the prototypes and default values to the console, but I am not prepared to start renaming or even refactor the code. Or writing tons of explanations why I used which construction. If someone wants to reuse it, he will have to spend time playing with it anyway ;-) > - Only users of your shortcuts will relise the D() examples are > differencing the propeller from a Ring and that this code is to round the > propeller tips. Its obvious once you know, but on initial examination its > not clear. Nice trick BTW. Not a trick, but bad programming. I should have used intersection() with a cylinder (executes faster). I guess typing D(){Ri(r1, r2, h);... } was faster ;-) In the mean time OpenSCAD also allows for a I() shortcut - which I haven't implemented yet. This might change my programming a lot :-) -- View this message in context: http://forum.openscad.org/Splines-for-drawing-fan-blades-tp16784p16849.html Sent from the OpenSCAD mailing list archive at Nabble.com.