extruding 2-d shapes vs using 3-d shapes.

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

extruding 2-d shapes vs using 3-d shapes.

George Hartzell

I'm gaining OpenSCAD skills with the (initial) goal of designing
things to be lasercut.

My initial thought was that a hunk of acrylic would be an scad cube:

```scad
cube([w, height, thickness]);
```

Lasercut [1] and Scott Bezek's examples [2] seem to prefer extruding
2-D shapes, e.g. this bit from Scott's blog:

````openscad
linear_extrude(thickness, center=true) {
     difference() {
         square([40,80]);
         translate([10, 10]) {
             square([20, 60]);
         }
     }
}
```

Is there a technical (performance, numerical accuracy) or aesthetic
reason to prefer one approach over the other?

Thanks!

g.

[1]: https://github.com/bmsleight/lasercut/blob/master/lasercut.scad#L84
[2]: http://scottbezek.blogspot.com/2016/05/openscad-rendering-tricks-part-2-laser.html

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: extruding 2-d shapes vs using 3-d shapes.

MichaelPFrey
Am 05.02.2018 um 02:57 schrieb George Hartzell:
> I'm gaining OpenSCAD skills with the (initial) goal of designing
> things to be lasercut.
Isn´t laser cutting an essentially a 2D approach using formats like DXF
and SVG?
I honestly would use inkscape if I would be using laser cutting.

Sure, openscad can be used to create DXF and SVG, but it is not
OpenSCADs native format.

What openSCAD could be used for is to create a 3D model/illustration of
the final product, but writing openscad script that can be both produced
and be used in a render of the assembly is tricky.

> My initial thought was that a hunk of acrylic would be an scad cube:
>
> ```scad
> cube([w, height, thickness]);
> ```
this seems to be a very strange approach to me.
Commonly in CAD, one aims to design a part.
Manufacturing aspects like milling, printing or laser cutting are more
of a CAM concern.
Off course, the part has to be designed with the manufacturing in mind,
but still:
I would not start with a block of material to be cut, I would start with
designing the parts I need and then would arrange the parts I need for
the available stock (with some back and forwards to get a good usage of
the stock).
> Lasercut [1] and Scott Bezek's examples [2] seem to prefer extruding
> 2-D shapes, e.g. this bit from Scott's blog:
> ...
>
> Is there a technical (performance, numerical accuracy) or aesthetic
> reason to prefer one approach over the other?
Yes off course there is a technical reason.

Performance is much better in 2D. OpenSCAD simply does not have to worry
about one more axis.

You do not have to worry about fudging numbers (coinciding faces cause a
lot of issue, so when to want to create a hole in a 3D block, the
cylinder for the hole as to be ever so slightly longer then the plate is
thick to create a true hole)

An other reason would be, that OpenSCAD can export DXF/SVG from 2D
primitives.

When you start modeling in 3D you should be able to cut the model [3]
[4] and create a 2D shape that can be exported that way - but that comes
at some performance and accuracy penalties.
Again: Having to deal with 3D primitives is slower then dealing with 2D
primitives.
> Thanks!
You are welcome.

With kind regards,
Michael Frey

[3] https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/DXF_Export
[4] https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/3D_to_2D_Projection

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: extruding 2-d shapes vs using 3-d shapes.

Troberg
In reply to this post by George Hartzell
I work in 3D, because I need to get a feel for how it will all come together.

Then, to get the 2D for cutting, I use Projection to get 2D shapes which can
be exported.

It helps a lot if your code is neat and logically modularized, so each part
is it's own module. Then, it's trivial to just call that module, move the
part as needed, and project for cutting.

There might be a performance loss, but usually, it's not a problem for me
(unless there is a lot of text or minkowski involved).



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

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: extruding 2-d shapes vs using 3-d shapes.

George Hartzell
Troberg writes:
 > I work in 3D, because I need to get a feel for how it will all come together.
 >
 > Then, to get the 2D for cutting, I use Projection to get 2D shapes which can
 > be exported.

This seems to be the common approach, and the one that I'm following.
I'm comfortable modeling in 3D and projecting to 2D to get the cut
lines.  Scott's site [2] has some great thoughts and tools for doing
this.

I'm asking a different question, is there any technical or aesthetic
advantage to use one or the other of these approached to modeling a
6mm x 4mm slab of 3mm material (cube vs extruding a square)?

```scad
module use_a_cube() {
    cube([6, 4, 3]);
}

