discuss@lists.openscad.org

OpenSCAD general discussion

View all threads

Strangeness When Attempting a Cross-section of a Gear

L
LenStruttmann
Wed, Apr 21, 2021 12:22 AM

Good day!

I'm seeing some very strange behavior while trying to create a cross-section
of a bevel gear. I create the gear, then do either a difference() or an
intersection() with a cubic object. I tried creating the cubic in three
ways, using polyhedron(), linear_extrude a square, and with cube().  In all
three methods, the preview shows some very strange missing surfaces and
artifacts.  Using the polyhedron, it would not even render.

I get similar behavior with a bevel gear create by Dario Pellegrini's
PolyGear.scad and with BOSL2/gears.scad.

Is this expected behavior for these types of objects?

Here's the code for using PolyGear.scad:

//**********************************
use <PolyGear.scad>;

gear_teeth        = 23;
gear_pitch        = 5;
gear_slices      = 1;
gear_spiral_angle = 45;

gear_face_width  = 5;
gear_module      = 1;

difference()
{
bevel_gear( gear_teeth, m=gear_module, w=gear_face_width,
helix_angle=gear_spiral_angle );

//  bevel_pair( gear_teeth, gear_teeth, m=gear_module, w=gear_face_width,
helix_angle=gear_spiral_angle );

//  translate( [ -17.8404, -217.8404, -3.03336 ] )
//  cube( [ 2
17.8404, 2*17.8404, 32.7904+3.03336] );

//  translate( [ -17.8404, -217.8404, -3.03336 ] )
//  linear_extrude( 32.7904+3.03336 )
//  square( [ 2
17.8404, 2*17.8404 ] );

p =[[17.8404, 0, 32.7904], [17.8404, 0, -3.03336], [17.8404, -17.8404,
32.7904], [17.8404, -17.8404, -3.03336], [-17.9834, 0, 32.7904], [-17.9834,
0, -3.03336], [-17.9834, -17.8404, 32.7904], [-17.9834, -17.8404,
-3.03336]];

f = [[0, 1, 3, 2], [4, 6, 7, 5], [0, 4, 5, 1], [2, 3, 7, 6], [0, 2, 6, 4],
[1, 3, 7, 5]];

polyhedron(p,f);

}
//**********************************

Thanks!  Len

--
Sent from: http://forum.openscad.org/

Good day! I'm seeing some very strange behavior while trying to create a cross-section of a bevel gear. I create the gear, then do either a difference() or an intersection() with a cubic object. I tried creating the cubic in three ways, using polyhedron(), linear_extrude a square, and with cube(). In all three methods, the preview shows some very strange missing surfaces and artifacts. Using the polyhedron, it would not even render. I get similar behavior with a bevel gear create by Dario Pellegrini's PolyGear.scad and with BOSL2/gears.scad. Is this expected behavior for these types of objects? Here's the code for using PolyGear.scad: //********************************** use <PolyGear.scad>; gear_teeth = 23; gear_pitch = 5; gear_slices = 1; gear_spiral_angle = 45; gear_face_width = 5; gear_module = 1; difference() { bevel_gear( gear_teeth, m=gear_module, w=gear_face_width, helix_angle=gear_spiral_angle ); // bevel_pair( gear_teeth, gear_teeth, m=gear_module, w=gear_face_width, helix_angle=gear_spiral_angle ); // translate( [ -17.8404, -2*17.8404, -3.03336 ] ) // cube( [ 2*17.8404, 2*17.8404, 32.7904+3.03336] ); // translate( [ -17.8404, -2*17.8404, -3.03336 ] ) // linear_extrude( 32.7904+3.03336 ) // square( [ 2*17.8404, 2*17.8404 ] ); p =[[17.8404, 0, 32.7904], [17.8404, 0, -3.03336], [17.8404, -17.8404, 32.7904], [17.8404, -17.8404, -3.03336], [-17.9834, 0, 32.7904], [-17.9834, 0, -3.03336], [-17.9834, -17.8404, 32.7904], [-17.9834, -17.8404, -3.03336]]; f = [[0, 1, 3, 2], [4, 6, 7, 5], [0, 4, 5, 1], [2, 3, 7, 6], [0, 2, 6, 4], [1, 3, 7, 5]]; polyhedron(p,f); } //********************************** Thanks! Len -- Sent from: http://forum.openscad.org/
A
adrianv
Wed, Apr 21, 2021 12:43 AM

