discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Morphing irregular shape while extruding?

T
Terry
Thu, Jan 19, 2023 3:53 PM

Haven't done any printing for ages, and more than a bit rusty, so...

I have a garden 'blower' that I want to improvise for an unusual
purpose. I need to print a PLA add-on I can temporarily push inside its
open end. That end of the part must obviously roughly match the blower
tube's shape. Although not an OpenSCAD issue, any tips on the best way
to capture that closed curve would be welcome. The best two
I've come up with so far:

  1. Wrap some stiff wire tightly around the blower near its end. Or
    perhaps better, a long but thin strip of aluminium; slide that off and
    make an SVG.in Inkscape (when I've relearnt how to do that).

  2. Use the rough pencil trace I've made as the SVG basis. Then in
    OpenSCAD reduce its 'x' coordinates appropriately. Presumably the factor
    would be b/h estimated from the photo.

Precision won't be an issue as I'll glue some thin but flexible stuff to
the outside.

The more difficult aspect is that the other end of the print must be a
cylinder of about 2 inches (50 mm) in height and 5/8 inch (15 mm) inner
diameter. (I'll be attaching a hose or similar.) This would obviously be
trivial if the starting shape was circular, but what is the general
approach for extruding from an irregular shape to a circle?


While preparing this a simpler idea dawned, and it would take a fraction
of the time to prepare. A rectangular piece of plywood or similar
covering the entire end of the blower, secured by screws or velcro to
the adjacent plastic area. The 3d print (if an existing piece of tubing
cannot be found) would be a simple cylinder, friction fitted inside a
hole in the wood's centre.

But I'd still like to learn how to 'morph' from one 2D shape to another
please.

Image attached, or here:
https://www.dropbox.com/s/tcj3g1f0zd4n1j7/Two-plus.jpg?raw=1

Terry, UK

Haven't done any printing for ages, and more than a bit rusty, so... I have a garden 'blower' that I want to improvise for an unusual purpose. I need to print a PLA add-on I can temporarily push inside its open end. That end of the part must obviously roughly match the blower tube's shape. Although not an OpenSCAD issue, any tips on the best way to capture that closed curve would be welcome. The best two I've come up with so far: 1. Wrap some stiff wire tightly around the blower near its end. Or perhaps better, a long but thin strip of aluminium; slide that off and make an SVG.in Inkscape (when I've relearnt how to do that). 2. Use the rough pencil trace I've made as the SVG basis. Then in OpenSCAD reduce its 'x' coordinates appropriately. Presumably the factor would be b/h estimated from the photo. Precision won't be an issue as I'll glue some thin but flexible stuff to the outside. The more difficult aspect is that the other end of the print must be a cylinder of about 2 inches (50 mm) in height and 5/8 inch (15 mm) inner diameter. (I'll be attaching a hose or similar.) This would obviously be trivial if the starting shape was circular, but what is the general approach for extruding from an irregular shape to a circle? -------------------- While preparing this a simpler idea dawned, and it would take a fraction of the time to prepare. A rectangular piece of plywood or similar covering the entire end of the blower, secured by screws or velcro to the adjacent plastic area. The 3d print (if an existing piece of tubing cannot be found) would be a simple cylinder, friction fitted inside a hole in the wood's centre. But I'd still like to learn how to 'morph' from one 2D shape to another please. Image attached, or here: https://www.dropbox.com/s/tcj3g1f0zd4n1j7/Two-plus.jpg?raw=1 Terry, UK
F
fred
Thu, Jan 19, 2023 4:06 PM

I'm not going to say this is THE answer, but it might still work as desired. Your SVG tracing can be imported and extruded to a minimal height. A circle of the appropriate dimensions also created to a minimal height, then translated to the desired distance.
Hull() the pair twice, rescale the x/y for the second hull(), then difference them.
This idea stems from a web search for "OpenSCAD loft" which presented an Instructable that didn't really help, but twisted the alleged mind in this direction.

On Thursday, January 19, 2023 at 10:55:30 AM EST, Terry <terrypingm@gmail.com> wrote:  

Haven't done any printing for ages, and more than a bit rusty, so...

