Rotate_Extrude bug

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Rotate_Extrude bug

stonysmith
Something is funky with Rotate_Extrude.. the code below generates the
"winding error" message if you use an even number for $fn, but works
fine for odd values.

FYI.. This example also is a different way to do the fan in Example#9.

$fn=31;
module blade(){
    linear_extrude(twist=-60,height=5,slices=$fn,center=true)square([0.5,10]);
}

module blades(){
  rotate([0,0,0])blade();
  rotate([0,0,72])blade();
  rotate([0,0,144])blade();
  rotate([0,0,216])blade();
  rotate([0,0,288])blade();
}

module body(){
  union(){
    intersection(){
     # blades();
      rotate_extrude(center=true)translate([4,0,0])scale([1,0.5,1])circle(r=4);
      }
    cylinder(r=2,h=5,center=true);
    }
}

body();

Reply | Threaded
Open this post in threaded view
|

Re: Rotate_Extrude bug

clothbot
AFAIK, all the $-prefix variables are write-only, not intended to be read/accessed in this way.

Use a variable to share values between $fn and the slices parameter:

--snip--

sliceCount=32;
$fn=sliceCount;
module blade(){
linear_extrude(twist=-60,height=5,slices=sliceCount,center=true)square([0.5,10]);
}
module blades(){
rotate([0,0,0])blade();
rotate([0,0,72])blade();
rotate([0,0,144])blade();
rotate([0,0,216])blade();
rotate([0,0,288])blade();
}
module body(){
union(){
intersection(){
# blades();
rotate_extrude(center=true)translate([4,0,0])scale([1,0.5,1])circle(r=4);
}
cylinder(r=2,h=5,center=true);
}
}
body();

--end-snip--


On 2010-08-23, at 2:58 PM, Stony Smith wrote:

> Something is funky with Rotate_Extrude.. the code below generates the
> "winding error" message if you use an even number for $fn, but works
> fine for odd values.
>
> FYI.. This example also is a different way to do the fan in Example#9.
>
> $fn=31;
> module blade(){
>    linear_extrude(twist=-60,height=5,slices=$fn,center=true)square([0.5,10]);
> }
>
> module blades(){
>  rotate([0,0,0])blade();
>  rotate([0,0,72])blade();
>  rotate([0,0,144])blade();
>  rotate([0,0,216])blade();
>  rotate([0,0,288])blade();
> }
>
> module body(){
>  union(){
>    intersection(){
>     # blades();
>      rotate_extrude(center=true)translate([4,0,0])scale([1,0.5,1])circle(r=4);
>      }
>    cylinder(r=2,h=5,center=true);
>    }
> }
>
> body();
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://rocklinux.net/mailman/listinfo/openscad

--

"The future is already here.  It's just not very evenly distributed" -- William Gibson

Me: http://clothbot.com/wiki/