discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Bent rod

K
K.C.C.
Sat, Sep 26, 2015 4:09 AM

I would like to plumb a model steam engine. How do I bend a rod around the
boiler to represent pipes? Just give me an example around a cylinder.  Down
the side then turn, then up around the cylinder.

--
View this message in context: http://forum.openscad.org/Bent-rod-tp14003.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

I would like to plumb a model steam engine. How do I bend a rod around the boiler to represent pipes? Just give me an example around a cylinder. Down the side then turn, then up around the cylinder. -- View this message in context: http://forum.openscad.org/Bent-rod-tp14003.html Sent from the OpenSCAD mailing list archive at Nabble.com.
R
runsun
Sat, Sep 26, 2015 5:34 AM

Not exactly what you are asking for, but should have enough details for you
to work with:

$fn=100;
eps=0.001; // to make sure there's no gap
r=1;
module Ring(r=r){
rotate_extrude()
translate( [3,0,0] )circle( r );
}

module Arc(r=r){
difference(){
Ring(r);
translate( [0,0, -2.5] )
cube( [5,5,5] );
}
}

module S(r){
Arc(r=r);
translate( [-eps,3,0 ] ) // use eps
rotate( [-90,0,180] )
translate( [0,-3,0 ] )
Arc(r=r);
}

difference(){
S();
S(r=0.6);
}

http://forum.openscad.org/file/n14004/20150925_bent_pipe.png


$  Runsun Pan, PhD

$ -- libs: doctest , faces ( git ), offliner ( git );

tips: hash( 1 , 2 ), sweep , var , lerp

$ -- Linux Mint 17.1 Rebecca x64  + OpenSCAD 2015.03.15/2015.04.01.nightly

--
View this message in context: http://forum.openscad.org/Bent-rod-tp14003p14004.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Not exactly what you are asking for, but should have enough details for you to work with: > $fn=100; > eps=0.001; // to make sure there's no gap > r=1; > module Ring(r=r){ > rotate_extrude() > translate( [3,0,0] )circle( r ); > } > > module Arc(r=r){ > difference(){ > Ring(r); > translate( [0,0, -2.5] ) > cube( [5,5,5] ); > } > } > > module S(r){ > Arc(r=r); > translate( [-eps,3,0 ] ) // use eps > rotate( [-90,0,180] ) > translate( [0,-3,0 ] ) > Arc(r=r); > } > > difference(){ > S(); > S(r=0.6); > } <http://forum.openscad.org/file/n14004/20150925_bent_pipe.png> ----- $ Runsun Pan, PhD $ -- libs: doctest , faces ( git ), offliner ( git ); tips: hash( 1 , 2 ), sweep , var , lerp $ -- Linux Mint 17.1 Rebecca x64 + OpenSCAD 2015.03.15/2015.04.01.nightly -- View this message in context: http://forum.openscad.org/Bent-rod-tp14003p14004.html Sent from the OpenSCAD mailing list archive at Nabble.com.
B
blobule
Sun, Sep 27, 2015 4:31 PM

%%%%%%%%%%%%%%%%%%%%%%%

$step=10;
$h=0.1;

// cr : cylinder radisu for wrapping
// r : radius of actual pipe
// vr : radius of "virtual" pipe, used to place the real pipe

module place(cr=20,r=5,vr=5,t=0) {
rotate(t,[0,0,1])
translate([cr+vr,0,t/3602vr])
rotate(90,[1,0,0]) linear_extrude(height=$h,center=true) circle(r=r);
}

module loop(cr=20,r=5,vr=5) {
for( t=[0:$step:360-$step/2] ) {
hull() {
place(cr=cr,r=r,vr=vr,t=t);
place(cr=cr,r=r,vr=vr,t=t+$step);
}
}
}

module emptyLoop(cr=20,rin=5,rout=7) {
difference() {
/render(convexity=2)/ loop(cr=cr,r=rout,vr=rout,$h=0.1);
/render(convexity=2)/ loop(cr=cr,r=rin,vr=rout,$h=0.5);
}
}

module manyLoops(cr=20,n=5,r=5,vr=5,h=0.1) {
for(i=[0:n-1]) {
translate([0,0,ivr2]) loop(cr=cr,r=r,vr=vr);
}
}