I have a garden 'blower' that I want to improvise for an unusual
purpose. I need to print a PLA add-on I can temporarily push inside its
open end. That end of the part must obviously roughly match the blower
tube's shape. Although not an OpenSCAD issue, any tips on the best way
to capture that closed curve would be welcome. The best two
I've come up with so far:

  1. Wrap some stiff wire tightly around the blower near its end. Or
    perhaps better, a long but thin strip of aluminium; slide that off and
    make an SVG.in Inkscape (when I've relearnt how to do that).

  2. Use the rough pencil trace I've made as the SVG basis. Then in
    OpenSCAD reduce its 'x' coordinates appropriately. Presumably the factor
    would be b/h estimated from the photo.

Precision won't be an issue as I'll glue some thin but flexible stuff to
the outside.

The more difficult aspect is that the other end of the print must be a
cylinder of about 2 inches (50 mm) in height and 5/8 inch (15 mm) inner
diameter. (I'll be attaching a hose or similar.) This would obviously be
trivial if the starting shape was circular, but what is the general
approach for extruding from an irregular shape to a circle?


While preparing this a simpler idea dawned, and it would take a fraction
of the time to prepare. A rectangular piece of plywood or similar
covering the entire end of the blower, secured by screws or velcro to
the adjacent plastic area. The 3d print (if an existing piece of tubing
cannot be found) would be a simple cylinder, friction fitted inside a
hole in the wood's centre.

But I'd still like to learn how to 'morph' from one 2D shape to another
please.

Image attached, or here:
https://www.dropbox.com/s/tcj3g1f0zd4n1j7/Two-plus.jpg?raw=1

Terry, UK


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

I'm not going to say this is THE answer, but it might still work as desired. Your SVG tracing can be imported and extruded to a minimal height. A circle of the appropriate dimensions also created to a minimal height, then translated to the desired distance. Hull() the pair twice, rescale the x/y for the second hull(), then difference them. This idea stems from a web search for "OpenSCAD loft" which presented an Instructable that didn't really help, but twisted the alleged mind in this direction. On Thursday, January 19, 2023 at 10:55:30 AM EST, Terry <terrypingm@gmail.com> wrote: Haven't done any printing for ages, and more than a bit rusty, so... I have a garden 'blower' that I want to improvise for an unusual purpose. I need to print a PLA add-on I can temporarily push inside its open end. That end of the part must obviously roughly match the blower tube's shape. Although not an OpenSCAD issue, any tips on the best way to capture that closed curve would be welcome. The best two I've come up with so far: 1. Wrap some stiff wire tightly around the blower near its end. Or perhaps better, a long but thin strip of aluminium; slide that off and make an SVG.in Inkscape (when I've relearnt how to do that). 2. Use the rough pencil trace I've made as the SVG basis. Then in OpenSCAD reduce its 'x' coordinates appropriately. Presumably the factor would be b/h estimated from the photo. Precision won't be an issue as I'll glue some thin but flexible stuff to the outside. The more difficult aspect is that the other end of the print must be a cylinder of about 2 inches (50 mm) in height and 5/8 inch (15 mm) inner diameter. (I'll be attaching a hose or similar.) This would obviously be trivial if the starting shape was circular, but what is the general approach for extruding from an irregular shape to a circle? -------------------- While preparing this a simpler idea dawned, and it would take a fraction of the time to prepare. A rectangular piece of plywood or similar covering the entire end of the blower, secured by screws or velcro to the adjacent plastic area. The 3d print (if an existing piece of tubing cannot be found) would be a simple cylinder, friction fitted inside a hole in the wood's centre. But I'd still like to learn how to 'morph' from one 2D shape to another please. Image attached, or here: https://www.dropbox.com/s/tcj3g1f0zd4n1j7/Two-plus.jpg?raw=1 Terry, UK _______________________________________________ OpenSCAD mailing list To unsubscribe send an email to discuss-leave@lists.openscad.org
RW
Rogier Wolff
Fri, Jan 20, 2023 12:02 PM

Hi,

I think we should generalize the "linear_extrude" module. Split it
into two parts.

For now it creates a surface between a bunch of 2D objects placed at
different heights. Currently it can do two (or more?) transformations
to the given 2D object at each height.

the first is
rotate (cur_height/total_height * rotation_angle)

and the second is a scale. Maybe there are more.

But somewhere down there there is now a "children ()".

If instead we'd pass a extrude_position=... parameter to the to be
instantiated children, those modules can do other (more generic)
morphing than just rotate and scale.

That'd make say extruding a pipe with a spline function as the
diameter way more elegant than calculating the points by hand and
calling polyhedron at the end.

Roger. 

On Thu, Jan 19, 2023 at 03:53:59PM +0000, Terry wrote:

Haven't done any printing for ages, and more than a bit rusty, so...

