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

nop head nop.head at gmail.com
Thu Jun 30 11:10:18 EDT 2016


The reason it looked bad without render is you subtracted things with
coincident faces. You should always avoid that with some overlap.

The reason you got heights of 1 is the extra true parameter. I don't think
you can mix named and unnamed parameters.

This works:

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
difference()
{
echo ("first",pcbthin, pcbthick);
color("red") cylinder(h=pcbthin,r=pcbradout,$fn=100);
echo ("second",pcbthin, pcbthick);
translate([0, 0, -1])
    color("blue") cylinder(h=pcbthick + 2 ,r=pcbradin,$fn=100);
}
color("blue") cube([pcbthick,pcbradin,5], true);


On 30 June 2016 at 15:55, Doug McNutt <dmcnutt at macnauchtan.com> wrote:

> 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.
>
> _______________________________________________
> OpenSCAD mailing list
> Discuss at lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20160630/6db3c0da/attachment-0002.html>


More information about the Discuss mailing list