Does changing it to difference(convexity=10) help things?  Usually missing
surfaces in preview means a convexity argument is too low somewhere.

Note that if your polyhedron case doesn't render that means that you have an
invalid polyhedron.

LenStruttmann wrote

Good day!

I'm seeing some very strange behavior while trying to create a
cross-section
of a bevel gear. I create the gear, then do either a difference() or an
intersection() with a cubic object. I tried creating the cubic in three
ways, using polyhedron(), linear_extrude a square, and with cube().  In
all
three methods, the preview shows some very strange missing surfaces and
artifacts.  Using the polyhedron, it would not even render.

I get similar behavior with a bevel gear create by Dario Pellegrini's
PolyGear.scad and with BOSL2/gears.scad.

Is this expected behavior for these types of objects?

Here's the code for using PolyGear.scad:

//**********************************
use
<PolyGear.scad>
;

gear_teeth        = 23;
gear_pitch        = 5;
gear_slices      = 1;
gear_spiral_angle = 45;

gear_face_width  = 5;
gear_module      = 1;

difference()
{
bevel_gear( gear_teeth, m=gear_module, w=gear_face_width,
helix_angle=gear_spiral_angle );

//  bevel_pair( gear_teeth, gear_teeth, m=gear_module, w=gear_face_width,
helix_angle=gear_spiral_angle );

//  translate( [ -17.8404, -217.8404, -3.03336 ] )
//  cube( [ 2
17.8404, 2*17.8404, 32.7904+3.03336] );

//  translate( [ -17.8404, -217.8404, -3.03336 ] )
//  linear_extrude( 32.7904+3.03336 )
//  square( [ 2
17.8404, 2*17.8404 ] );

p =[[17.8404, 0, 32.7904], [17.8404, 0, -3.03336], [17.8404, -17.8404,
32.7904], [17.8404, -17.8404, -3.03336], [-17.9834, 0, 32.7904],
[-17.9834,
0, -3.03336], [-17.9834, -17.8404, 32.7904], [-17.9834, -17.8404,
-3.03336]];

f = [[0, 1, 3, 2], [4, 6, 7, 5], [0, 4, 5, 1], [2, 3, 7, 6], [0, 2, 6,
4],
[1, 3, 7, 5]];

polyhedron(p,f);

}
//**********************************

Thanks!  Len

--
Sent from: http://forum.openscad.org/


OpenSCAD mailing list
To unsubscribe send an email to

discuss-leave@.openscad

Does changing it to difference(convexity=10) help things? Usually missing surfaces in preview means a convexity argument is too low somewhere. Note that if your polyhedron case doesn't render that means that you have an invalid polyhedron. LenStruttmann wrote > Good day! > > I'm seeing some very strange behavior while trying to create a > cross-section > of a bevel gear. I create the gear, then do either a difference() or an > intersection() with a cubic object. I tried creating the cubic in three > ways, using polyhedron(), linear_extrude a square, and with cube(). In > all > three methods, the preview shows some very strange missing surfaces and > artifacts. Using the polyhedron, it would not even render. > > I get similar behavior with a bevel gear create by Dario Pellegrini's > PolyGear.scad and with BOSL2/gears.scad. > > Is this expected behavior for these types of objects? > > Here's the code for using PolyGear.scad: > > //********************************** > use > <PolyGear.scad> > ; > > gear_teeth = 23; > gear_pitch = 5; > gear_slices = 1; > gear_spiral_angle = 45; > > gear_face_width = 5; > gear_module = 1; > > difference() > { > bevel_gear( gear_teeth, m=gear_module, w=gear_face_width, > helix_angle=gear_spiral_angle ); > > // bevel_pair( gear_teeth, gear_teeth, m=gear_module, w=gear_face_width, > helix_angle=gear_spiral_angle ); > > > // translate( [ -17.8404, -2*17.8404, -3.03336 ] ) > // cube( [ 2*17.8404, 2*17.8404, 32.7904+3.03336] ); > > // translate( [ -17.8404, -2*17.8404, -3.03336 ] ) > // linear_extrude( 32.7904+3.03336 ) > // square( [ 2*17.8404, 2*17.8404 ] ); > > p =[[17.8404, 0, 32.7904], [17.8404, 0, -3.03336], [17.8404, -17.8404, > 32.7904], [17.8404, -17.8404, -3.03336], [-17.9834, 0, 32.7904], > [-17.9834, > 0, -3.03336], [-17.9834, -17.8404, 32.7904], [-17.9834, -17.8404, > -3.03336]]; > > f = [[0, 1, 3, 2], [4, 6, 7, 5], [0, 4, 5, 1], [2, 3, 7, 6], [0, 2, 6, > 4], > [1, 3, 7, 5]]; > > polyhedron(p,f); > > } > //********************************** > > > Thanks! Len > > > > -- > Sent from: http://forum.openscad.org/ > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to > discuss-leave@.openscad -- Sent from: http://forum.openscad.org/
L
LenStruttmann
Wed, Apr 21, 2021 1:04 AM

