KB
Kenneth Beesley
Sat, Dec 14, 2019 3:38 PM
Newbie question:
On Mar 29, 2015, at https://stackoverflow.com/questions/28842419/linear-rotational-extrude-at-the-same-time
jinhwanlazy posted a very elegant solution for generating a curved tube that graduated in diameter from
beginning to end. Here it is with only minor changes (to the obsolete assign()).
use <scad-utils/transformations.scad>
use <scad-utils/shapes.scad>
use <skin.scad>
// https://stackoverflow.com/questions/28842419/linear-rotational-extrude-at-the-same-time
// by jinhwanlazy Mar 29 2015
fn=32;
$fn=60;
r1 = 25;
r2 = 10;
R = 40;
th = 2;
module tube()
{
difference()
{
skin([for(i=[0:fn])
transform(rotation([0, 180/fni, 0])translation([-R,0,0]),
circle(r1+(r1-r2)/fni))]);
//orig: assign(r1 = r1-th, r2 = r2-th)
r1 = r1-th;
r2 = r2-th;
skin([for(i=[0:fn])
transform(rotation([0, 180/fni, 0])translation([-R,0,0]),
circle(r1+(r1-r2)/fni))]);
}
}
tube();
I downloaded scad-utils and skin.scad to an appropriate directory (my OPENSCADPATH),
and compiling the example gives me no error—but also no display.
I suspect that since 2015, something else has become obsolete.
I got scad-utils from https://github.com/openscad/scad-utils
and skin.scad from https://github.com/openscad/list-comprehension-demos/blob/master/skin.scad
I would be most grateful if some OpenSCAD expert could set me straight.
Thanks,
Ken
Kenneth R. Beesley, D.Phil.
PO Box 540475
North Salt Lake UT 84054
USA
Newbie question:
On Mar 29, 2015, at https://stackoverflow.com/questions/28842419/linear-rotational-extrude-at-the-same-time
jinhwanlazy posted a very elegant solution for generating a curved tube that graduated in diameter from
beginning to end. Here it is with only minor changes (to the obsolete assign()).
use <scad-utils/transformations.scad>
use <scad-utils/shapes.scad>
use <skin.scad>
// https://stackoverflow.com/questions/28842419/linear-rotational-extrude-at-the-same-time
// by jinhwanlazy Mar 29 2015
fn=32;
$fn=60;
r1 = 25;
r2 = 10;
R = 40;
th = 2;
module tube()
{
difference()
{
skin([for(i=[0:fn])
transform(rotation([0, 180/fn*i, 0])*translation([-R,0,0]),
circle(r1+(r1-r2)/fn*i))]);
//orig: assign(r1 = r1-th, r2 = r2-th)
r1 = r1-th;
r2 = r2-th;
skin([for(i=[0:fn])
transform(rotation([0, 180/fn*i, 0])*translation([-R,0,0]),
circle(r1+(r1-r2)/fn*i))]);
}
}
tube();
I downloaded scad-utils and skin.scad to an appropriate directory (my OPENSCADPATH),
and compiling the example gives me no error—but also no display.
I suspect that since 2015, something else has become obsolete.
I got scad-utils from https://github.com/openscad/scad-utils
and skin.scad from https://github.com/openscad/list-comprehension-demos/blob/master/skin.scad
I would be most grateful if some OpenSCAD expert could set me straight.
Thanks,
Ken
*******************************
Kenneth R. Beesley, D.Phil.
PO Box 540475
North Salt Lake UT 84054
USA
RP
Ronaldo Persiano
Sat, Dec 14, 2019 5:26 PM
Hi, Ken.
You got no display due to your replacement of the deprecated assign by the
following two lines that redefine r1 and r2 for both skin calls! And they
cancel each other.
To substitute the original intent of the assign, module tube() might be:
module tube()
{
difference()
{
skin([for(i=[0:fn])
transform(rotation([0, 180/fn*i, 0])translation([-R,0,0]),
circle(r1+(r1-r2)/fni))]);
//orig: assign(r1 = r1-th, r2 = r2-th)
{ // defines a new scope
r1 = r1-th;
r2 = r2-th;
skin([for(i=[0:fn])
transform(rotation([0, 180/fn*i, 0])*translation([-R,0,0]),
circle(r1+(r1-r2)/fn*i))]);
}
}
}
Now, the redefinitions of r1 and r2 are in a confined scope that affects
only the second skin call.
But even simpler would be:
module tube()
{
difference()
{
skin([for(i=[0:fn])
transform(rotation([0, 180/fn*i, 0])translation([-R,0,0]),
circle(r1+(r1-r2)/fni))]);
skin([for(i=[0:fn])
transform(rotation([0, 180/fn*i, 0])*translation([-R,0,0]),
circle(r1-th+(r1-r2)/fn*i))]);
}
}
}
You may experiment a z-fighting with that code in preview mode but the
render is fine.
Em sáb., 14 de dez. de 2019 às 15:39, Kenneth Beesley krbeesley@gmail.com
escreveu:
Newbie question:
On Mar 29, 2015, at
https://stackoverflow.com/questions/28842419/linear-rotational-extrude-at-the-same-time
jinhwanlazy posted a very elegant solution for generating a curved tube
that graduated in diameter from
beginning to end. Here it is with only minor changes (to the obsolete
assign()).
use <scad-utils/transformations.scad>
use <scad-utils/shapes.scad>
use <skin.scad>
//
https://stackoverflow.com/questions/28842419/linear-rotational-extrude-at-the-same-time
// by jinhwanlazy Mar 29 2015
fn=32;
$fn=60;
r1 = 25;
r2 = 10;
R = 40;
th = 2;
module tube()
{
difference()
{
skin([for(i=[0:fn])
transform(rotation([0, 180/fni, 0])translation([-R,0,0]),
circle(r1+(r1-r2)/fni))]);
//orig: assign(r1 = r1-th, r2 = r2-th)
r1 = r1-th;
r2 = r2-th;
skin([for(i=[0:fn])
transform(rotation([0, 180/fni, 0])translation([-R,0,0]),
circle(r1+(r1-r2)/fni))]);
}
}
tube();
I downloaded scad-utils and skin.scad to an appropriate directory (my
OPENSCADPATH),
and compiling the example gives me no error—but also no display.
I suspect that since 2015, something else has become obsolete.
I got scad-utils from https://github.com/openscad/scad-utils
and skin.scad from
https://github.com/openscad/list-comprehension-demos/blob/master/skin.scad
I would be most grateful if some OpenSCAD expert could set me straight.
Thanks,
Ken
Kenneth R. Beesley, D.Phil.
PO Box 540475
North Salt Lake UT 84054
USA
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Hi, Ken.
You got no display due to your replacement of the deprecated assign by the
following two lines that redefine r1 and r2 for *both* skin calls! And they
cancel each other.
To substitute the original intent of the assign, module tube() might be:
module tube()
{
difference()
{
skin([for(i=[0:fn])
transform(rotation([0, 180/fn*i, 0])*translation([-R,0,0]),
circle(r1+(r1-r2)/fn*i))]);
//orig: assign(r1 = r1-th, r2 = r2-th)
{ // defines a new scope
r1 = r1-th;
r2 = r2-th;
skin([for(i=[0:fn])
transform(rotation([0, 180/fn*i, 0])*translation([-R,0,0]),
circle(r1+(r1-r2)/fn*i))]);
}
}
}
Now, the redefinitions of r1 and r2 are in a confined scope that affects
only the second skin call.
But even simpler would be:
module tube()
{
difference()
{
skin([for(i=[0:fn])
transform(rotation([0, 180/fn*i, 0])*translation([-R,0,0]),
circle(r1+(r1-r2)/fn*i))]);
skin([for(i=[0:fn])
transform(rotation([0, 180/fn*i, 0])*translation([-R,0,0]),
circle(r1-th+(r1-r2)/fn*i))]);
}
}
}
You may experiment a z-fighting with that code in preview mode but the
render is fine.
Em sáb., 14 de dez. de 2019 às 15:39, Kenneth Beesley <krbeesley@gmail.com>
escreveu:
> Newbie question:
>
> On Mar 29, 2015, at
> https://stackoverflow.com/questions/28842419/linear-rotational-extrude-at-the-same-time
> jinhwanlazy posted a very elegant solution for generating a curved tube
> that graduated in diameter from
> beginning to end. Here it is with only minor changes (to the obsolete
> assign()).
>
> use <scad-utils/transformations.scad>
> use <scad-utils/shapes.scad>
> use <skin.scad>
>
> //
> https://stackoverflow.com/questions/28842419/linear-rotational-extrude-at-the-same-time
> // by jinhwanlazy Mar 29 2015
>
> fn=32;
> $fn=60;
>
> r1 = 25;
> r2 = 10;
> R = 40;
> th = 2;
>
> module tube()
> {
> difference()
> {
> skin([for(i=[0:fn])
> transform(rotation([0, 180/fn*i, 0])*translation([-R,0,0]),
> circle(r1+(r1-r2)/fn*i))]);
> //orig: assign(r1 = r1-th, r2 = r2-th)
> r1 = r1-th;
> r2 = r2-th;
> skin([for(i=[0:fn])
> transform(rotation([0, 180/fn*i, 0])*translation([-R,0,0]),
> circle(r1+(r1-r2)/fn*i))]);
> }
> }
>
> tube();
>
>
> I downloaded scad-utils and skin.scad to an appropriate directory (my
> OPENSCADPATH),
> and compiling the example gives me no error—but also no display.
>
> I suspect that since 2015, something else has become obsolete.
> I got scad-utils from https://github.com/openscad/scad-utils
> and skin.scad from
> https://github.com/openscad/list-comprehension-demos/blob/master/skin.scad
>
> I would be most grateful if some OpenSCAD expert could set me straight.
>
> Thanks,
>
> Ken
>
>
> *******************************
> Kenneth R. Beesley, D.Phil.
> PO Box 540475
> North Salt Lake UT 84054
> USA
>
>
>
>
>
>
>
> _______________________________________________
> OpenSCAD mailing list
> Discuss@lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
NH
nop head
Sat, Dec 14, 2019 5:35 PM
Simply replacing assign with let will usually work as well.
On Sat, 14 Dec 2019 at 17:27, Ronaldo Persiano rcmpersiano@gmail.com
wrote:
Hi, Ken.
You got no display due to your replacement of the deprecated assign by the
following two lines that redefine r1 and r2 for both skin calls! And
they cancel each other.
To substitute the original intent of the assign, module tube() might be:
module tube()
{
difference()
{
skin([for(i=[0:fn])
transform(rotation([0, 180/fn*i, 0])translation([-R,0,0]),
circle(r1+(r1-r2)/fni))]);
//orig: assign(r1 = r1-th, r2 = r2-th)
{ // defines a new scope
r1 = r1-th;
r2 = r2-th;
skin([for(i=[0:fn])
transform(rotation([0, 180/fn*i, 0])*translation([-R,0,0]),
circle(r1+(r1-r2)/fn*i))]);
}
}
}
Now, the redefinitions of r1 and r2 are in a confined scope that affects
only the second skin call.
But even simpler would be:
module tube()
{
difference()
{
skin([for(i=[0:fn])
transform(rotation([0, 180/fn*i, 0])translation([-R,0,0]),
circle(r1+(r1-r2)/fni))]);
skin([for(i=[0:fn])
transform(rotation([0, 180/fn*i, 0])*translation([-R,0,0]),
circle(r1-th+(r1-r2)/fn*i))]);
}
}
}
You may experiment a z-fighting with that code in preview mode but the
render is fine.
Em sáb., 14 de dez. de 2019 às 15:39, Kenneth Beesley krbeesley@gmail.com
escreveu:
Newbie question:
On Mar 29, 2015, at
https://stackoverflow.com/questions/28842419/linear-rotational-extrude-at-the-same-time
jinhwanlazy posted a very elegant solution for generating a curved tube
that graduated in diameter from
beginning to end. Here it is with only minor changes (to the obsolete
assign()).
use <scad-utils/transformations.scad>
use <scad-utils/shapes.scad>
use <skin.scad>
//
https://stackoverflow.com/questions/28842419/linear-rotational-extrude-at-the-same-time
// by jinhwanlazy Mar 29 2015
fn=32;
$fn=60;
r1 = 25;
r2 = 10;
R = 40;
th = 2;
module tube()
{
difference()
{
skin([for(i=[0:fn])
transform(rotation([0, 180/fni, 0])translation([-R,0,0]),
circle(r1+(r1-r2)/fni))]);
//orig: assign(r1 = r1-th, r2 = r2-th)
r1 = r1-th;
r2 = r2-th;
skin([for(i=[0:fn])
transform(rotation([0, 180/fni, 0])translation([-R,0,0]),
circle(r1+(r1-r2)/fni))]);
}
}
tube();
I downloaded scad-utils and skin.scad to an appropriate directory (my
OPENSCADPATH),
and compiling the example gives me no error—but also no display.
I suspect that since 2015, something else has become obsolete.
I got scad-utils from https://github.com/openscad/scad-utils
and skin.scad from
https://github.com/openscad/list-comprehension-demos/blob/master/skin.scad
I would be most grateful if some OpenSCAD expert could set me straight.
Thanks,
Ken
Kenneth R. Beesley, D.Phil.
PO Box 540475
North Salt Lake UT 84054
USA
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Simply replacing assign with let will usually work as well.
On Sat, 14 Dec 2019 at 17:27, Ronaldo Persiano <rcmpersiano@gmail.com>
wrote:
> Hi, Ken.
>
> You got no display due to your replacement of the deprecated assign by the
> following two lines that redefine r1 and r2 for *both* skin calls! And
> they cancel each other.
> To substitute the original intent of the assign, module tube() might be:
>
> module tube()
> {
> difference()
> {
> skin([for(i=[0:fn])
> transform(rotation([0, 180/fn*i, 0])*translation([-R,0,0]),
> circle(r1+(r1-r2)/fn*i))]);
> //orig: assign(r1 = r1-th, r2 = r2-th)
>
> { // defines a new scope
>
> r1 = r1-th;
>
> r2 = r2-th;
>
> skin([for(i=[0:fn])
>
> transform(rotation([0, 180/fn*i, 0])*translation([-R,0,0]),
>
> circle(r1+(r1-r2)/fn*i))]);
>
> }
> }
> }
>
>
> Now, the redefinitions of r1 and r2 are in a confined scope that affects
> only the second skin call.
> But even simpler would be:
>
> module tube()
> {
> difference()
> {
> skin([for(i=[0:fn])
> transform(rotation([0, 180/fn*i, 0])*translation([-R,0,0]),
> circle(r1+(r1-r2)/fn*i))]);
> skin([for(i=[0:fn])
>
> transform(rotation([0, 180/fn*i, 0])*translation([-R,0,0]),
> circle(r1-th+(r1-r2)/fn*i))]);
>
> }
> }
> }
>
> You may experiment a z-fighting with that code in preview mode but the
> render is fine.
>
> Em sáb., 14 de dez. de 2019 às 15:39, Kenneth Beesley <krbeesley@gmail.com>
> escreveu:
>
>> Newbie question:
>>
>> On Mar 29, 2015, at
>> https://stackoverflow.com/questions/28842419/linear-rotational-extrude-at-the-same-time
>> jinhwanlazy posted a very elegant solution for generating a curved tube
>> that graduated in diameter from
>> beginning to end. Here it is with only minor changes (to the obsolete
>> assign()).
>>
>> use <scad-utils/transformations.scad>
>> use <scad-utils/shapes.scad>
>> use <skin.scad>
>>
>> //
>> https://stackoverflow.com/questions/28842419/linear-rotational-extrude-at-the-same-time
>> // by jinhwanlazy Mar 29 2015
>>
>> fn=32;
>> $fn=60;
>>
>> r1 = 25;
>> r2 = 10;
>> R = 40;
>> th = 2;
>>
>> module tube()
>> {
>> difference()
>> {
>> skin([for(i=[0:fn])
>> transform(rotation([0, 180/fn*i, 0])*translation([-R,0,0]),
>> circle(r1+(r1-r2)/fn*i))]);
>> //orig: assign(r1 = r1-th, r2 = r2-th)
>> r1 = r1-th;
>> r2 = r2-th;
>> skin([for(i=[0:fn])
>> transform(rotation([0, 180/fn*i, 0])*translation([-R,0,0]),
>> circle(r1+(r1-r2)/fn*i))]);
>> }
>> }
>>
>> tube();
>>
>>
>> I downloaded scad-utils and skin.scad to an appropriate directory (my
>> OPENSCADPATH),
>> and compiling the example gives me no error—but also no display.
>>
>> I suspect that since 2015, something else has become obsolete.
>> I got scad-utils from https://github.com/openscad/scad-utils
>> and skin.scad from
>> https://github.com/openscad/list-comprehension-demos/blob/master/skin.scad
>>
>> I would be most grateful if some OpenSCAD expert could set me straight.
>>
>> Thanks,
>>
>> Ken
>>
>>
>> *******************************
>> Kenneth R. Beesley, D.Phil.
>> PO Box 540475
>> North Salt Lake UT 84054
>> USA
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> OpenSCAD mailing list
>> Discuss@lists.openscad.org
>> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>>
> _______________________________________________
> OpenSCAD mailing list
> Discuss@lists.openscad.org
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
KB
Kenneth Beesley
Sun, Dec 15, 2019 5:21 AM
Olá Ronaldo,
Many thanks for the reply.
Muito obrigado pela sua resposta.
Alas, the modified examples that you so kindly supplied still don't work for
me. They compile without complaint, but nothing appears in the preview. As
posted, the second "simpler" version has an extra } character and won't work
for anybody.
And it doesn't work even if I take out the offending extra }.
Has anyone else had success with these examples? It's probably my fault
somehow, but I don't know what to try next.
Thanks,
Ken
--
Sent from: http://forum.openscad.org/
Olá Ronaldo,
Many thanks for the reply.
Muito obrigado pela sua resposta.
Alas, the modified examples that you so kindly supplied still don't work for
me. They compile without complaint, but nothing appears in the preview. As
posted, the second "simpler" version has an extra } character and won't work
for anybody.
And it doesn't work even if I take out the offending extra }.
Has anyone else had success with these examples? It's probably my fault
somehow, but I don't know what to try next.
Thanks,
Ken
--
Sent from: http://forum.openscad.org/
KB
Kenneth Beesley
Sun, Dec 15, 2019 7:11 PM
My fault. Mea maxima culpa.
Ronaldo's second solution:
module tubeR2()
{
difference()
{
skin([for(i=[0:fn])
transform(rotation([0, 180/fni, 0])translation([-R,0,0]),
circle(r1+(r1-r2)/fni))]);
skin([for(i=[0:fn])
transform(rotation([0, 180/fni, 0])translation([-R,0,0]),
circle(r1-th+(r1-r2)/fni))]);
}
}
tubeR2();
now works for me. His first solution, defining a new scope for the
assignment of r1 and r2, still does not work for me. To my surprise,
jinhwanlazy's original script also works for me now, despite the use of
deprecated assign(...).
Thanks to Ronaldo and to all who have tried to help me.
Ken
--
Sent from: http://forum.openscad.org/
My fault. Mea maxima culpa.
Ronaldo's second solution:
module tubeR2()
{
difference()
{
skin([for(i=[0:fn])
transform(rotation([0, 180/fn*i, 0])*translation([-R,0,0]),
circle(r1+(r1-r2)/fn*i))]);
skin([for(i=[0:fn])
transform(rotation([0, 180/fn*i, 0])*translation([-R,0,0]),
circle(r1-th+(r1-r2)/fn*i))]);
}
}
tubeR2();
now works for me. His first solution, defining a new scope for the
assignment of r1 and r2, still does not work for me. To my surprise,
jinhwanlazy's original script also works for me now, despite the use of
deprecated assign(...).
Thanks to Ronaldo and to all who have tried to help me.
Ken
--
Sent from: http://forum.openscad.org/