I have a garden 'blower' that I want to improvise for an unusual
purpose. I need to print a PLA add-on I can temporarily push inside its
open end. That end of the part must obviously roughly match the blower
tube's shape. Although not an OpenSCAD issue, any tips on the best way
to capture that closed curve would be welcome. The best two
I've come up with so far:

  1. Wrap some stiff wire tightly around the blower near its end. Or
    perhaps better, a long but thin strip of aluminium; slide that off and
    make an SVG.in Inkscape (when I've relearnt how to do that).

  2. Use the rough pencil trace I've made as the SVG basis. Then in
    OpenSCAD reduce its 'x' coordinates appropriately. Presumably the factor
    would be b/h estimated from the photo.

Precision won't be an issue as I'll glue some thin but flexible stuff to
the outside.

The more difficult aspect is that the other end of the print must be a
cylinder of about 2 inches (50 mm) in height and 5/8 inch (15 mm) inner
diameter. (I'll be attaching a hose or similar.) This would obviously be
trivial if the starting shape was circular, but what is the general
approach for extruding from an irregular shape to a circle?


While preparing this a simpler idea dawned, and it would take a fraction
of the time to prepare. A rectangular piece of plywood or similar
covering the entire end of the blower, secured by screws or velcro to
the adjacent plastic area. The 3d print (if an existing piece of tubing
cannot be found) would be a simple cylinder, friction fitted inside a
hole in the wood's centre.

But I'd still like to learn how to 'morph' from one 2D shape to another
please.

Image attached, or here:
https://www.dropbox.com/s/tcj3g1f0zd4n1j7/Two-plus.jpg?raw=1

Terry, UK


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

--
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 **
**    Delftechpark 11 2628 XJ  Delft, The Netherlands.  KVK: 27239233    **
f equals m times a. When your f is steady, and your m is going down
your a is going up.  -- Chris Hadfield about flying up the space shuttle.

Hi, I think we should generalize the "linear_extrude" module. Split it into two parts. For now it creates a surface between a bunch of 2D objects placed at different heights. Currently it can do two (or more?) transformations to the given 2D object at each height. the first is rotate (cur_height/total_height * rotation_angle) and the second is a scale. Maybe there are more. But somewhere down there there is now a "children ()". If instead we'd pass a extrude_position=... parameter to the to be instantiated children, those modules can do other (more generic) morphing than just rotate and scale. That'd make say extruding a pipe with a spline function as the diameter way more elegant than calculating the points by hand and calling polyhedron at the end. Roger. On Thu, Jan 19, 2023 at 03:53:59PM +0000, Terry wrote: > Haven't done any printing for ages, and more than a bit rusty, so... > > I have a garden 'blower' that I want to improvise for an unusual > purpose. I need to print a PLA add-on I can temporarily push inside its > open end. That end of the part must obviously roughly match the blower > tube's shape. Although not an OpenSCAD issue, any tips on the best way > to capture that closed curve would be welcome. The best two > I've come up with so far: > > 1. Wrap some stiff wire tightly around the blower near its end. Or > perhaps better, a long but thin strip of aluminium; slide that off and > make an SVG.in Inkscape (when I've relearnt how to do that). > > 2. Use the rough pencil trace I've made as the SVG basis. Then in > OpenSCAD reduce its 'x' coordinates appropriately. Presumably the factor > would be b/h estimated from the photo. > > Precision won't be an issue as I'll glue some thin but flexible stuff to > the outside. > > The more difficult aspect is that the other end of the print must be a > cylinder of about 2 inches (50 mm) in height and 5/8 inch (15 mm) inner > diameter. (I'll be attaching a hose or similar.) This would obviously be > trivial if the starting shape was circular, but what is the general > approach for extruding from an irregular shape to a circle? > > -------------------- > > While preparing this a simpler idea dawned, and it would take a fraction > of the time to prepare. A rectangular piece of plywood or similar > covering the entire end of the blower, secured by screws or velcro to > the adjacent plastic area. The 3d print (if an existing piece of tubing > cannot be found) would be a simple cylinder, friction fitted inside a > hole in the wood's centre. > > But I'd still like to learn how to 'morph' from one 2D shape to another > please. > > Image attached, or here: > https://www.dropbox.com/s/tcj3g1f0zd4n1j7/Two-plus.jpg?raw=1 > > Terry, UK > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org -- ** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 ** ** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 ** f equals m times a. When your f is steady, and your m is going down your a is going up. -- Chris Hadfield about flying up the space shuttle.
SL
Steve Lelievre
Fri, Jan 20, 2023 4:41 PM

Terry,

I had another thought - simplistic but I think it should be enough for
your needs:

Make a solid object by importing your SVG and using linear_extrude to
convert it into a cone (by setting the scale parameter to 0). Add a
cylinder to match the required inside radius of your hose end and tall
enough to protrude by the distance you need. Add a straight-sided
linear_extruded section at the bottom to make a connector for your
blower end.

Repeat to make a second object, but this time offset the SVG to make it
a bit bigger and also widen the cylinder to the required outer radius.

Take the difference of the two objects, second minus first, to produce a
hollow funnel.