Thanks for the replay,

  1. Adding convexity=10 to the polyhedron(), linear_extrude(), and
    difference() did help some with the preview, but did not completely fix it.
    It's at least usable as a preview now.  Thanks!

  2. The polyhedron is a simple rectangular solid.  By itself, it previews and
    renders fine.  Can anyone see anything wrong with it?

p =[[17.8404, 0,        32.7904],
[17.8404, 0,        -3.03336],
[17.8404, -17.8404,  32.7904],
[17.8404, -17.8404,  -3.03336],
[-17.9834, 0,        32.7904],
[-17.9834, 0,        -3.03336],
[-17.9834, -17.8404, 32.7904],
[-17.9834, -17.8404, -3.03336]];

f = [[0, 1, 3, 2], [4, 6, 7, 5], [0, 4, 5, 1], [2, 3, 7, 6], [0, 2, 6, 4],
[1, 3, 7, 5]];

polyhedron(p,f, convexity=10);

--
Sent from: http://forum.openscad.org/

Thanks for the replay, 1. Adding convexity=10 to the polyhedron(), linear_extrude(), and difference() did help some with the preview, but did not completely fix it. It's at least usable as a preview now. Thanks! 2. The polyhedron is a simple rectangular solid. By itself, it previews and renders fine. Can anyone see anything wrong with it? p =[[17.8404, 0, 32.7904], [17.8404, 0, -3.03336], [17.8404, -17.8404, 32.7904], [17.8404, -17.8404, -3.03336], [-17.9834, 0, 32.7904], [-17.9834, 0, -3.03336], [-17.9834, -17.8404, 32.7904], [-17.9834, -17.8404, -3.03336]]; f = [[0, 1, 3, 2], [4, 6, 7, 5], [0, 4, 5, 1], [2, 3, 7, 6], [0, 2, 6, 4], [1, 3, 7, 5]]; polyhedron(p,f, convexity=10); -- Sent from: http://forum.openscad.org/
RD
Revar Desmera
Wed, Apr 21, 2021 1:07 AM

The bottom faces are reversed.

  • Revar

On Apr 20, 2021, at 6:04 PM, LenStruttmann LenStruttmann@gmail.com wrote:

Thanks for the replay,

  1. Adding convexity=10 to the polyhedron(), linear_extrude(), and difference() did help some with the preview, but did not completely fix it.  It's at least usable as a preview now.  Thanks!

  2. The polyhedron is a simple rectangular solid.  By itself, it previews and renders fine.  Can anyone see anything wrong with it?

p =[[17.8404, 0,        32.7904],
[17.8404, 0,        -3.03336],
[17.8404, -17.8404,  32.7904],
[17.8404, -17.8404,  -3.03336],
[-17.9834, 0,        32.7904],
[-17.9834, 0,        -3.03336],
[-17.9834, -17.8404, 32.7904],
[-17.9834, -17.8404, -3.03336]];

