[OpenSCAD] Can't figure out how to draw thin cylinders.

Doug McNutt dmcnutt at macnauchtan.com
Thu Jun 30 10:55:34 EDT 2016


pcbradin = 2.5; // inside radius of cktboard
pcbradout = 5.0; // outside radius of cktboard
pcbthin = 1/16;  // thickness of circuit board
pcbthick = 1/8;  // thickness of the subtracted cylinder
render (convexity=100) difference()
{
color("red");
echo ("first",pcbthin, pcbthick);
color("red") cylinder(h=pcbthin,r=pcbradout,$fn=100,true);
echo ("second",pcbthin, pcbthick);
color("blue") cylinder(h=pcbthick ,r=pcbradin,$fn=100,true);
}
color("blue") cube([pcbthick,pcbradin,5], true);

It's a first pass into creating some 3D presentations. But it's also my 
first time with the code.

I have a printed circuit board that needs to be circular with a hole in 
the center. Gerber files I have handled, but I need to mount the thing 
using ball bearings.

I'm failing to get a decent picture when I run the above which displays 
the circuit board with a 1 "inch" thickness that just won't go down to 
the 1/16 inch that's the real thickness.

I'm trying to subtract a smaller cylinder from one with an undesired 
center. Without the "render" command the cylinders look OK and have the 
requested colors but the smallest dimension I see is still one inch.

With the render as above all I get is an annulus with the right sized 
hole but 1 inch thick. None of the colors, except for the test "cube" at 
the bottom, are recognized.

Please hold my hand. I'm willing to admit I came from FORTRAN without a 
date code but I like perl and ubuntu is like the old days.




More information about the Discuss mailing list