discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Curved/bent conical tubing

P
pieterbos
Wed, Mar 1, 2017 10:03 PM

I have designed a 3d-printed trombone using openSCAD. It requires a bit of
conical tubing. I have tried several approaches and I have a few very well
working trombones, but none worked well enough for my tastes:

  • First attempt: sweeping a circle with list comprehension demos sweep, then
    use difference with a smaller one to get a hollow tube.

It works relatively fast, but generates lots of warnings and often errors
when renderings.

  • Second attempt: rendering two short cylinders a bit apart, one rotated
    slightly from the other, hull them together. Put that in a for loop rotated
    and translated along the desired path. then use difference with a smaller
    one to get a hollow tube.

This works very well without warnings or errors, but it is really slow if
you want it rendered at enough detail for really smooth prints - the
previous method ran in 30-45 minutes, but now my trombone tuning slide has
been rendering for over 75 minutes and is still going, on an intel core i7
running at 3.4-3.6Ghz.

So does anyone have a better approach? Writing code to rendering polyhedrons
manually will probably work, but I think it will be a tricky, complicated
and time consuming thing to write...

--
View this message in context: http://forum.openscad.org/Curved-bent-conical-tubing-tp20686.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

I have designed a 3d-printed trombone using openSCAD. It requires a bit of conical tubing. I have tried several approaches and I have a few very well working trombones, but none worked well enough for my tastes: - First attempt: sweeping a circle with list comprehension demos sweep, then use difference with a smaller one to get a hollow tube. It works relatively fast, but generates lots of warnings and often errors when renderings. - Second attempt: rendering two short cylinders a bit apart, one rotated slightly from the other, hull them together. Put that in a for loop rotated and translated along the desired path. then use difference with a smaller one to get a hollow tube. This works very well without warnings or errors, but it is really slow if you want it rendered at enough detail for really smooth prints - the previous method ran in 30-45 minutes, but now my trombone tuning slide has been rendering for over 75 minutes and is still going, on an intel core i7 running at 3.4-3.6Ghz. So does anyone have a better approach? Writing code to rendering polyhedrons manually will probably work, but I think it will be a tricky, complicated and time consuming thing to write... -- View this message in context: http://forum.openscad.org/Curved-bent-conical-tubing-tp20686.html Sent from the OpenSCAD mailing list archive at Nabble.com.
CA
Carsten Arnholm
Wed, Mar 1, 2017 10:23 PM

On 01. mars 2017 23:03, pieterbos wrote:

So does anyone have a better approach? Writing code to rendering polyhedrons
manually will probably work, but I think it will be a tricky, complicated
and time consuming thing to write...

Have you considered creating a 2d profile of one side of longitudinal
cross section and rotate_extrude that 360 degrees to create the conical
trombone shape? Then add the other parts as simpler tubes.

Carsten Arnholm

On 01. mars 2017 23:03, pieterbos wrote: > So does anyone have a better approach? Writing code to rendering polyhedrons > manually will probably work, but I think it will be a tricky, complicated > and time consuming thing to write... Have you considered creating a 2d profile of one side of longitudinal cross section and rotate_extrude that 360 degrees to create the conical trombone shape? Then add the other parts as simpler tubes. Carsten Arnholm
P
pieterbos
Wed, Mar 1, 2017 10:50 PM

I use rotate extrude with a longitudinal profile for the bell of the trombone
and it works great. Project is at https://github.com/pieterbos/PrintBone if
you're interested.

But the bell is straight, and this is not. So I don't see how I can create a
bent conical tube with rotate_extrude: I cannot scale with rotate_extrude so
working with something like the following pattern will not work:

rotate_extrude()
difference() {
circle(r=outside_radius);
circle(r=inside_radius);
}

And I cannot rotate with linear_extrude. I could easily make a twisted
conical tube with linear extrude, but that would be creating a rather funky
looking trombone :)

To show what the part should look like, because CSG preview does work:

http://forum.openscad.org/file/n20688/Screen_Shot_2017-03-01_at_23.png

of course with the tubes being hollow - that's a preview artifact.