f = [[0, 1, 3, 2], [4, 6, 7, 5], [0, 4, 5, 1], [2, 3, 7, 6], [0, 2, 6, 4], [1, 3, 7, 5]];

polyhedron(p,f, convexity=10);
Sent from the OpenSCAD mailing list archive http://forum.openscad.org/ at Nabble.com.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

The bottom faces are reversed. - Revar > On Apr 20, 2021, at 6:04 PM, LenStruttmann <LenStruttmann@gmail.com> wrote: > > Thanks for the replay, > > 1. Adding convexity=10 to the polyhedron(), linear_extrude(), and difference() did help some with the preview, but did not completely fix it. It's at least usable as a preview now. Thanks! > > 2. The polyhedron is a simple rectangular solid. By itself, it previews and renders fine. Can anyone see anything wrong with it? > > p =[[17.8404, 0, 32.7904], > [17.8404, 0, -3.03336], > [17.8404, -17.8404, 32.7904], > [17.8404, -17.8404, -3.03336], > [-17.9834, 0, 32.7904], > [-17.9834, 0, -3.03336], > [-17.9834, -17.8404, 32.7904], > [-17.9834, -17.8404, -3.03336]]; > > f = [[0, 1, 3, 2], [4, 6, 7, 5], [0, 4, 5, 1], [2, 3, 7, 6], [0, 2, 6, 4], [1, 3, 7, 5]]; > > polyhedron(p,f, convexity=10); > Sent from the OpenSCAD mailing list archive <http://forum.openscad.org/> at Nabble.com. > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
A
adrianv
Wed, Apr 21, 2021 1:18 AM

If it got better, but isn't fixed, probably convexity of 10 is still too
small.  Gears can have lots of teeth, so might need a high convexity.  Try
100 and see if it's better.  (Preview may get a little slow.)

As Revar noted, the bottom face of your polyhedron is reversed.  I
personally think that manually assembling polyhedron is folly, a recipe for
frustration.  I use the BOSL2 helper functions to make polyhedra, which
prevents (or at least substantially reduces) this sort of error.

To see your face reverse select the "thrown together" view and the bad face
will appear purple.

LenStruttmann wrote

Thanks for the replay,

  1. Adding convexity=10 to the polyhedron(), linear_extrude(), and
    difference() did help some with the preview, but did not completely fix
    it.
    It's at least usable as a preview now.  Thanks!

  2. The polyhedron is a simple rectangular solid.  By itself, it previews
    and
    renders fine.  Can anyone see anything wrong with it?

p =[[17.8404, 0,        32.7904],
[17.8404, 0,        -3.03336],
[17.8404, -17.8404,  32.7904],
[17.8404, -17.8404,  -3.03336],
[-17.9834, 0,        32.7904],
[-17.9834, 0,        -3.03336],
[-17.9834, -17.8404, 32.7904],
[-17.9834, -17.8404, -3.03336]];

f = [[0, 1, 3, 2], [4, 6, 7, 5], [0, 4, 5, 1], [2, 3, 7, 6], [0, 2, 6,
4],
[1, 3, 7, 5]];

polyhedron(p,f, convexity=10);

--
Sent from: http://forum.openscad.org/


OpenSCAD mailing list
To unsubscribe send an email to

discuss-leave@.openscad