module use_extrude() {
    linear_extrude(3, center=true) square([6, 4]);
}

use_a_cube();
translate([7, 7, 0]) use_extrude();
```

I was surprised to discover that a couple of well-thought-out packages
([1], [2], linked also linked in the original query) use
`linear_extrude`.  `cube` seems more intuitive.

g.

[1]: http://scottbezek.blogspot.com/2016/05/openscad-rendering-tricks-part-2-laser.html
[2]: https://github.com/bmsleight/lasercut/blob/master/lasercut.scad#L84

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: extruding 2-d shapes vs using 3-d shapes.

doug.moen
Operations on 2D objects are a lot faster than operations on 3D objects. So if you do as much as you  can in 2D and then call linear_extrude(), it might be faster than doing everything in 3D.

On 5 February 2018 at 11:00, George Hartzell <[hidden email]> wrote:
Troberg writes:
 > I work in 3D, because I need to get a feel for how it will all come together.
 >
 > Then, to get the 2D for cutting, I use Projection to get 2D shapes which can
 > be exported.

This seems to be the common approach, and the one that I'm following.
I'm comfortable modeling in 3D and projecting to 2D to get the cut
lines.  Scott's site [2] has some great thoughts and tools for doing
this.

I'm asking a different question, is there any technical or aesthetic
advantage to use one or the other of these approached to modeling a
6mm x 4mm slab of 3mm material (cube vs extruding a square)?

```scad
module use_a_cube() {
    cube([6, 4, 3]);
}

module use_extrude() {
    linear_extrude(3, center=true) square([6, 4]);
}

use_a_cube();
translate([7, 7, 0]) use_extrude();
```

I was surprised to discover that a couple of well-thought-out packages
([1], [2], linked also linked in the original query) use
`linear_extrude`.  `cube` seems more intuitive.

g.

[1]: http://scottbezek.blogspot.com/2016/05/openscad-rendering-tricks-part-2-laser.html
[2]: https://github.com/bmsleight/lasercut/blob/master/lasercut.scad#L84

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: extruding 2-d shapes vs using 3-d shapes.

George Hartzell
In reply to this post by George Hartzell
George Hartzell writes:
 > [...]
 > I'm asking a different question, is there any technical or aesthetic
 > advantage to use one or the other of these approached to modeling a
 > 6mm x 4mm slab of 3mm material (cube vs extruding a square)?
 >

I think I just connected the dots to a big reason to work with in the
2D space: text is a 2d object and you can't mix it with 3d objects
like cubes....

g.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: extruding 2-d shapes vs using 3-d shapes.

mbugert
In reply to this post by George Hartzell
George Hartzell wrote

> Troberg writes:
>  > I work in 3D, because I need to get a feel for how it will all come
> together.
>  >
>  > Then, to get the 2D for cutting, I use Projection to get 2D shapes
> which can
>  > be exported.
>
> This seems to be the common approach, and the one that I'm following.
> I'm comfortable modeling in 3D and projecting to 2D to get the cut
> lines.  Scott's site [2] has some great thoughts and tools for doing
> this.


If you want to save yourself from manually moving parts in 2D (which becomes
quite painful with parameterized models), you could consider using laserscad
[1]. It automates the 3D -> 2D process and can handle engravings nicely.
Shameless plug by the way. ;)

[1] https://github.com/mbugert/laserscad



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

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: extruding 2-d shapes vs using 3-d shapes.

Troberg
In reply to this post by George Hartzell
> text is a 2d object and you can't mix it with 3d objects
like cubes....

But text can be extruded, and then you can mix it with 3D objects. I use
that a lot.



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

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: extruding 2-d shapes vs using 3-d shapes.

George Hartzell
Troberg writes:
 > > text is a 2d object and you can't mix it with 3d objects
 > like cubes....
 >
 > But text can be extruded, and then you can mix it with 3D objects. I use
 > that a lot.

So, one can work with 2-D objects and then extrude them, or work with
3-D objects (including extruded text).

There was one reply that suggested that 2-D operations would be
faster.

Otherwise it seems like it's personal preference whether to work with
extruded 2-D shapes vs. their pre-defined 3-D counterparts.

Fair summary?

g.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org