The following sample code does the job. You might have to alter the
bottom outline depending on whether you want your blower to fit inside
or outside the funnel, and for the specific dimensions and connector
lengths you need (and of course, if the exact wall thickness is
important you would have to use minkowski  to form the outer shape.)

file = "footprint.svg";
$fn = 60;
difference() {
   union() {
      linear_extrude(100, scale = 0) offset(2) import(file);
      cylinder(100, r = 15 + 2);
      translate([0, 0, -10]) linear_extrude(10) offset(2) import(file);
   }
   union() {
      linear_extrude(100, scale = 0) import(file);
      cylinder(100, r = 15);
      translate([0, 0, -10])linear_extrude(10) import(file);
   }
}

And here's a screenshot using an arbitrary footprint.

Cheers,

Steve

On 2023-01-19 7:53 a.m., Terry wrote:

Haven't done any printing for ages, and more than a bit rusty, so...

I have a garden 'blower' that I want to improvise for an unusual
purpose. I need to print a PLA add-on I can temporarily push inside its
open end. That end of the part must obviously roughly match the blower
tube's shape. Although not an OpenSCAD issue, any tips on the best way
to capture that closed curve would be welcome. The best two
I've come up with so far:

  1. Wrap some stiff wire tightly around the blower near its end. Or
    perhaps better, a long but thin strip of aluminium; slide that off and
    make an SVG.in Inkscape (when I've relearnt how to do that).

  2. Use the rough pencil trace I've made as the SVG basis. Then in
    OpenSCAD reduce its 'x' coordinates appropriately. Presumably the factor
    would be b/h estimated from the photo.

Precision won't be an issue as I'll glue some thin but flexible stuff to
the outside.

The more difficult aspect is that the other end of the print must be a
cylinder of about 2 inches (50 mm) in height and 5/8 inch (15 mm) inner
diameter. (I'll be attaching a hose or similar.) This would obviously be
trivial if the starting shape was circular, but what is the general
approach for extruding from an irregular shape to a circle?


While preparing this a simpler idea dawned, and it would take a fraction
of the time to prepare. A rectangular piece of plywood or similar
covering the entire end of the blower, secured by screws or velcro to
the adjacent plastic area. The 3d print (if an existing piece of tubing
cannot be found) would be a simple cylinder, friction fitted inside a
hole in the wood's centre.

But I'd still like to learn how to 'morph' from one 2D shape to another
please.

Image attached, or here:
https://www.dropbox.com/s/tcj3g1f0zd4n1j7/Two-plus.jpg?raw=1

Terry, UK


OpenSCAD mailing list
To unsubscribe send an email todiscuss-leave@lists.openscad.org

Terry, I had another thought - simplistic but I think it should be enough for your needs: Make a solid object by importing your SVG and using linear_extrude to convert it into a cone (by setting the scale parameter to 0). Add a cylinder to match the required inside radius of your hose end and tall enough to protrude by the distance you need. Add a straight-sided linear_extruded section at the bottom to make a connector for your blower end. Repeat to make a second object, but this time offset the SVG to make it a bit bigger and also widen the cylinder to the required outer radius. Take the difference of the two objects, second minus first, to produce a hollow funnel. The following sample code does the job. You might have to alter the bottom outline depending on whether you want your blower to fit inside or outside the funnel, and for the specific dimensions and connector lengths you need (and of course, if the exact wall thickness is important you would have to use minkowski  to form the outer shape.) > file = "footprint.svg"; > $fn = 60; > difference() { >    union() { >       linear_extrude(100, scale = 0) offset(2) import(file); >       cylinder(100, r = 15 + 2); >       translate([0, 0, -10]) linear_extrude(10) offset(2) import(file); >    } >    union() { >       linear_extrude(100, scale = 0) import(file); >       cylinder(100, r = 15); >       translate([0, 0, -10])linear_extrude(10) import(file); >    } > } And here's a screenshot using an arbitrary footprint. Cheers, Steve On 2023-01-19 7:53 a.m., Terry wrote: > Haven't done any printing for ages, and more than a bit rusty, so... > > I have a garden 'blower' that I want to improvise for an unusual > purpose. I need to print a PLA add-on I can temporarily push inside its > open end. That end of the part must obviously roughly match the blower > tube's shape. Although not an OpenSCAD issue, any tips on the best way > to capture that closed curve would be welcome. The best two > I've come up with so far: > > 1. Wrap some stiff wire tightly around the blower near its end. Or > perhaps better, a long but thin strip of aluminium; slide that off and > make an SVG.in Inkscape (when I've relearnt how to do that). > > 2. Use the rough pencil trace I've made as the SVG basis. Then in > OpenSCAD reduce its 'x' coordinates appropriately. Presumably the factor > would be b/h estimated from the photo. > > Precision won't be an issue as I'll glue some thin but flexible stuff to > the outside. > > The more difficult aspect is that the other end of the print must be a > cylinder of about 2 inches (50 mm) in height and 5/8 inch (15 mm) inner > diameter. (I'll be attaching a hose or similar.) This would obviously be > trivial if the starting shape was circular, but what is the general > approach for extruding from an irregular shape to a circle? > > -------------------- > > While preparing this a simpler idea dawned, and it would take a fraction > of the time to prepare. A rectangular piece of plywood or similar > covering the entire end of the blower, secured by screws or velcro to > the adjacent plastic area. The 3d print (if an existing piece of tubing > cannot be found) would be a simple cylinder, friction fitted inside a > hole in the wood's centre. > > But I'd still like to learn how to 'morph' from one 2D shape to another > please. > > Image attached, or here: > https://www.dropbox.com/s/tcj3g1f0zd4n1j7/Two-plus.jpg?raw=1 > > Terry, UK > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email todiscuss-leave@lists.openscad.org
T
terrypingm@gmail.com
Fri, Jan 20, 2023 6:28 PM

Thanks Steve. But why the hollow ‘wedge’ extension? Without that, it looks like my original intention. Which was already somewhat OTT on reflection.

Anyway, learning exercise apart, for a task that will be rarely used I’m pretty sure I’ll go with the previously discussed crude approach!

--

Terry

On 20 Jan 2023, at 16:42, Steve Lelievre <steve.lelievre.canada@gmail.com> wrote:

 Terry,

I had another thought - simplistic but I think it should be enough for your needs:

Make a solid object by importing your SVG and using linear_extrude to convert it into a cone (by setting the scale parameter to 0). Add a cylinder to match the required inside radius of your hose end and tall enough to protrude by the distance you need. Add a straight-sided linear_extruded section at the bottom to make a connector for your blower end.

Repeat to make a second object, but this time offset the SVG to make it a bit bigger and also widen the cylinder to the required outer radius.

Take the difference of the two objects, second minus first, to produce a hollow funnel.

The following sample code does the job. You might have to alter the bottom outline depending on whether you want your blower to fit inside or outside the funnel, and for the specific dimensions and connector lengths you need (and of course, if the exact wall thickness is important you would have to use minkowski to form the outer shape.)

file = "footprint.svg";
$fn = 60;
difference() {
union() {
linear_extrude(100, scale = 0) offset(2) import(file);
cylinder(100, r = 15 + 2);
translate([0, 0, -10]) linear_extrude(10) offset(2) import(file);
}
union() {
linear_extrude(100, scale = 0) import(file);
cylinder(100, r = 15);
translate([0, 0, -10])linear_extrude(10) import(file);
}
}

And here's a screenshot using an arbitrary footprint.

<00AwiOdUczn1Et7F.png>

Cheers,

Steve

On 2023-01-19 7:53 a.m., Terry wrote:

<pre class="moz-quote-pre" wrap="">Haven't done any printing for ages, and more than a bit rusty, so...

I have a garden 'blower' that I want to improvise for an unusual
purpose. I need to print a PLA add-on I can temporarily push inside its
open end. That end of the part must obviously roughly match the blower
tube's shape. Although not an OpenSCAD issue, any tips on the best way
to capture that closed curve would be welcome. The best two
I've come up with so far:

1. Wrap some stiff wire tightly around the blower near its end. Or
perhaps better, a long but thin strip of aluminium; slide that off and
make an SVG.in Inkscape (when I've relearnt how to do that).

2. Use the rough pencil trace I've made as the SVG basis. Then in
OpenSCAD reduce its 'x' coordinates appropriately. Presumably the factor
would be b/h estimated from the photo. 

Precision won't be an issue as I'll glue some thin but flexible stuff to
the outside.

The more difficult aspect is that the other end of the print must be a
cylinder of about 2 inches (50 mm) in height and 5/8 inch (15 mm) inner
diameter. (I'll be attaching a hose or similar.) This would obviously be
trivial if the starting shape was circular, but what is the general
approach for extruding from an irregular shape to a circle?

--------------------

While preparing this a simpler idea dawned, and it would take a fraction
of the time to prepare. A rectangular piece of plywood or similar
covering the entire end of the blower, secured by screws or velcro to
the adjacent plastic area. The 3d print (if an existing piece of tubing
cannot be found) would be a simple cylinder, friction fitted inside a
hole in the wood's centre.

But I'd still like to learn how to 'morph' from one 2D shape to another
please.

Image attached, or here:
<a class="moz-txt-link-freetext" href="https://www.dropbox.com/s/tcj3g1f0zd4n1j7/Two-plus.jpg?raw=1">https://www.dropbox.com/s/tcj3g1f0zd4n1j7/Two-plus.jpg?raw=1</a>

Terry, UK
<pre class="moz-quote-pre" wrap="">_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to <a class="moz-txt-link-abbreviated" href="mailto:discuss-leave@lists.openscad.org">discuss-leave@lists.openscad.org</a>

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

SL
Steve Lelievre
Fri, Jan 20, 2023 6:33 PM

On 2023-01-20 10:28 a.m., terrypingm@gmail.com wrote:

Thanks Steve. But why the hollow ‘wedge’ extension? Without that, it
looks like my original intention.

It just means l wasn't quite clear about the shape you wanted.

Steve

On 2023-01-20 10:28 a.m., terrypingm@gmail.com wrote: > Thanks Steve. But why the hollow ‘wedge’ extension? Without that, it > looks like my original intention. It just means l wasn't quite clear about the shape you wanted. Steve
JB
Jordan Brown
Fri, Jan 20, 2023 9:07 PM

On 1/20/2023 4:02 AM, Rogier Wolff wrote:

If instead we'd pass a extrude_position=... parameter to the to be
instantiated children, those modules can do other (more generic)
morphing than just rotate and scale.

I believe the current linear extrude takes advantage of the fact that
each successive layer has the same vertices, and connects them. 
Connecting two arbitrary 2D shapes is a much harder problem.

I believe some of the libraries (like BOSL2) have more general sweep
functions that can tolerate changes in the shape, but I don't know what
the limitations are.

On 1/20/2023 4:02 AM, Rogier Wolff wrote: > If instead we'd pass a extrude_position=... parameter to the to be > instantiated children, those modules can do other (more generic) > morphing than just rotate and scale. I believe the current linear extrude takes advantage of the fact that each successive layer has the same vertices, and connects them.  Connecting two arbitrary 2D shapes is a much harder problem. I believe some of the libraries (like BOSL2) have more general sweep functions that can tolerate changes in the shape, but I don't know what the limitations are.
AM
Adrian Mariano
Fri, Jan 20, 2023 10:25 PM

Rogier, it sounds like you're asking for something like the sweep() module
that has been implemented in various libraries, going back to the original
list-comprehension-demos library.  But still not available directly in
OpenSCAD.

On Fri, Jan 20, 2023 at 7:03 AM Rogier Wolff R.E.Wolff@bitwizard.nl wrote:

Hi,

I think we should generalize the "linear_extrude" module. Split it
into two parts.

For now it creates a surface between a bunch of 2D objects placed at
different heights. Currently it can do two (or more?) transformations
to the given 2D object at each height.

the first is
rotate (cur_height/total_height * rotation_angle)

and the second is a scale. Maybe there are more.

But somewhere down there there is now a "children ()".

If instead we'd pass a extrude_position=... parameter to the to be
instantiated children, those modules can do other (more generic)
morphing than just rotate and scale.

That'd make say extruding a pipe with a spline function as the
diameter way more elegant than calculating the points by hand and
calling polyhedron at the end.

     Roger.

On Thu, Jan 19, 2023 at 03:53:59PM +0000, Terry wrote:

Haven't done any printing for ages, and more than a bit rusty, so...

I have a garden 'blower' that I want to improvise for an unusual
purpose. I need to print a PLA add-on I can temporarily push inside its
open end. That end of the part must obviously roughly match the blower
tube's shape. Although not an OpenSCAD issue, any tips on the best way
to capture that closed curve would be welcome. The best two
I've come up with so far:

  1. Wrap some stiff wire tightly around the blower near its end. Or
    perhaps better, a long but thin strip of aluminium; slide that off and
    make an SVG.in Inkscape (when I've relearnt how to do that).

  2. Use the rough pencil trace I've made as the SVG basis. Then in
    OpenSCAD reduce its 'x' coordinates appropriately. Presumably the factor
    would be b/h estimated from the photo.

Precision won't be an issue as I'll glue some thin but flexible stuff to
the outside.

The more difficult aspect is that the other end of the print must be a
cylinder of about 2 inches (50 mm) in height and 5/8 inch (15 mm) inner
diameter. (I'll be attaching a hose or similar.) This would obviously be
trivial if the starting shape was circular, but what is the general
approach for extruding from an irregular shape to a circle?


While preparing this a simpler idea dawned, and it would take a fraction
of the time to prepare. A rectangular piece of plywood or similar
covering the entire end of the blower, secured by screws or velcro to
the adjacent plastic area. The 3d print (if an existing piece of tubing
cannot be found) would be a simple cylinder, friction fitted inside a
hole in the wood's centre.

But I'd still like to learn how to 'morph' from one 2D shape to another
please.

Image attached, or here:
https://www.dropbox.com/s/tcj3g1f0zd4n1j7/Two-plus.jpg?raw=1

Terry, UK


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

--
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110
**
**    Delftechpark 11 2628 XJ  Delft, The Netherlands.  KVK: 27239233    **
f equals m times a. When your f is steady, and your m is going down
your a is going up.  -- Chris Hadfield about flying up the space shuttle.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Rogier, it sounds like you're asking for something like the sweep() module that has been implemented in various libraries, going back to the original list-comprehension-demos library. But still not available directly in OpenSCAD. On Fri, Jan 20, 2023 at 7:03 AM Rogier Wolff <R.E.Wolff@bitwizard.nl> wrote: > Hi, > > I think we should generalize the "linear_extrude" module. Split it > into two parts. > > For now it creates a surface between a bunch of 2D objects placed at > different heights. Currently it can do two (or more?) transformations > to the given 2D object at each height. > > the first is > rotate (cur_height/total_height * rotation_angle) > > and the second is a scale. Maybe there are more. > > But somewhere down there there is now a "children ()". > > If instead we'd pass a extrude_position=... parameter to the to be > instantiated children, those modules can do other (more generic) > morphing than just rotate and scale. > > That'd make say extruding a pipe with a spline function as the > diameter way more elegant than calculating the points by hand and > calling polyhedron at the end. > > Roger. > > > > On Thu, Jan 19, 2023 at 03:53:59PM +0000, Terry wrote: > > Haven't done any printing for ages, and more than a bit rusty, so... > > > > I have a garden 'blower' that I want to improvise for an unusual > > purpose. I need to print a PLA add-on I can temporarily push inside its > > open end. That end of the part must obviously roughly match the blower > > tube's shape. Although not an OpenSCAD issue, any tips on the best way > > to capture that closed curve would be welcome. The best two > > I've come up with so far: > > > > 1. Wrap some stiff wire tightly around the blower near its end. Or > > perhaps better, a long but thin strip of aluminium; slide that off and > > make an SVG.in Inkscape (when I've relearnt how to do that). > > > > 2. Use the rough pencil trace I've made as the SVG basis. Then in > > OpenSCAD reduce its 'x' coordinates appropriately. Presumably the factor > > would be b/h estimated from the photo. > > > > Precision won't be an issue as I'll glue some thin but flexible stuff to > > the outside. > > > > The more difficult aspect is that the other end of the print must be a > > cylinder of about 2 inches (50 mm) in height and 5/8 inch (15 mm) inner > > diameter. (I'll be attaching a hose or similar.) This would obviously be > > trivial if the starting shape was circular, but what is the general > > approach for extruding from an irregular shape to a circle? > > > > -------------------- > > > > While preparing this a simpler idea dawned, and it would take a fraction > > of the time to prepare. A rectangular piece of plywood or similar > > covering the entire end of the blower, secured by screws or velcro to > > the adjacent plastic area. The 3d print (if an existing piece of tubing > > cannot be found) would be a simple cylinder, friction fitted inside a > > hole in the wood's centre. > > > > But I'd still like to learn how to 'morph' from one 2D shape to another > > please. > > > > Image attached, or here: > > https://www.dropbox.com/s/tcj3g1f0zd4n1j7/Two-plus.jpg?raw=1 > > > > Terry, UK > > > > _______________________________________________ > > OpenSCAD mailing list > > To unsubscribe send an email to discuss-leave@lists.openscad.org > > > -- > ** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 > ** > ** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 ** > f equals m times a. When your f is steady, and your m is going down > your a is going up. -- Chris Hadfield about flying up the space shuttle. > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
AM
Adrian Mariano
Fri, Jan 20, 2023 10:35 PM

It sounded like Rogier was talking about applying a transformation to the
children, so that means you have a vertex mapping from cross section to
cross section.

Connecting two arbitrary 2d shapes is hard.  I have written code to do it
in BOSL2.

https://github.com/revarbat/BOSL2/wiki/skin.scad#functionmodule-skin

There are several methods provided that may work for different situations.
It's hard to say what exactly the limitations are.  You should be able to
connect any two convex shapes and get a valid and generally reasonable
result if you pick the right options.  If you go to concave shapes, it may
be difficult to get a good result in some cases unless you manually
establish the vertex mapping by adding extra points (possibly coincident).

On Fri, Jan 20, 2023 at 4:07 PM Jordan Brown openscad@jordan.maileater.net
wrote:

On 1/20/2023 4:02 AM, Rogier Wolff wrote:

If instead we'd pass a extrude_position=... parameter to the to be
instantiated children, those modules can do other (more generic)
morphing than just rotate and scale.

I believe the current linear extrude takes advantage of the fact that each
successive layer has the same vertices, and connects them.  Connecting two
arbitrary 2D shapes is a much harder problem.

I believe some of the libraries (like BOSL2) have more general sweep
functions that can tolerate changes in the shape, but I don't know what the
limitations are.


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

It sounded like Rogier was talking about applying a transformation to the children, so that means you have a vertex mapping from cross section to cross section. Connecting two arbitrary 2d shapes is hard. I have written code to do it in BOSL2. https://github.com/revarbat/BOSL2/wiki/skin.scad#functionmodule-skin There are several methods provided that may work for different situations. It's hard to say what exactly the limitations are. You should be able to connect any two convex shapes and get a valid and generally reasonable result if you pick the right options. If you go to concave shapes, it may be difficult to get a good result in some cases unless you manually establish the vertex mapping by adding extra points (possibly coincident). On Fri, Jan 20, 2023 at 4:07 PM Jordan Brown <openscad@jordan.maileater.net> wrote: > On 1/20/2023 4:02 AM, Rogier Wolff wrote: > > If instead we'd pass a extrude_position=... parameter to the to be > instantiated children, those modules can do other (more generic) > morphing than just rotate and scale. > > > I believe the current linear extrude takes advantage of the fact that each > successive layer has the same vertices, and connects them. Connecting two > arbitrary 2D shapes is a much harder problem. > > I believe some of the libraries (like BOSL2) have more general sweep > functions that can tolerate changes in the shape, but I don't know what the > limitations are. > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
RW
Rogier Wolff
Sat, Jan 21, 2023 2:30 PM

On Fri, Jan 20, 2023 at 01:07:12PM -0800, Jordan Brown wrote:

On 1/20/2023 4:02 AM, Rogier Wolff wrote:

If instead we'd pass a extrude_position=... parameter to the to be
instantiated children, those modules can do other (more generic)
morphing than just rotate and scale.

I believe the current linear extrude takes advantage of the fact that
each successive layer has the same vertices, and connects them. 
Connecting two arbitrary 2D shapes is a much harder problem.

In the meanwhile, I thought of that too, and devised a test.

linear_extrude (height=40, twist=10) circle (50);

When you increase the twist at some point the sides flip back.... So no
it is not using the corresponding points....

And then I tried this:

module obj ()
{
translate ([0,0,0])  circle (50);
translate ([50,0,0])  circle (5);
}

linear_extrude (height=40, twist=1800, slices = 10 ) obj ();

which clearly shows that it IS using corresponding points.

So I'm afraid you're right after all: it is assuming something about
corresponding points.

While I agree that it IS much harder, I think it is "doable" and it
would be beneficial to move in that direction. But of course I don't
have the time to put in the legwork. So I'm not "demanding" that this
be implemented. If someone finds it useful to generalize the linear
extrusion: I think it is a good idea and you have my support.

Roger. 

--
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 **
**    Delftechpark 11 2628 XJ  Delft, The Netherlands.  KVK: 27239233    **
f equals m times a. When your f is steady, and your m is going down
your a is going up.  -- Chris Hadfield about flying up the space shuttle.

On Fri, Jan 20, 2023 at 01:07:12PM -0800, Jordan Brown wrote: > On 1/20/2023 4:02 AM, Rogier Wolff wrote: > > If instead we'd pass a extrude_position=... parameter to the to be > > instantiated children, those modules can do other (more generic) > > morphing than just rotate and scale. > > I believe the current linear extrude takes advantage of the fact that > each successive layer has the same vertices, and connects them.  > Connecting two arbitrary 2D shapes is a much harder problem. In the meanwhile, I thought of that too, and devised a test. linear_extrude (height=40, twist=10) circle (50); When you increase the twist at some point the sides flip back.... So no it is not using the corresponding points.... And then I tried this: module obj () { translate ([0,0,0]) circle (50); translate ([50,0,0]) circle (5); } linear_extrude (height=40, twist=1800, slices = 10 ) obj (); which clearly shows that it IS using corresponding points. So I'm afraid you're right after all: it is assuming something about corresponding points. While I agree that it IS much harder, I think it is "doable" and it would be beneficial to move in that direction. But of course I don't have the time to put in the legwork. So I'm not "demanding" that this be implemented. If someone finds it useful to generalize the linear extrusion: I think it is a good idea and you have my support. Roger. -- ** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 ** ** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 ** f equals m times a. When your f is steady, and your m is going down your a is going up. -- Chris Hadfield about flying up the space shuttle.