--
View this message in context: http://forum.openscad.org/Curved-bent-conical-tubing-tp20686p20688.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

I use rotate extrude with a longitudinal profile for the bell of the trombone and it works great. Project is at https://github.com/pieterbos/PrintBone if you're interested. But the bell is straight, and this is not. So I don't see how I can create a bent conical tube with rotate_extrude: I cannot scale with rotate_extrude so working with something like the following pattern will not work: rotate_extrude() difference() { circle(r=outside_radius); circle(r=inside_radius); } And I cannot rotate with linear_extrude. I could easily make a twisted conical tube with linear extrude, but that would be creating a rather funky looking trombone :) To show what the part should look like, because CSG preview does work: <http://forum.openscad.org/file/n20688/Screen_Shot_2017-03-01_at_23.png> of course with the tubes being hollow - that's a preview artifact. -- View this message in context: http://forum.openscad.org/Curved-bent-conical-tubing-tp20686p20688.html Sent from the OpenSCAD mailing list archive at Nabble.com.
P
pieterbos
Wed, Mar 1, 2017 11:11 PM

Of course after a long search I figured out that I needed different search
terms in google, and I found this:

http://stackoverflow.com/questions/28842419/linear-rotational-extrude-at-the-same-time

skin.scad. of course - that's much faster and no errors! and if that doesn't
work someone already did the python script to create polyhedrons. Should
work just fine now :)

--
View this message in context: http://forum.openscad.org/Curved-bent-conical-tubing-tp20686p20689.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Of course after a long search I figured out that I needed different search terms in google, and I found this: http://stackoverflow.com/questions/28842419/linear-rotational-extrude-at-the-same-time skin.scad. of course - that's much faster and no errors! and if that doesn't work someone already did the python script to create polyhedrons. Should work just fine now :) -- View this message in context: http://forum.openscad.org/Curved-bent-conical-tubing-tp20686p20689.html Sent from the OpenSCAD mailing list archive at Nabble.com.
RP
Ronaldo Persiano
Wed, Mar 1, 2017 11:32 PM

That is the way. You may skin both interior and exterior surface in just
one skin polyhedron avoiding the difference operation. To do this, you only
need:

  1. concatenate the interior and exterior profiles in a list caring  that
    they go in opposed directions;

  2. concatenate the previous list with the first profile in the list, so
    repeating it;

  3. change skin.scad eliminating the two caps at the end:

    start_cap = [range([0:P-1])];
    end_cap = [range([PN-1 : -1 : P(N-1)])];

by changing them to void lists:

  start_cap = [];
  end_cap = [];

And that is all.

2017-03-01 20:11 GMT-03:00 pieterbos bos.pieter@gmail.com:

Of course after a long search I figured out that I needed different search
terms in google, and I found this:

http://stackoverflow.com/questions/28842419/linear-
rotational-extrude-at-the-same-time

skin.scad. of course - that's much faster and no errors! and if that
doesn't
work someone already did the python script to create polyhedrons. Should
work just fine now :)

That is the way. You may skin both interior and exterior surface in just one skin polyhedron avoiding the difference operation. To do this, you only need: 1) concatenate the interior and exterior profiles in a list caring that they go in opposed directions; 2) concatenate the previous list with the first profile in the list, so repeating it; 3) change skin.scad eliminating the two caps at the end: start_cap = [range([0:P-1])]; end_cap = [range([P*N-1 : -1 : P*(N-1)])]; by changing them to void lists: start_cap = []; end_cap = []; And that is all. 2017-03-01 20:11 GMT-03:00 pieterbos <bos.pieter@gmail.com>: > Of course after a long search I figured out that I needed different search > terms in google, and I found this: > > http://stackoverflow.com/questions/28842419/linear- > rotational-extrude-at-the-same-time > > skin.scad. of course - that's much faster and no errors! and if that > doesn't > work someone already did the python script to create polyhedrons. Should > work just fine now :) >
P
Parkinbot
Thu, Mar 2, 2017 9:21 AM

Sorry, I didn't read this post earlier. Your problem has a classical
solution: a general sweep() or skin(). Try this code piece to get a conical
tube:
http://forum.openscad.org/file/n20691/conic.png