If it got better, but isn't fixed, probably convexity of 10 is still too small. Gears can have lots of teeth, so might need a high convexity. Try 100 and see if it's better. (Preview may get a little slow.) As Revar noted, the bottom face of your polyhedron is reversed. I personally think that manually assembling polyhedron is folly, a recipe for frustration. I use the BOSL2 helper functions to make polyhedra, which prevents (or at least substantially reduces) this sort of error. To see your face reverse select the "thrown together" view and the bad face will appear purple. LenStruttmann wrote > Thanks for the replay, > > 1. Adding convexity=10 to the polyhedron(), linear_extrude(), and > difference() did help some with the preview, but did not completely fix > it. > It's at least usable as a preview now. Thanks! > > 2. The polyhedron is a simple rectangular solid. By itself, it previews > and > renders fine. Can anyone see anything wrong with it? > > p =[[17.8404, 0, 32.7904], > [17.8404, 0, -3.03336], > [17.8404, -17.8404, 32.7904], > [17.8404, -17.8404, -3.03336], > [-17.9834, 0, 32.7904], > [-17.9834, 0, -3.03336], > [-17.9834, -17.8404, 32.7904], > [-17.9834, -17.8404, -3.03336]]; > > f = [[0, 1, 3, 2], [4, 6, 7, 5], [0, 4, 5, 1], [2, 3, 7, 6], [0, 2, 6, > 4], > [1, 3, 7, 5]]; > > polyhedron(p,f, convexity=10); > > > > -- > Sent from: http://forum.openscad.org/ > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to > discuss-leave@.openscad -- Sent from: http://forum.openscad.org/
A
adrianv
Wed, Apr 21, 2021 1:20 AM

I forgot to say:  everything renders fine by itself, because CGAL doesn't
run.  CGAL only runs if you have at least two objects.  Add cube(1) and see
if it still renders.

LenStruttmann wrote

Thanks for the replay,

  1. Adding convexity=10 to the polyhedron(), linear_extrude(), and
    difference() did help some with the preview, but did not completely fix
    it.
    It's at least usable as a preview now.  Thanks!

  2. The polyhedron is a simple rectangular solid.  By itself, it previews
    and
    renders fine.  Can anyone see anything wrong with it?

p =[[17.8404, 0,        32.7904],
[17.8404, 0,        -3.03336],
[17.8404, -17.8404,  32.7904],
[17.8404, -17.8404,  -3.03336],
[-17.9834, 0,        32.7904],
[-17.9834, 0,        -3.03336],
[-17.9834, -17.8404, 32.7904],
[-17.9834, -17.8404, -3.03336]];

f = [[0, 1, 3, 2], [4, 6, 7, 5], [0, 4, 5, 1], [2, 3, 7, 6], [0, 2, 6,
4],
[1, 3, 7, 5]];

polyhedron(p,f, convexity=10);

--
Sent from: http://forum.openscad.org/


OpenSCAD mailing list
To unsubscribe send an email to

discuss-leave@.openscad

I forgot to say: *everything* renders fine by itself, because CGAL doesn't run. CGAL only runs if you have at least two objects. Add cube(1) and see if it still renders. LenStruttmann wrote > Thanks for the replay, > > 1. Adding convexity=10 to the polyhedron(), linear_extrude(), and > difference() did help some with the preview, but did not completely fix > it. > It's at least usable as a preview now. Thanks! > > 2. The polyhedron is a simple rectangular solid. By itself, it previews > and > renders fine. Can anyone see anything wrong with it? > > p =[[17.8404, 0, 32.7904], > [17.8404, 0, -3.03336], > [17.8404, -17.8404, 32.7904], > [17.8404, -17.8404, -3.03336], > [-17.9834, 0, 32.7904], > [-17.9834, 0, -3.03336], > [-17.9834, -17.8404, 32.7904], > [-17.9834, -17.8404, -3.03336]]; > > f = [[0, 1, 3, 2], [4, 6, 7, 5], [0, 4, 5, 1], [2, 3, 7, 6], [0, 2, 6, > 4], > [1, 3, 7, 5]]; > > polyhedron(p,f, convexity=10); > > > > -- > Sent from: http://forum.openscad.org/ > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to > discuss-leave@.openscad -- Sent from: http://forum.openscad.org/
L
LenStruttmann
Wed, Apr 21, 2021 1:35 AM

Thank you all so much.  Increasing the convexity and fixing the polyhedron
fixed it.

The preview is not 100% perfect, but very close.  And they all render.

Again, thanks for teaching me.

Len

--
Sent from: http://forum.openscad.org/

Thank you all so much. Increasing the convexity and fixing the polyhedron fixed it. The preview is not 100% perfect, but very close. And they all render. Again, thanks for teaching me. Len -- Sent from: http://forum.openscad.org/