[OpenSCAD] question on my code

Yona Appletree hypher at gmail.com
Wed Apr 15 18:38:54 EDT 2015


Jerry,

I'm not sure I understand the problem. It seems like it works to me... 
you end up with a cylinder in the middle of the "bottom" section as I 
would expect:



What are you expecting it to do, exactly?

- Yona
> Jerry Davis <mailto:jdawgaz at gmail.com>
> April 15, 2015 at 15:29
> I have a module, called cylhole, which creates a cylinder with a hole 
> in it.
> If I call it by itself, it works like I want it to.
> If I call it in a difference() it somehow leaves the hole filled.
>
> I am not sure why, and what could I do to do what I really want to do.
>
> Here is the code:
>
> $fn = 60;
>
> // driver gear diameter = 16.32 mm
> // driven gear bottom diameter = 45.42 mm
> // driven gear top diameter = 13.55 mm
> // top layer = 3.15 mm on top of bottom layer
>
> // bottom layer has driver gear and bottom driven gear
> // top layer has rack and top driver gear
>
> cube_l = 88;
> cube_w = 60;
> cube_h = 5;
>
> module cylhole(r=3, h=3, hole=1) {
>   difference() {
>     cylinder(r=r, h=h, center=true);
>     cylinder(r=hole, h=h+1, center=true);
>   }
> }
>
> module bottom(r1=3, r2=3, foclen=9, nr=0) {
>   fl = (cube_l/8) + (foclen/2) + nr;
>   fr = (cube_l/8) - (foclen/2) + nr;
>   difference() {
>     cube([cube_l, cube_w, cube_h], center=true);
>     translate([fl, 0, 2]) color("Aqua") cylhole(r=r1, h=cube_h, 
> hole=1, center=true);
>     translate([fr, 0, 2]) color("Blue") cylhole(r=r2, h=cube_h, 
> hole=1, center=true);
>   }
> }
>
> // this doesn't ... hmm.
> bottom(r1=16.32/2, r2=45.42/2, foclen=28, nr=7);
>
> // this does what I think it should do
> translate([0, cube_w+20, 0]) cylhole(12, 5, 2);
>
> Jerry
>
> --
> Extra Ham Operator: K7AZJ
> Registered Linux User: 275424
> Raspberry Pi and Arduino developer
>
> /The most exciting phrase to hear in science - the one that heralds 
> new discoveries - is not "Eureka!" but "That's funny...".
> /- Isaac. Asimov
>
> /I//f you give someone a program, you will frustrate them for a day; 
> if you teach them how to program, you will frustrate them for a lifetime.
> /- Anonymous
>
> /If writing good code requires very little comments, then writing 
> really excellent code requires no comments at all!
> /- Ken Thompson
>
> _______________________________________________
> 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/20150415/188253fb/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 26476 bytes
Desc: not available
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20150415/188253fb/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: compose-unknown-contact.jpg
Type: image/jpeg
Size: 770 bytes
Desc: not available
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20150415/188253fb/attachment.jpg>


More information about the Discuss mailing list