Working on wing generator code that computes NACA airfoil sections for a
planform that is inserted from an Inkscape tracing. Internal spars & ribs
will be parametrically added later. But the first task is to convert the
solid polyhedron into a thin 3D printable shell. The thickness needs to be
precisely controlled (constant) to be able to fake out the slicer into
printing 2-3 perimeters. The wing shown takes 6 seconds to preview as a
solid. A minkowski-difference-universe of the wing with a 0.8mm sphere took
over three hours to preview. No hope for render with current resolution.
Not sure that a hull-difference instead of a polyhedron would work with
undercambered airfoils.
Airfoil polygon sections are computed on the fly and will eventually morph
between root and wing tip sections, with some washout added for good
measure. These polygons are stitched into the wing polyhedron. The existing
OpenSCAD Offset Transform only generates a new 2-D object, not a polygon, so
there is no way to stitch the result back into the interior of the wing
polyhedron as a void. A polygon offset function would also be useful for
laser cutting curfs and gear mesh tolerances.
As a feature request, it would be very useful to have a Polygon Offset
function that operates on a 2-D polygon and returns 2-D polygon(s). The
engine has to be there already in CGAL with a point/segment representation?
Another possibility is to write a hacky offset function in Python that would
return a 2-D poly. Does OpenSCAD support user defined Python functions?
The last resort will be to write a hacky user offset function in OpenSCAD
that is tuned for airfoils.
At some later point, it would be handy to have a fuselage to go with the
wings. Hopefully the solution will be extensible. Reading posts, 3D offset
is far off in the future.... Help appreciated.
http://forum.openscad.org/file/n17186/wing.png
--
View this message in context: http://forum.openscad.org/Polygon-Offset-Function-tp17186.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
You might be interested in a different approach, which is quite flexible and
a lot faster as it descibes the wing from the scratch. Didn't have your
data, so I quickly redefined your wing by rule of thumb using some of my
libraries published earlier in thingiverse
http://www.thingiverse.com/thing:1208001
Each row in X describes an airfoil slice shifted in 3D-space. An
interpolation scheme is used to construct the in-between slices. Then a
sweep() operation is performed to get a half wing.
You are right: there is no 'inset' function in OpenSCAD. Either write one,
which is quite easy for airfoil data and/or use a work around by either
scaling or constructing a core pendant for each slice. Then use a
difference() operation over the wing and its core.
// for libaries refer to: http://www.thingiverse.com/thing:1208001
use
<Naca4.scad>
use
<splines.scad>
use
<Naca_sweep.scad>
// wing data - first 4 dimensions describe airfoil
// last 3 dimensions describe xyz offsets
X = [ // Naca L, dx, dy, dz
[.05,.4,.12, 1, -200, 0.5, 0],
[.05,.4,.12, 20, -198, 10, -1],
[.05,.4,.12, 40, -180, 20, -2],
[.05,.4,.12, 80, -52, 40, -20], // edge
[.05,.4,.12, 80, -50, 40, -20],
[.05,.4,.12, 80, 0, 40, 0]
];
Y = nSpline(X, 100); // interpolate wing data
sweep(gen_dat(Y,40));
mirror([1, 0, 0]) // second half
sweep(gen_dat(Y,40));
function gen_dat(X, N=100) = [ for(i=[0:len(X)-1])
let(x=X[i]) // get row
let(v2 = airfoil_data(naca = [x[0], x[1], x[2]], L = x[3], N=N))
let(v3 = T_(x[4], x[5], x[6], R_(0, 90, -90,vec3D(v2)))) // rotate and
translate
v3];
http://forum.openscad.org/file/n17187/wings.png
--
View this message in context: http://forum.openscad.org/Polygon-Offset-Function-tp17186p17187.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
On 04/25/2016 07:22 AM, Zappo wrote:
As a feature request, it would be very useful to have a Polygon Offset
function that operates on a 2-D polygon and returns 2-D polygon(s). The
engine has to be there already in CGAL with a point/segment representation?
There is 2D offset(), so I suspect you mean it should operate on just
the coordinates and return those?
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Transformations#offset
ciao,
Torsten.
Could you post the code for a section of the wing?
--
View this message in context: http://forum.openscad.org/Polygon-Offset-Function-tp17186p17191.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
If you want to create a 3D offset, all you need to do is scale your shape, as
I have done in the code attached for an ellipsoid. As I do not have full
access to all the vertices of the ellipsoid, this code produces only an
approximate 3D offset. But maybe you have access, or maybe you can live with
an approximation.
As given, the code renders on my system in 13 seconds.
wolf
$fn=50;
Diameter=2; // diameter of sphere from which ellipsoid is created
Offset=0.1Diameter;
MaxDim=[3Diameter,1Diameter,.5Diameter]; // long axes of ellipsoid
MakeOffset();
MakeCutout();
TestPosition();
module MakeOffset()
scale([1-2Offset/MaxDim[0],1-2Offset/MaxDim[1],1-2*Offset/MaxDim[2]])
// for a true offset, MaxDim[...] needs to be replaced with the norm of each
vertex for the ellipsoid
Ellipsoid();
module TestPosition()
translate([MaxDim[0]/2-Offset/2,0,0]) sphere(d=Offset);
translate([0,-(MaxDim[1]/2-Offset/2),0]) sphere(d=Offset);
translate([0,0,MaxDim[2]/2-Offset/2]) sphere(d=Offset);
module MakeCutout()
difference()
{ Ellipsoid();
translate([0,-15,15]) cube([70,30,30], center=true);
}
module Ellipsoid()
scale([MaxDim[0]/Diameter,MaxDim[1]/Diameter,MaxDim[2]/Diameter])
sphere(d=Diameter);
--
View this message in context: http://forum.openscad.org/Polygon-Offset-Function-tp17186p17192.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
I am guessing that I'll need tight control on the wall thicknesses to fake
out the slicers and keep a precise perimeter thickness for the outer
surface. Part of the problem is that for constant wall thickness, the inner
airfoil cut out is not a scaled version of the outer surface. And as the
airfoil size changes on a tapered wing, you need a new unique inner cutout
for each outer airfoil.
@Parkinbot - the splines will come in handy for doing fuselages, but it
seems you still have the same problem I was seeing. How do you get the
offset inner polygon? I am guessing the minkowski speed is a function of
the number of faces and not necessarily the size - Did you try to hollow
out your wing? Need to try to dynamically decrease step size where the
sections change. How well does your technique deal with airfoil sections
containing different numbers of polygon points? For me, stitching together
internal airfoil cutouts with differing polygon vertex counts will require
some special casing.
@Torsten - yes a function returning a polygon vs a transform. Any
suggestion for how to code up a convex poly offset function without writing
a duplicate of the CGAL routine in native OpenSCAD?
Is there a way to call python code from within OpenSCAD?
@cbernhardt - let me clean it up
@wolf - not sure that scaling works really well if we're trying to maintain
uniform wall thickness. Scaling works ok on an ellipse as in your example,
but consider what happens at the pointy trailing edge compared to the
leading edge.
--
View this message in context: http://forum.openscad.org/Polygon-Offset-Function-tp17186p17200.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Zappo wrote
Is there a way to call python code from within OpenSCAD?
Not directly, but you can combine command line
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Using_OpenSCAD_in_a_command_line_environment
usage with include<> or use<>, where your python script populates a scad
file with variables which you include.
Admin - PM me if you need anything, or if I've done something stupid...
Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.
View this message in context: http://forum.openscad.org/Polygon-Offset-Function-tp17186p17202.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
BTW, most slicers offer hollow slicing (infill = 0). Did you try this?
Didn't promise a general solution, but offered a work around. The inpolation
approach uses a skeleton with 6 airfoils. Each one needs to be 'paired' with
a core airfoil for difference after sweep(). Thats all. The outer one has to
be placed carefully with less distance. Viable, but needs some 'tuning'.
Don't know your Naca. But try something like this. (For rotation of polygons
Rx_, Ry_, Rz_ from my library may be used.)
use
<Naca4.scad>
difference()
{
translate([-40, -5, 1])
airfoil(naca=[0.05, .4, .08], L=100);
translate([-38, -4.5, -1])
rotate([0, 0, 0.4])
airfoil(naca=[0.048, .4, .06], L=90, h = 10);
}
Zappo wrote
I am guessing that I'll need tight control on the wall thicknesses to fake
out the slicers and keep a precise perimeter thickness for the outer
surface. Part of the problem is that for constant wall thickness, the
inner airfoil cut out is not a scaled version of the outer surface. And
as the airfoil size changes on a tapered wing, you need a new unique inner
cutout for each outer airfoil.
@Parkinbot - the splines will come in handy for doing fuselages, but it
seems you still have the same problem I was seeing. How do you get the
offset inner polygon? I am guessing the minkowski speed is a function of
the number of faces and not necessarily the size - Did you try to hollow
out your wing? Need to try to dynamically decrease step size where the
sections change. How well does your technique deal with airfoil sections
containing different numbers of polygon points? For me, stitching
together internal airfoil cutouts with differing polygon vertex counts
will require some special casing.
--
View this message in context: http://forum.openscad.org/Polygon-Offset-Function-tp17186p17207.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Ah, I forgot to answer: I don't see any need for stitching different vertex
counts, while doing a sweep().
But if you really want to do it you can use the more general function
skin() https://github.com/openscad/list-comprehension-demos instead of
sweep() - they are interchangeable. It was discussed here
http://forum.openscad.org/Rendering-fails-difference-between-F5-and-F6-td15041i40.html
.
Also union() will connect sweeps with different vertex counts. I use this
e.g. to implement furcations
http://forum.openscad.org/Rendering-fails-difference-between-F5-and-F6-tp15041p15182.html
.
Zappo wrote
How well does your technique deal with airfoil sections containing
different numbers of polygon points? For me, stitching together internal
airfoil cutouts with differing polygon vertex counts will require some
special casing.
--
View this message in context: http://forum.openscad.org/Polygon-Offset-Function-tp17186p17208.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Good point, about the slicers. With Slic3r, one can specify no infill
and a fixed number of perimeter shells, so there would be no need to use
OpenSCAD to create a hollow shape: just create a solid one and use the
slicer to do the dirty work.
On 4/27/2016 7:28 AM, Parkinbot wrote:
BTW, most slicers offer hollow slicing (infill = 0). Did you try this?