module manyEmptyLoops(cr=20,n=5,rout=7,rin=5) {
for(i=[0:n-1]) {
translate([0,0,irout2]) emptyLoop(cr=cr,rin=rin,rout=rout);
}
}

//place();
//loop();
//manyLoops();
manyEmptyLoops();

%translate([0,0,-20]) cylinder(r=20,h=100);

%%%%%%%%%%%%%%%%%%%%%%%%

http://forum.openscad.org/file/n14018/pipewrap.png

--
View this message in context: http://forum.openscad.org/Bent-rod-tp14003p14018.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

%%%%%%%%%%%%%%%%%%%%%%% $step=10; $h=0.1; // cr : cylinder radisu for wrapping // r : radius of actual pipe // vr : radius of "virtual" pipe, used to place the real pipe module place(cr=20,r=5,vr=5,t=0) { rotate(t,[0,0,1]) translate([cr+vr,0,t/360*2*vr]) rotate(90,[1,0,0]) linear_extrude(height=$h,center=true) circle(r=r); } module loop(cr=20,r=5,vr=5) { for( t=[0:$step:360-$step/2] ) { hull() { place(cr=cr,r=r,vr=vr,t=t); place(cr=cr,r=r,vr=vr,t=t+$step); } } } module emptyLoop(cr=20,rin=5,rout=7) { difference() { /*render(convexity=2)*/ loop(cr=cr,r=rout,vr=rout,$h=0.1); /*render(convexity=2)*/ loop(cr=cr,r=rin,vr=rout,$h=0.5); } } module manyLoops(cr=20,n=5,r=5,vr=5,h=0.1) { for(i=[0:n-1]) { translate([0,0,i*vr*2]) loop(cr=cr,r=r,vr=vr); } } module manyEmptyLoops(cr=20,n=5,rout=7,rin=5) { for(i=[0:n-1]) { translate([0,0,i*rout*2]) emptyLoop(cr=cr,rin=rin,rout=rout); } } //place(); //loop(); //manyLoops(); manyEmptyLoops(); %translate([0,0,-20]) cylinder(r=20,h=100); %%%%%%%%%%%%%%%%%%%%%%%% <http://forum.openscad.org/file/n14018/pipewrap.png> -- View this message in context: http://forum.openscad.org/Bent-rod-tp14003p14018.html Sent from the OpenSCAD mailing list archive at Nabble.com.
CA
Carsten Arnholm
Sun, Sep 27, 2015 10:29 PM

On 2015-09-27 18:31, blobule wrote:

%%%%%%%%%%%%%%%%%%%%%%%

$step=10;
$h=0.1;

// cr : cylinder radisu for wrapping
// r : radius of actual pipe
// vr : radius of "virtual" pipe, used to place the real pipe

module place(cr=20,r=5,vr=5,t=0) {
rotate(t,[0,0,1])
translate([cr+vr,0,t/3602vr])
rotate(90,[1,0,0]) linear_extrude(height=$h,center=true) circle(r=r);
}
....

That is a clever special case work-around for a missing feature: a
general sweep function that can take a 2d shape and sweep it along any path.

Thank you for this inspiring example.

Carsten Arnholm

On 2015-09-27 18:31, blobule wrote: > %%%%%%%%%%%%%%%%%%%%%%% > > $step=10; > $h=0.1; > > // cr : cylinder radisu for wrapping > // r : radius of actual pipe > // vr : radius of "virtual" pipe, used to place the real pipe > > module place(cr=20,r=5,vr=5,t=0) { > rotate(t,[0,0,1]) > translate([cr+vr,0,t/360*2*vr]) > rotate(90,[1,0,0]) linear_extrude(height=$h,center=true) circle(r=r); > } > .... That is a clever special case work-around for a missing feature: a general sweep function that can take a 2d shape and sweep it along any path. Thank you for this inspiring example. Carsten Arnholm
R
runsun
Mon, Sep 28, 2015 1:51 AM

Indeed. Bloblue's approach is way cooler.


$  Runsun Pan, PhD

$ -- libs: doctest , faces ( git ), offliner ( git );