use
<Naca_sweep.scad>
http://www.thingiverse.com/thing:1208001

outer = conicbow_traj();
inner = conicbow_traj(r=100, a1=180, a2 = 0, r1=18, r2=8, N=100);

sweep(concat(outer, inner), close = true);

function conicbow_traj(r=100, a1=0, a2 = 180, r1=10, r2=20, N=100) =
[for (i=[0:N-1]) let(R = r1+i*(r2-r1)/N) Rx_(a1+i*(a2-a1)/(N-1), Ty_(r,
circle_(R)))];

function circle_(r=10, N=30) =
[for (i=[0:N-1]) [rsin(i360/N), rcos(i360/N), 0]];

If you dig a bit deeper into http://www.thingiverse.com/thing:1208001 you
will find an interpolation scheme that lets you describe any curvature by
just defining a few "slices".

--
View this message in context: http://forum.openscad.org/Curved-bent-conical-tubing-tp20686p20691.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Sorry, I didn't read this post earlier. Your problem has a classical solution: a general sweep() or skin(). Try this code piece to get a conical tube: <http://forum.openscad.org/file/n20691/conic.png> > use > <Naca_sweep.scad> > http://www.thingiverse.com/thing:1208001 > > outer = conicbow_traj(); > inner = conicbow_traj(r=100, a1=180, a2 = 0, r1=18, r2=8, N=100); > > sweep(concat(outer, inner), close = true); > > function conicbow_traj(r=100, a1=0, a2 = 180, r1=10, r2=20, N=100) = > [for (i=[0:N-1]) let(R = r1+i*(r2-r1)/N) Rx_(a1+i*(a2-a1)/(N-1), Ty_(r, > circle_(R)))]; > > function circle_(r=10, N=30) = > [for (i=[0:N-1]) [r*sin(i*360/N), r*cos(i*360/N), 0]]; If you dig a bit deeper into http://www.thingiverse.com/thing:1208001 you will find an interpolation scheme that lets you describe any curvature by just defining a few "slices". -- View this message in context: http://forum.openscad.org/Curved-bent-conical-tubing-tp20686p20691.html Sent from the OpenSCAD mailing list archive at Nabble.com.
P
pieterbos
Thu, Mar 2, 2017 9:22 AM

Ronaldo wrote

That is the way. You may skin both interior and exterior surface in just
one skin polyhedron avoiding the difference operation. To do this, you
only
need:

  1. concatenate the interior and exterior profiles in a list caring  that
    they go in opposed directions;
  2. concatenate the previous list with the first profile in the list, so
    repeating it;
  3. change skin.scad eliminating the two caps at the end:

Exactly my toughts - not possible with sweep, easy with skin. I needed to
use a different circle that in shapes.scad, because it contained one point
too little.

At $fn=200, for both the circles and number of input shapes to skin, CGAL
rendering time is 7 seconds! :)

Also eliminating the caps was not needed, that produces hollow walls and I
want solid walls.

--
View this message in context: http://forum.openscad.org/Curved-bent-conical-tubing-tp20686p20692.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Ronaldo wrote > That is the way. You may skin both interior and exterior surface in just > one skin polyhedron avoiding the difference operation. To do this, you > only > need: > 1) concatenate the interior and exterior profiles in a list caring that > they go in opposed directions; > 2) concatenate the previous list with the first profile in the list, so > repeating it; > 3) change skin.scad eliminating the two caps at the end: Exactly my toughts - not possible with sweep, easy with skin. I needed to use a different circle that in shapes.scad, because it contained one point too little. At $fn=200, for both the circles and number of input shapes to skin, CGAL rendering time is 7 seconds! :) Also eliminating the caps was not needed, that produces hollow walls and I want solid walls. -- View this message in context: http://forum.openscad.org/Curved-bent-conical-tubing-tp20686p20692.html Sent from the OpenSCAD mailing list archive at Nabble.com.
P
pieterbos
Thu, Mar 2, 2017 9:27 AM

Except when I render the entire part and not just the bent tube, OpenSCAD
says this and doesn't render the bent conical tube:

