[OpenSCAD] Drawing a horn torus and the dreaded "winding order" error
Jez Weston
jezweston at yahoo.com
Wed Aug 17 08:11:13 CEST 2011
Ok, the geometry below attempts to use a torus to smooth a joint between two cylinders at right angles to each other. When the major radius of the torus is greater than twice the minor radius, the geometry is created just fine. If the major radius is less than twice, then CSG works, but CGAL causes problems. When using a union() statement , I get the "ERROR: Illegal polygonal object - make sure all polygons are defined with the same winding order. Skipping affected object." and the torus is not drawn. Without the union statement (i.e. just drawing the two cylinders and the torus) I get a C++ exception and a crash.
I think this must be something to do with the torus intersecting itself, but I'm buggered if I know what to do about it. I've tried changing the qualityfn and convexity numbers, to no avail.
Any ideas on how can I either get this code to work or to draw a similar shape?
Jez
-----------------------------------------------------------
// Model specific parameters
qualityfn = 36;
convexityn = 10;
cylinder_radius = 7; // Radius of cylinders and minor radius of torus
join_radius = 13.9; // Major radius of torus and radius of blend between cylinders
// 13.9 or smaller is ok in CSG but crashes CGAL
// 14.1 works fine for both
SmoothJoinCylinders ( 70, 130, cylinder_radius, join_radius);
module SmoothJoinCylinders ( w, l, r1, r2 ) {
union() {
// Bottom edge
translate ([r2, r1, 0])
rotate ( a = 90, v = [0,1,0])
cylinder ( h = w-r2-r2, r= r1, $fn = qualityfn );
// Bottom left corner
translate ([ r2, r2, 0 ])
rotate_extrude (convexity = convexityn, $fn = qualityfn)
translate ([ r2-r1, 0, 0 ])
circle (r = r1 );
// Left edge
translate ([r1, r2, 0])
rotate ( a = -90, v = [1,0,0])
cylinder ( h = l-r2-r2, r = r1, $fn = qualityfn );
}
}-----------------------------------------------------------
________________________________
From: Jez Weston <jezweston at yahoo.com>
To: "openscad at rocklinux.org" <openscad at rocklinux.org>
Sent: Wednesday, 10 August 2011, 23:04
Subject: Re: [OpenSCAD] Drawing a horn torus and the dreaded "winding order" error
Hmm... I'm finding that for some geometry, my fudge factor needs to be much larger than that, millimetres, in fact and that's a problem for this particular design.
When I get the chance, I'll dig into exactly which geometry is causing this, but it seems to be down to cylinders which I wanted to fit smoothly with toruses, i.e. the radius of the cylinder equals the minor radius of the torus and they are tangent.
________________________________
From: Triffid Hunter <triffid.hunter at gmail.com>
To: Jez Weston <jezweston at yahoo.com>; openscad at rocklinux.org
Sent: Wednesday, 10 August 2011, 22:10
Subject: Re: [OpenSCAD] Drawing a horn torus and the dreaded "winding order" error
On Wed, Aug 10, 2011 at 8:03 PM, Jez Weston <jezweston at yahoo.com> wrote:
>
> Hi Triff,
> I thought it would be something like that. However, other programs can draw
> that geometry. It seems that OpenSCAD doesn't like a variety of other things
> that I'm doing with toruses and tangents to torus surfaces. Is there a fix
> or work-around?
yep, you've already found it- fudge factors! offset by 0.001 usually
sorts it out, and won't show up in a
print
_______________________________________________
OpenSCAD mailing list
OpenSCAD at rocklinux.org
http://rocklinux.net/mailman/listinfo/openscad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rocklinux.net/pipermail/openscad/attachments/20110817/e94a26b8/attachment.html
More information about the OpenSCAD
mailing list