discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Bending a flat 3D object.

B
Buk
Mon, May 7, 2018 12:34 PM

I'm looking to create an object like this:
http://forum.openscad.org/file/t2239/junk64.jpg

I can import a dxf of the 2D profile, and I can exdrude that to 3D, but I
cannot begin to see how to rotate or extrude or bend the tabs up?

I tried to visualise extruding the part to be think enough that I could
carve away chunks to leave the shape I want, but that just seems like a
silly way to approach the problem.

Thoughts, pointers?

--
Sent from: http://forum.openscad.org/

I'm looking to create an object like this: <http://forum.openscad.org/file/t2239/junk64.jpg> I can import a dxf of the 2D profile, and I can exdrude that to 3D, but I cannot begin to see how to rotate or extrude or bend the tabs up? I tried to visualise extruding the part to be think enough that I could carve away chunks to leave the shape I want, but that just seems like a silly way to approach the problem. Thoughts, pointers? -- Sent from: http://forum.openscad.org/
T
Troberg
Mon, May 7, 2018 1:19 PM

If it's going to be a sharp bend, I'd use some logic to cut it apart along
the green lines (make two objects which covers the bits to bend, then do an
intersection to get the bendy bits, and a difference to get the rest). Then,
just use rotate and union to put it together again, with bends in place.

I don't think there's an easier way, there is not "bend along this line"
command.

--
Sent from: http://forum.openscad.org/

If it's going to be a sharp bend, I'd use some logic to cut it apart along the green lines (make two objects which covers the bits to bend, then do an intersection to get the bendy bits, and a difference to get the rest). Then, just use rotate and union to put it together again, with bends in place. I don't think there's an easier way, there is not "bend along this line" command. -- Sent from: http://forum.openscad.org/
B
Buk
Mon, May 7, 2018 4:32 PM

Hm. I got this far pretty quickly:

$fa=0.1;
$fs=0.1;

intersection() {
translate( [-25.5,-37] )
import( "TA5[1-layer].dxf" );
polygon( [
[0,0],[0,5],[6,5],[6,-5],[0,0]
]);
};