Compiling design (CSG Tree generation)...
ECHO: "total bell height", -574.22
Rendering Polygon Mesh using CGAL...
ERROR: CGAL error in CGAL_Nef_polyhedron3(): CGAL ERROR: assertion
violation! Expr: e->incident_sface() != SFace_const_handle() File:
/Users/kintel/code/OpenSCAD/openscad/../libraries/install/include/CGAL/Nef_S2/SM_const_decorator.h
Line: 326

Might be possible to get rid of by using skin for the entire part, not just
the bow...

--
View this message in context: http://forum.openscad.org/Curved-bent-conical-tubing-tp20686p20693.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Except when I render the entire part and not just the bent tube, OpenSCAD says this and doesn't render the bent conical tube: Compiling design (CSG Tree generation)... ECHO: "total bell height", -574.22 Rendering Polygon Mesh using CGAL... ERROR: CGAL error in CGAL_Nef_polyhedron3(): CGAL ERROR: assertion violation! Expr: e->incident_sface() != SFace_const_handle() File: /Users/kintel/code/OpenSCAD/openscad/../libraries/install/include/CGAL/Nef_S2/SM_const_decorator.h Line: 326 Might be possible to get rid of by using skin for the entire part, not just the bow... -- View this message in context: http://forum.openscad.org/Curved-bent-conical-tubing-tp20686p20693.html Sent from the OpenSCAD mailing list archive at Nabble.com.
P
Parkinbot
Thu, Mar 2, 2017 12:23 PM

Try to view the skin with F12. If it gets purple, reverse the vertex order in
your circle.
pieterbos wrote

Except when I render the entire part and not just the bent tube, OpenSCAD
says this and doesn't render the bent conical tube:

--
View this message in context: http://forum.openscad.org/Curved-bent-conical-tubing-tp20686p20694.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Try to view the skin with F12. If it gets purple, reverse the vertex order in your circle. pieterbos wrote > Except when I render the entire part and not just the bent tube, OpenSCAD > says this and doesn't render the bent conical tube: -- View this message in context: http://forum.openscad.org/Curved-bent-conical-tubing-tp20686p20694.html Sent from the OpenSCAD mailing list archive at Nabble.com.
R
Ronaldo
Thu, Mar 2, 2017 1:21 PM

pieterbos wrote

Also eliminating the caps was not needed, that produces hollow walls and I
want solid walls.

If you keep the skin caps and repeat the first profile at end of the profile
list, skin.scad will produce a self-intersection that CGAL doesn't like.
This repetition makes the tube endless and no cap is needed.

That is what I got from a similar process:

http://forum.openscad.org/file/n20695/Bugle.png

I have defined a series of circles to define the shape by B-splines and have
used a shape drawing module similar to Parkinbot's sweep.scad. In essence,
the model is a polyhedron with both the interior and exterior surfaces where
these surfaces are spliced by repetition of the first profile at the end.
There is no caps.

To easy the task the interior surface is computed from the exterior one by
reducing by a fixed amount the exterior surface radiuses. The mouthpiece was
modeled the same way and unioned to the main shape.

--
View this message in context: http://forum.openscad.org/Curved-bent-conical-tubing-tp20686p20695.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

pieterbos wrote > Also eliminating the caps was not needed, that produces hollow walls and I > want solid walls. If you keep the skin caps and repeat the first profile at end of the profile list, skin.scad will produce a self-intersection that CGAL doesn't like. This repetition makes the tube endless and no cap is needed. That is what I got from a similar process: <http://forum.openscad.org/file/n20695/Bugle.png> I have defined a series of circles to define the shape by B-splines and have used a shape drawing module similar to Parkinbot's sweep.scad. In essence, the model is a polyhedron with both the interior and exterior surfaces where these surfaces are spliced by repetition of the first profile at the end. There is no caps. To easy the task the interior surface is computed from the exterior one by reducing by a fixed amount the exterior surface radiuses. The mouthpiece was modeled the same way and unioned to the main shape. -- View this message in context: http://forum.openscad.org/Curved-bent-conical-tubing-tp20686p20695.html Sent from the OpenSCAD mailing list archive at Nabble.com.