http://forum.openscad.org/file/n18937/sweep.jpg
Hello
I have problems with joining different sweeped objects together.
Also the difference function of the basic sweeped obejct and a cylinder does
not work.
In the basic sweep object I notice a strange surface at the top and the
bottom. Can that be the cause?
Is this a know problem? How to solve it?
kind regards Johan
http://forum.openscad.org/file/n18937/sweep2.jpg
engelvleugel_v8_res.scad
http://forum.openscad.org/file/n18937/engelvleugel_v8_res.scad
--
View this message in context: http://forum.openscad.org/Combining-different-sweeps-does-not-work-tp18937.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
We had this before. This is in 99% a self-intersection problem. Try F12 view
after F5 and examine your object. Any purple triangles will indicate
self-intersection.
--
View this message in context: http://forum.openscad.org/Combining-different-sweeps-does-not-work-tp18937p18938.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Also try an update, if you're using my sweep-library.
--
View this message in context: http://forum.openscad.org/Combining-different-sweeps-does-not-work-tp18937p18939.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
I use the latest version from this site:
http://www.thingiverse.com/thing:900137/#files
--
View this message in context: http://forum.openscad.org/Combining-different-sweeps-does-not-work-tp18937p18940.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
If it is the first and last polygon face of the extrusion, try to invert the
polygon's point order from CW into CCW or vice versa.
Johan Jonker wrote
It is indeed selfintersection but it seems to be cause at the beginning
and end of the object.
--
View this message in context: http://forum.openscad.org/Combining-different-sweeps-does-not-work-tp18937p18941.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Just saw your code. Your extrusion paths are not well defined.
http://forum.openscad.org/file/n18942/jonker.png
--
View this message in context: http://forum.openscad.org/Combining-different-sweeps-does-not-work-tp18937p18942.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
The second problem is a bit more sophisticated. The polygon you feed into
vec3D() is not 2D. It is 3D already and - what seems to be the problem -
not-planar. Even sweep(), at least in theory, can work with this, it relies
on CGAL to deliver a sober triangulation for the caps.
I haven't diven deeper into sweeps with non-planar polygons, but I suspect
that these problems arise with alternate constructions done by CGAL.
My advice (work around): Use only planar polygons, which you get by a 2D
definition, use vec3D to embed it to 3D and transform it. This is the
scenario sweep() was developed for.
After that you can fine-tune the extrusion, e.g. by differencing or unioning
it with a polyhedron or any other union of 3D objects that alter the shape
of the planar caps.
To better see what's going on: The following code will create a one-slice
extrusion (shown as image)
RWALL = gen_outside_RW(RWING,1);
translate([0,0.3,0]) sweep(RWALL);
which - to my surprise - still seems to work well. But once you use a second
slice gen_outside_RW(RWING,2);, the construction seems to fail.
Nice (and mighty) approach, btw., but it has its caveats and will need some
analysis first to get some rules how it can be used and where are the
limits.
http://forum.openscad.org/file/n18943/jonker1.png
--
View this message in context: http://forum.openscad.org/Combining-different-sweeps-does-not-work-tp18937p18943.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Good idea:
http://forum.openscad.org/file/n18944/sweep3.jpg
It doesn't solve the problem but shows some other things that are incorrect.
--
View this message in context: http://forum.openscad.org/Combining-different-sweeps-does-not-work-tp18937p18944.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
here we are:
http://forum.openscad.org/file/n18945/jonker2.png
--
View this message in context: http://forum.openscad.org/Combining-different-sweeps-does-not-work-tp18937p18945.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Ok,
Yes I had modified that and didn't think of the 3D to 2D consquences.
I will fix that. Thanks for your time!
--
View this message in context: http://forum.openscad.org/Combining-different-sweeps-does-not-work-tp18937p18946.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Wow,
I see that I make this mistake also with a lot of other files.
So there is work to do. I let you know the results.
--
View this message in context: http://forum.openscad.org/Combining-different-sweeps-does-not-work-tp18937p18947.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
http://forum.openscad.org/file/n18963/sweep4.jpg After rewriting the code
it still doesn't work well.
And I don't understand why.
The image shows from top to bottom the lineair extrusion of the two 2D
layers. They look fine.
The lowest object is the sweep of the two 2D objects.
The 2D objects are build from 900 point and start on the left lower corner
follow the quarter circle to the bottom and then go counter clockwise back
to the start.
It is strange that there seem to appear crossing lines. They only appear at
the top and the bottom.
engelvleugel_v8_res.scad
http://forum.openscad.org/file/n18963/engelvleugel_v8_res.scad
B
--
View this message in context: http://forum.openscad.org/Combining-different-sweeps-does-not-work-tp18937p18963.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
http://forum.openscad.org/file/n18964/sweep5.jpg
I printed all the points of the two layers and exported them to excel and
checked if the points in both layers correspond. And the do.
What I think that happens is that the top and the bottom of the sweeped
object are in fact open. Openscad closes this by drawing triangles between
the different points of the top and bottom layer. You cannot control the
points they choose to connect.
Can someone explain how Openscad closes the top and bottom layers of a
sweeped object?
--
View this message in context: http://forum.openscad.org/Combining-different-sweeps-does-not-work-tp18937p18964.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Maybe interesting to add the excel file sweep.xlsx
http://forum.openscad.org/file/n18965/sweep.xlsx
--
View this message in context: http://forum.openscad.org/Combining-different-sweeps-does-not-work-tp18937p18965.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
To me your code looks fine and the sweep also works fine with 2016.04.06
using F5 and F6.
Sometimes it is a good idea to empty the cache or even to restart OpenSCAD
--
View this message in context: http://forum.openscad.org/Combining-different-sweeps-does-not-work-tp18937p18966.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Johan Jonker wrote
Can someone explain how Openscad closes the top and bottom layers of a
sweeped object?
Your question reduces to how Openscad triangulates the face of a polyhedron,
when it has more than 3 points. In an earlier version my sweep() did this
triangulation on its own. I used some sloppy algorithm that exploited some
symmetry of the point generator function I used for my airfoils. Later I
changed that and used the system's triangulation. For planar faces OpenSCAD
can do its own magic (I guess some ear cut algorithm or even a faster
routine). And - as you saw - for non-planar faces CGAL is used and tries
some alternate construction that can introduce curves and extra points to
the cap.
BTW, I never had problems with that, as long as the polygon was 'simple'
i.e. welldefined. That means: no self intersection, no double points.
--
View this message in context: http://forum.openscad.org/Combining-different-sweeps-does-not-work-tp18937p18967.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Here some nice and simple code allowing you to study non-planar triangulation
and the "minimal surfaces" the system generates. Seems to me like some
foward-backward ear-cut algorithm.
If you run the animation e.g. with 100 steps, you will see, that the
triangulation algorithm will work up to a certain slope but freaks out at
some point, making the result more or less unpredictable.
use
<Naca_sweep.scad>
N = 100;
t = 100;
T1 = -100*($t-.5);
T2 = 250*($t-.5);
sweep([gen(0, T1), gen(200, T2)]);
function gen(shift=0, T = 0) =
[for (i=[0:360/N:360]) [tsin(i), tcos(i), Tsin(2i)+shift]];
http://forum.openscad.org/file/n18970/jonker3.png
http://forum.openscad.org/file/n18970/jonker4.png
--
View this message in context: http://forum.openscad.org/Combining-different-sweeps-does-not-work-tp18937p18970.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Nice example.
I still see a remarkable difference between sweep and lineair extrusion with
the following code.
Do I use the wrong sweep version then? Or do you have the same results?
$fn=60;
use <Naca_sweep.scad>
punten =
[[0,0],[10,0],[10,8],[9,8],[9,1],[5,1],[5,9],[10,9],[10,10],[0,10]];
linear_extrude(height = 10, center = true, convexity = 10, twist = 0)
translate([10,10,10])
polygon(points= punten);
dat = vec3D(punten);
shape = [T_(0,0,0,dat),T_(0,0,10,dat)];
sweep(shape);
http://forum.openscad.org/file/n18983/sweep6.jpg
--
View this message in context: http://forum.openscad.org/Combining-different-sweeps-does-not-work-tp18937p18983.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Johan Jonker wrote
I still see a remarkable difference between sweep and lineair extrusion
with the following code.
Do I use the wrong sweep version then? Or do you have the same results?
The first problem is that your polygon is defined in reverse order for the
sweep you do (my code doesn't check for this). If you extrude shape =
[T_(0,0,0,dat),T_(0,0,-10,dat)]; to the reverse direction, or reverse your
definition, it should work (at least for the side parts of the extrusion).
The second problem is that the caps are not correctly triangulated by
polyhedron (i.e. the system). To be honest, I haven't yet encountered this
case yet and don't have an immediate solution for it. But cycling your
polygon definition around a bit, shows that it can work:
$fn=60;
use
<Naca_sweep.scad>
punten = [[9,8],[9,1],[5,1],[5,9], [10,9],[10,10],[0,10],
[0,0],[10,0],[10,8]];
dat = vec3D(punten);
shape = [T_(0,0,0,dat),T_(0,0,-10,dat)];
sweep(shape);
Therefore, I suspect polyhedron to employ a buggy triangulation. Unless
this doesn't get repaired, I'll implement my own triangulation when I find
time for it ... You can try to put this two constructions into a polyhedron
example
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Primitive_Solids#polyhedron
(sweep automatically constructs a polyhedron!) and announce the bug in a new
thread.
As workaround you always can try skin()
https://github.com/openscad/list-comprehension-demos instead of sweep().
You have to install scad-utils https://github.com/openscad/scad-utils
to settle its references. Then you can use it as you would use sweep(). It
does what you want - at least in this case.
Best Rudolf
--
View this message in context: http://forum.openscad.org/Combining-different-sweeps-does-not-work-tp18937p18988.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
Parkinbot wrote
The second problem is that the caps are not correctly triangulated by
polyhedron (i.e. the system). To be honest, I haven't yet encountered this
case yet and don't have an immediate solution for it.
But
cycling your polygon definition around a bit, shows that it can work:
I must correct myself in this point. The caps are correctly triangulated by
the system. I seems, you didn't use the newest version of Naca_sweep.scad,
which dates from 07-02-16.
So, reversing your polygon definition or your extrusion direction or using
skin() will solve your problem.
--
View this message in context: http://forum.openscad.org/Combining-different-sweeps-does-not-work-tp18937p18990.html
Sent from the OpenSCAD mailing list archive at Nabble.com.