(which of course you won't be able to see as you don't have the dxf, but...
after a zillion attempts to rotate that about the appropriate axis, I'm
giving up on OpenSCAD.

I read that is very powerful.

Unfortunately, it very powerful in the same way that the alphabet is very
powerful.

Trouble is, I'm not Shakespeare or David Hockney.

Thanks for your time, I'm off to see if I can find something more at my
level.

--
Sent from: http://forum.openscad.org/

Hm. I got this far pretty quickly: $fa=0.1; $fs=0.1; intersection() { translate( [-25.5,-37] ) import( "TA5[1-layer].dxf" ); polygon( [ [0,0],[0,5],[6,5],[6,-5],[0,0] ]); }; (which of course you won't be able to see as you don't have the dxf, but... after a zillion attempts to rotate that about the appropriate axis, I'm giving up on OpenSCAD. I read that is very powerful. Unfortunately, it very powerful in the same way that the alphabet is very powerful. Trouble is, I'm not Shakespeare or David Hockney. Thanks for your time, I'm off to see if I can find something more at my level. -- Sent from: http://forum.openscad.org/
P
Parkinbot
Mon, May 7, 2018 5:21 PM

Are you willing to share the dxf?

--
Sent from: http://forum.openscad.org/

Are you willing to share the dxf? -- Sent from: http://forum.openscad.org/
C
cbernhardt
Tue, May 8, 2018 10:57 AM

I played with your project a little bit and came up with the picture below.
I traced over your picture in AutoCad and created three separate DXF files,
one for the main section and one for each "TAB".  Then it is just a matter
of bringing them into OpenSCAD, extruding them and then rotating and
translating the TABs so they fit together.  Not a nice smooth bend, but that
could be done.
http://forum.openscad.org/file/t1309/bend.jpg

--
Sent from: http://forum.openscad.org/

I played with your project a little bit and came up with the picture below. I traced over your picture in AutoCad and created three separate DXF files, one for the main section and one for each "TAB". Then it is just a matter of bringing them into OpenSCAD, extruding them and then rotating and translating the TABs so they fit together. Not a nice smooth bend, but that could be done. <http://forum.openscad.org/file/t1309/bend.jpg> -- Sent from: http://forum.openscad.org/
FS
Felipe Sanches
Tue, May 8, 2018 11:49 AM

I think we all agree that openscad current lacks an expressive API for this
kind of work. I would love to be able to "bend sheets of metal" on openscad
as well, preferably using a piece of code that makes it obvious what's
going on rather than nasty hacks.

2018-05-08 10:57 GMT+00:00 cbernhardt charlie@carols62.com:

I played with your project a little bit and came up with the picture
below.
I traced over your picture in AutoCad and created three separate DXF files,
one for the main section and one for each "TAB".  Then it is just a matter
of bringing them into OpenSCAD, extruding them and then rotating and
translating the TABs so they fit together.  Not a nice smooth bend, but
that
could be done.
http://forum.openscad.org/file/t1309/bend.jpg

--
Sent from: http://forum.openscad.org/


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

I think we all agree that openscad current lacks an expressive API for this kind of work. I would love to be able to "bend sheets of metal" on openscad as well, preferably using a piece of code that makes it obvious what's going on rather than nasty hacks. 2018-05-08 10:57 GMT+00:00 cbernhardt <charlie@carols62.com>: > I played with your project a little bit and came up with the picture > below. > I traced over your picture in AutoCad and created three separate DXF files, > one for the main section and one for each "TAB". Then it is just a matter > of bringing them into OpenSCAD, extruding them and then rotating and > translating the TABs so they fit together. Not a nice smooth bend, but > that > could be done. > <http://forum.openscad.org/file/t1309/bend.jpg> > > > > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
M
MathLover
Tue, May 8, 2018 12:13 PM

Felipe Sanches wrote

I think we all agree that openscad current lacks an expressive API for
this
kind of work. I would love to be able to "bend sheets of metal" on
openscad
as well, preferably using a piece of code that makes it obvious what's
going on rather than nasty hacks.

I think you would need to work with actual "sheets" (2D geometry) and have
the bend command turn it into a bent 3D shape, where you would provide the
sheet thickness, bending line, bending angle, bending radius and (if you
really want to do it professionally) the distance to the neutral axis (which
is approximately at half the sheet thickness from the inside, but not
exactly.

My career as a draftsman started with a CAD program called CADAM, which had
this feature, but produced the results as a 2D view, as it was a "2.5D"
program.

Even so, you would probably have to cut the 2D shape up into pieces if you
want it to have more than one bend or if you want some parts along the
bending line to remain straight. You can the "union" these pieces together
after bending.

--
Sent from: http://forum.openscad.org/

Felipe Sanches wrote > I think we all agree that openscad current lacks an expressive API for > this > kind of work. I would love to be able to "bend sheets of metal" on > openscad > as well, preferably using a piece of code that makes it obvious what's > going on rather than nasty hacks. I think you would need to work with actual "sheets" (2D geometry) and have the bend command turn it into a bent 3D shape, where you would provide the sheet thickness, bending line, bending angle, bending radius and (if you really want to do it professionally) the distance to the neutral axis (which is approximately at half the sheet thickness from the inside, but not exactly. My career as a draftsman started with a CAD program called CADAM, which had this feature, but produced the results as a 2D view, as it was a "2.5D" program. Even so, you would probably have to cut the 2D shape up into pieces if you want it to have more than one bend or if you want some parts along the bending line to remain straight. You can the "union" these pieces together after bending. -- Sent from: http://forum.openscad.org/
DM
doug moen
Tue, May 8, 2018 4:35 PM

I've implemented bending in Curv as a non-affine coordinate transformation.
It isn't restricted to sheets.
You can bend cylinders, and that's quite useful for CAD.

OpenSCAD doesn't have non-affine transformations.
What makes this tricky is that you may need to add triangles.
If you think about how cylinders are represented in OpenSCAD, then
bending a cylinder along its length is impossible without adding triangles.

Once I implement STL import, you'll be able to import OpenSCAD models
into Curv, apply non-affine transformations like bend, then export them.
That's not a perfect solution, though, as you'd have to use an external
tool.

It would be better if there were an open source library for performing
non-affine transformations on triangle meshes, or at least bends,
which could be called by OpenSCAD. Maybe OpenCascade supports bends?

If OpenSCAD allowed you to query the triangle mesh of a shape, from within
the
language, then a bend operator could be written in OpenSCAD itself.

On 8 May 2018 at 08:13, MathLover mathlover@w-p.dds.nl wrote:

Felipe Sanches wrote

I think we all agree that openscad current lacks an expressive API for
this
kind of work. I would love to be able to "bend sheets of metal" on
openscad
as well, preferably using a piece of code that makes it obvious what's
going on rather than nasty hacks.

I think you would need to work with actual "sheets" (2D geometry) and have
the bend command turn it into a bent 3D shape, where you would provide the
sheet thickness, bending line, bending angle, bending radius and (if you
really want to do it professionally) the distance to the neutral axis
(which
is approximately at half the sheet thickness from the inside, but not
exactly.

My career as a draftsman started with a CAD program called CADAM, which had
this feature, but produced the results as a 2D view, as it was a "2.5D"
program.

Even so, you would probably have to cut the 2D shape up into pieces if you
want it to have more than one bend or if you want some parts along the
bending line to remain straight. You can the "union" these pieces together
after bending.

--
Sent from: http://forum.openscad.org/


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

I've implemented bending in Curv as a non-affine coordinate transformation. It isn't restricted to sheets. You can bend cylinders, and that's quite useful for CAD. OpenSCAD doesn't have non-affine transformations. What makes this tricky is that you may need to add triangles. If you think about how cylinders are represented in OpenSCAD, then bending a cylinder along its length is impossible without adding triangles. Once I implement STL import, you'll be able to import OpenSCAD models into Curv, apply non-affine transformations like bend, then export them. That's not a perfect solution, though, as you'd have to use an external tool. It would be better if there were an open source library for performing non-affine transformations on triangle meshes, or at least bends, which could be called by OpenSCAD. Maybe OpenCascade supports bends? If OpenSCAD allowed you to query the triangle mesh of a shape, from within the language, then a bend operator could be written in OpenSCAD itself. On 8 May 2018 at 08:13, MathLover <mathlover@w-p.dds.nl> wrote: > Felipe Sanches wrote > > I think we all agree that openscad current lacks an expressive API for > > this > > kind of work. I would love to be able to "bend sheets of metal" on > > openscad > > as well, preferably using a piece of code that makes it obvious what's > > going on rather than nasty hacks. > > I think you would need to work with actual "sheets" (2D geometry) and have > the bend command turn it into a bent 3D shape, where you would provide the > sheet thickness, bending line, bending angle, bending radius and (if you > really want to do it professionally) the distance to the neutral axis > (which > is approximately at half the sheet thickness from the inside, but not > exactly. > > My career as a draftsman started with a CAD program called CADAM, which had > this feature, but produced the results as a 2D view, as it was a "2.5D" > program. > > Even so, you would probably have to cut the 2D shape up into pieces if you > want it to have more than one bend or if you want some parts along the > bending line to remain straight. You can the "union" these pieces together > after bending. > > > > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
CA
Carsten Arnholm
Tue, May 8, 2018 8:18 PM

On 08. mai 2018 18:35, doug moen wrote:

Maybe OpenCascade supports bends?

It does not, it is a b-rep CAD model.

If OpenSCAD allowed you to query the triangle mesh of a shape, from
within the language, then a bend operator could be written in

OpenSCAD itself.

Yes, but to do it, a couple of things in addition are required

  1. a sufficiently dense triangle mesh. By default programs like OpenSCAD
    will not create meshes that are immediately suitable for such bending
    because there are usually too few triangles/vertices in the bend area.
    You often have to re-mesh the model to make it sufficiently dense.

  2. ability to transform the existing coordinates of a model.

As you cannot query or modify a model if is out of the question to do it
from within OpenSCAD. However, I have played with similar ideas in my
AngelCAD software, code example at
https://gist.github.com/arnholm/fadb3e6c7e38983643377569ca94d0b9

In this case the starting point is a straight pipe that could have been
made by OpenSCAD. The model is then re-meshed in another program to
create a much denser mesh. Finally the dense mesh pipe is imported and
"bent" 90 degrees by transforming the polyhedron coordinates in the bend
area.

Of course this particular model could have been created in OpenSCAD
using conventional methods, but it illustrates the general principle of
"bending" as was asked by the original poster.

Carsten Arnholm

On 08. mai 2018 18:35, doug moen wrote: > Maybe OpenCascade supports bends? It does not, it is a b-rep CAD model. > If OpenSCAD allowed you to query the triangle mesh of a shape, from > within the language, then a bend operator could be written in OpenSCAD itself. Yes, but to do it, a couple of things in addition are required 1) a sufficiently dense triangle mesh. By default programs like OpenSCAD will not create meshes that are immediately suitable for such bending because there are usually too few triangles/vertices in the bend area. You often have to re-mesh the model to make it sufficiently dense. 2) ability to transform the existing coordinates of a model. As you cannot query or modify a model if is out of the question to do it from within OpenSCAD. However, I have played with similar ideas in my AngelCAD software, code example at https://gist.github.com/arnholm/fadb3e6c7e38983643377569ca94d0b9 In this case the starting point is a straight pipe that could have been made by OpenSCAD. The model is then re-meshed in another program to create a much denser mesh. Finally the dense mesh pipe is imported and "bent" 90 degrees by transforming the polyhedron coordinates in the bend area. Of course this particular model could have been created in OpenSCAD using conventional methods, but it illustrates the general principle of "bending" as was asked by the original poster. Carsten Arnholm
P
Parkinbot
Tue, May 8, 2018 9:31 PM

Facing problems like this, we always end up in more or less the same feature
request. If there was a built-in import() function, we could write

mypolygon = import( "TA5[1-layer].dxf" );

and get a list of list of 2D-points in the case of a dxf. Then everything
can be handled in OpenSCAD more or less straight forward. Remeshing, mapping
into 3D, and bending extruding. In a more general approach we can write our
libs for discriminating positive and negative volumes, applying non-affine
transformations and much more.

--
Sent from: http://forum.openscad.org/

Facing problems like this, we always end up in more or less the same feature request. If there was a built-in import() *function*, we could write mypolygon = import( "TA5[1-layer].dxf" ); and get a list of list of 2D-points in the case of a dxf. Then everything can be handled in OpenSCAD more or less straight forward. Remeshing, mapping into 3D, and bending extruding. In a more general approach we can write our libs for discriminating positive and negative volumes, applying non-affine transformations and much more. -- Sent from: http://forum.openscad.org/