# Strangeness When Attempting a Cross-section of a Gear

7 messages
Open this post in threaded view
|

## Strangeness When Attempting a Cross-section of a Gear

 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 ; 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 the OpenSCAD mailing list archive at Nabble.com._______________________________________________ OpenSCAD mailing list To unsubscribe send an email to [hidden email]
Open this post in threaded view
|

## Re: Strangeness When Attempting a Cross-section of a Gear

 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 ; 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 [hidden email] Sent from the OpenSCAD mailing list archive at Nabble.com._______________________________________________ OpenSCAD mailing list To unsubscribe send an email to [hidden email]
Open this post in threaded view
|

## Re: Strangeness When Attempting a Cross-section of a Gear

 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 at Nabble.com._______________________________________________ OpenSCAD mailing list To unsubscribe send an email to [hidden email]
Open this post in threaded view
|

## Re: Strangeness When Attempting a Cross-section of a Gear

 The bottom faces are reversed.- RevarOn Apr 20, 2021, at 6:04 PM, LenStruttmann <[hidden email]> 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 at Nabble.com._______________________________________________OpenSCAD mailing listTo unsubscribe send an email to [hidden email]_______________________________________________ OpenSCAD mailing list To unsubscribe send an email to [hidden email]
Open this post in threaded view
|

## Re: Strangeness When Attempting a Cross-section of a Gear

 In reply to this post by LenStruttmann 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 [hidden email] Sent from the OpenSCAD mailing list archive at Nabble.com._______________________________________________ OpenSCAD mailing list To unsubscribe send an email to [hidden email]