discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Hirth coupling won't difference properly

M
mikeonenine@web.de
Sun, Aug 27, 2023 12:52 AM

It needs tidying up, but it ought to work as it is. Subtracting the Hirth shape from the end of a shaft is probably preferable to adding it, as it saves having to round the circumference of the polyhedron by intersecting it with a cylinder.

A bit of complexity helped, but more than 3 doesn’t help more.

What have I overlooked?

$vpr=[-35,-45,0];

// Hirth coupling

module Hirth()

{

for(i = [1 : 16])

rotate(i * 360/16)

polyhedron( convexity=5,

points = [

[0,0,2],

[11, PI*11.145/16, -PI*11.145/16/2*tan(60)+2],

[11, -PI*11.145/16, -PI*11.145/16/2*tan(60)+2],

[11, 0, PI*11.145/16/2*tan(60)+2],

[0,0,0]

],

faces = [

[1,2,3],

[0,1,2],

[3,2,0],

[3,0,1],

[4,1,2],

[4,0,2],

[4,0,1],

]);

}

// Shaft 1

translate([0,0,10])

difference()

{

translate([0,0,25])

cylinder(r=10, h=50, center=true);

rotate([0,0,360/64])

Hirth();

}

// Shaft 2

translate([0,0,-10])

rotate([0,180,0])

difference()

{

translate([0,0,25])

cylinder(r=10, h=50, center=true);

rotate([0,0,360/64])

Hirth();

}

It needs tidying up, but it ought to work as it is. Subtracting the Hirth shape from the end of a shaft is probably preferable to adding it, as it saves having to round the circumference of the polyhedron by intersecting it with a cylinder. A bit of complexity helped, but more than 3 doesn’t help more. What have I overlooked? $vpr=\[-35,-45,0\]; // Hirth coupling module Hirth() { for(i = \[1 : 16\]) rotate(i \* 360/16) polyhedron( convexity=5, points = \[ \[0,0,2\], \[11, PI\*11.145/16, -PI\*11.145/16/2\*tan(60)+2\], \[11, -PI\*11.145/16, -PI\*11.145/16/2\*tan(60)+2\], \[11, 0, PI\*11.145/16/2\*tan(60)+2\], \[0,0,0\] \], faces = \[ \[1,2,3\], \[0,1,2\], \[3,2,0\], \[3,0,1\], \[4,1,2\], \[4,0,2\], \[4,0,1\], \]); } // Shaft 1 translate(\[0,0,10\]) difference() { translate(\[0,0,25\]) cylinder(r=10, h=50, center=true); rotate(\[0,0,360/64\]) Hirth(); } // Shaft 2 translate(\[0,0,-10\]) rotate(\[0,180,0\]) difference() { translate(\[0,0,25\]) cylinder(r=10, h=50, center=true); rotate(\[0,0,360/64\]) Hirth(); }
M
mikeonenine@web.de
Sun, Aug 27, 2023 4:49 AM

Found the culprit!

Following consultation of the Manual, I discovered a hidden internal face. Getting rid of that fixed it:

$fn=100;

// F12 to check faces

$vpr=[-35,-45,0]; // Isometric view

// Hirth coupling

module Hirth()

{

for(i = [1 : 16])

rotate(i * 360/16)

polyhedron( convexity=3,

points = [

[0,0,2],

[11, PI*11.145/16, 0],

[11, -PI*11.145/16, 0],

[11, 0, PI*11.145/16*tan(60)],

[0,0,0]

],

faces = [

[1,2,3],

[3,2,0],

[3,0,1],

[4,2,1],

[4,0,2],

[4,1,0],

]);

}

// Shaft 1

translate([0,0,25-1])

difference()

{

cylinder(r=10, h=50, center=true);

cylinder(r=4, h=51, center=true);

translate([0,0,-25-0.001])

rotate([0,0,360/64])

Hirth();

}

// Shaft 2

translate([0,0,-25+1])

rotate([0,180,0])

difference()

{

cylinder(r=10, h=50, center=true);

cylinder(r=4, h=51, center=true);

translate([0,0,-25-0.001])

rotate([0,0,360/64])

Hirth();

}

Apologies to anyone who has been scratching their head on my behalf in the meantime!

Found the culprit! Following consultation of the Manual, I discovered a hidden internal face. Getting rid of that fixed it: $fn=100; // F12 to check faces $vpr=\[-35,-45,0\]; // Isometric view // Hirth coupling module Hirth() { for(i = \[1 : 16\]) rotate(i \* 360/16) polyhedron( convexity=3, points = \[ \[0,0,2\], \[11, PI\*11.145/16, 0\], \[11, -PI\*11.145/16, 0\], \[11, 0, PI\*11.145/16\*tan(60)\], \[0,0,0\] \], faces = \[ \[1,2,3\], \[3,2,0\], \[3,0,1\], \[4,2,1\], \[4,0,2\], \[4,1,0\], \]); } // Shaft 1 translate(\[0,0,25-1\]) difference() { cylinder(r=10, h=50, center=true); cylinder(r=4, h=51, center=true); translate(\[0,0,-25-0.001\]) rotate(\[0,0,360/64\]) Hirth(); } // Shaft 2 translate(\[0,0,-25+1\]) rotate(\[0,180,0\]) difference() { cylinder(r=10, h=50, center=true); cylinder(r=4, h=51, center=true); translate(\[0,0,-25-0.001\]) rotate(\[0,0,360/64\]) Hirth(); } Apologies to anyone who has been scratching their head on my behalf in the meantime!