tips: hash( 1 , 2 ), sweep , var , lerp

$ -- Linux Mint 17.1 Rebecca x64  + OpenSCAD 2015.03.15/2015.04.01.nightly

--
View this message in context: http://forum.openscad.org/Bent-rod-tp14003p14022.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Indeed. Bloblue's approach is way cooler. ----- $ Runsun Pan, PhD $ -- libs: doctest , faces ( git ), offliner ( git ); tips: hash( 1 , 2 ), sweep , var , lerp $ -- Linux Mint 17.1 Rebecca x64 + OpenSCAD 2015.03.15/2015.04.01.nightly -- View this message in context: http://forum.openscad.org/Bent-rod-tp14003p14022.html Sent from the OpenSCAD mailing list archive at Nabble.com.
CL
Chow Loong Jin
Mon, Sep 28, 2015 2:38 AM

On Mon, Sep 28, 2015 at 12:29:50AM +0200, Carsten Arnholm wrote:

On 2015-09-27 18:31, blobule wrote:

%%%%%%%%%%%%%%%%%%%%%%%

$step=10;
$h=0.1;

// cr : cylinder radisu for wrapping
// r : radius of actual pipe
// vr : radius of "virtual" pipe, used to place the real pipe

module place(cr=20,r=5,vr=5,t=0) {
rotate(t,[0,0,1])
translate([cr+vr,0,t/3602vr])
rotate(90,[1,0,0]) linear_extrude(height=$h,center=true) circle(r=r);
}
....

That is a clever special case work-around for a missing feature: a general
sweep function that can take a 2d shape and sweep it along any path.

Thank you for this inspiring example.

The code for using the generalized sweep() function is very similar. If you're
using a new enough OpenSCAD, I recommend that you use that instead. sweep.scad
is in
https://github.com/openscad/list-comprehension-demos/blob/master/sweep.scad, and
the transformations you can use are in
https://github.com/openscad/scad-utils/blob/master/transformations.scad

Examples on how to use sweep.scad can be found in list-comprehension-demos as
well.

--
Kind regards,
Loong Jin

On Mon, Sep 28, 2015 at 12:29:50AM +0200, Carsten Arnholm wrote: > On 2015-09-27 18:31, blobule wrote: > >%%%%%%%%%%%%%%%%%%%%%%% > > > >$step=10; > >$h=0.1; > > > >// cr : cylinder radisu for wrapping > >// r : radius of actual pipe > >// vr : radius of "virtual" pipe, used to place the real pipe > > > >module place(cr=20,r=5,vr=5,t=0) { > > rotate(t,[0,0,1]) > > translate([cr+vr,0,t/360*2*vr]) > > rotate(90,[1,0,0]) linear_extrude(height=$h,center=true) circle(r=r); > >} > > .... > > That is a clever special case work-around for a missing feature: a general > sweep function that can take a 2d shape and sweep it along any path. > > Thank you for this inspiring example. The code for using the generalized sweep() function is very similar. If you're using a new enough OpenSCAD, I recommend that you use that instead. sweep.scad is in https://github.com/openscad/list-comprehension-demos/blob/master/sweep.scad, and the transformations you can use are in https://github.com/openscad/scad-utils/blob/master/transformations.scad Examples on how to use sweep.scad can be found in list-comprehension-demos as well. -- Kind regards, Loong Jin
K
K.C.C.
Thu, Oct 1, 2015 4:55 AM

thanks! But I don't think you get the picture. I am modeling very small. Can
not be hollow. A pipe runs down the side of a steam engine boiler' the
around the boiler (cylinder) up to the steam dome.
http://forum.openscad.org/file/n14041/021-395dae4.jpg

--
View this message in context: http://forum.openscad.org/Bent-rod-tp14003p14041.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

thanks! But I don't think you get the picture. I am modeling very small. Can not be hollow. A pipe runs down the side of a steam engine boiler' the around the boiler (cylinder) up to the steam dome. <http://forum.openscad.org/file/n14041/021-395dae4.jpg> -- View this message in context: http://forum.openscad.org/Bent-rod-tp14003p14041.html Sent from the OpenSCAD mailing list archive at Nabble.com.