### odd shape import

JB
Jordan Brown
Thu, Jan 13, 2022 2:20 AM

On 1/12/2022 5:01 PM, Adrian Mariano wrote:

The strategy you propose, of sweeping a circle around the edge, is
less robust than using offset_sweep() and I think also less efficient.

I think that what you were suggesting didn't fully penetrate into my
head.  Sounds like it's really quite similar in concept, but you're
using purpose-built tools.

The real work and real challenge is in providing the offset() function.

Yes.  When I've done this sort of thing in my own models, the polygons
have been simple enough that I've effectively done the offset manually.

You can call it a personal quirk, but I hate looking at the moire
pattern surfaces that arise when you pack in lots of layers to make a
bad approximation scheme (like stair stepping) give tolerable results.

Oh, it's an ugly answer, no doubt.  But it works tolerably.

On 1/12/2022 5:01 PM, Adrian Mariano wrote: > The strategy you propose, of sweeping a circle around the edge, is > less robust than using offset_sweep() and I think also less efficient. I think that what you were suggesting didn't fully penetrate into my head.  Sounds like it's really quite similar in concept, but you're using purpose-built tools. > The real work and real challenge is in providing the offset() function. Yes.  When I've done this sort of thing in my own models, the polygons have been simple enough that I've effectively done the offset manually. > You can call it a personal quirk, but I hate looking at the moire > pattern surfaces that arise when you pack in lots of layers to make a > bad approximation scheme (like stair stepping) give tolerable results. Oh, it's an ugly answer, no doubt.  But it works tolerably.
JB
Jordan Brown
Thu, Jan 13, 2022 2:24 AM

On 1/12/2022 6:20 PM, Jordan Brown wrote:

Oh, [star stepping is] an ugly answer, no doubt.  But it works tolerably.

For 3-D printing, that is.

For other purposes, like visualization, animation, VR, et cetera... it's
awful.

On 1/12/2022 6:20 PM, Jordan Brown wrote: > Oh, [star stepping is] an ugly answer, no doubt.  But it works tolerably. For 3-D printing, that is. For other purposes, like visualization, animation, VR, et cetera... it's awful.
AM
Thu, Jan 13, 2022 2:52 AM

I actually think that the two approaches are conceptually different.
I mean, they are the same in that you're linking together things to
make a polyhedron, but that's not much of a similarity.  In the case
of offset_sweep you are making offsets of the original shape and
linking them together.  If you want a circular curve you have to
carefully pick your offsets so that they follow a circle.  In the
case of the path_sweep approach you are sweeping a circle around the
curve and then doing some unions.  You have to pick your sweep curve
correctly.  They are like duals of each other rather than equivalent
approaches.  One could argue that either approach is conceptually
reasonable, but because of the way OpenSCAD works, the offset approach
is more robust.

On Wed, Jan 12, 2022 at 9:20 PM Jordan Brown

On 1/12/2022 5:01 PM, Adrian Mariano wrote:

The strategy you propose, of sweeping a circle around the edge, is
less robust than using offset_sweep() and I think also less efficient.

I think that what you were suggesting didn't fully penetrate into my head.  Sounds like it's really quite similar in concept, but you're using purpose-built tools.

The real work and real challenge is in providing the offset() function.

Yes.  When I've done this sort of thing in my own models, the polygons have been simple enough that I've effectively done the offset manually.

You can call it a personal quirk, but I hate looking at the moire
pattern surfaces that arise when you pack in lots of layers to make a
bad approximation scheme (like stair stepping) give tolerable results.

Oh, it's an ugly answer, no doubt.  But it works tolerably.

AM
Thu, Jan 13, 2022 2:59 AM

using a library?  If so, which one?  There are some tutorials for
BOSL2, but the more advanced ones haven't been written yet.
behind a library like BOSL2.  How would you go about implementing
offset() or path_sweep()?    Or maybe it means techniques like the
stair-step method to solve the problem at hand, or the method Carsten
proposed for the dome---tricks to get results with native OpenSCAD.
Personally I think that videos are the worst possible way to learn
programming.  Absolutely terrible.  I would never use one unless there
was no alternative, nor will I ever make one.  So if you see value in
videos you may have to start making them yourself.  If you want to
learn to use BOSL2 I suggest consulting the tutorials that have been
written so far, and the documentation, which is reasonably good.  If
you want to learn the fundamentals---how to write your own
library---then you can read the BOSL2 source code.  Or maybe other

On Wed, Jan 12, 2022 at 9:17 PM Sanjeev Prabhakar
sprabhakar2006@gmail.com wrote:

I think someone with good advance understanding of openscad should make video tutorials with some test cases.
That will really help a lot of us learn faster.
The videos available seem to be quite old and not very helpful for some advance modeling purpose

On Thu, 13 Jan 2022, 06:32 Adrian Mariano, avm4@cornell.edu wrote:

The strategy you propose, of sweeping a circle around the edge, is
less robust than using offset_sweep() and I think also less efficient.
Note that offset_sweep() is basically a function that organizes calls
to offset() to make life easier.  The real work and real challenge is
in providing the offset() function.  But offset sweep is actually a
better behaved operation than path sweep.  It will almost always work.
With path_sweep, if P2 has high sampling rate or sharp turns you're
very likely to get a non-manifold result when sweeping a circle along
P2.  I actually wrote a limited path_sweep2d that avoids these
non-manifold issues by reinterpreting a path sweep as a set of offset
operations to exploit the increased robustness of offsetting.

You can call it a personal quirk, but I hate looking at the moire
pattern surfaces that arise when you pack in lots of layers to make a
bad approximation scheme (like stair stepping) give tolerable results.
I think it's hard to tell what those surfaces are actually doing.
(That matters less for a tiny roundover than in other contexts.)  I
agree, though, that it can work in practice when you go to print your
model.

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

J
jon
Thu, Jan 13, 2022 1:39 PM

I find the BOSL2 library to be comprehensive, but also complex. That
said, the number of examples provided is the key to my being able to
find some code and then tweak it for my purposes.  I recommend the BOSL2
library with enthusiasm.

On 1/12/2022 9:59 PM, Adrian Mariano wrote:

using a library?  If so, which one?  There are some tutorials for
BOSL2, but the more advanced ones haven't been written yet.
behind a library like BOSL2.  How would you go about implementing
offset() or path_sweep()?    Or maybe it means techniques like the
stair-step method to solve the problem at hand, or the method Carsten
proposed for the dome---tricks to get results with native OpenSCAD.
Personally I think that videos are the worst possible way to learn
programming.  Absolutely terrible.  I would never use one unless there
was no alternative, nor will I ever make one.  So if you see value in
videos you may have to start making them yourself.  If you want to
learn to use BOSL2 I suggest consulting the tutorials that have been
written so far, and the documentation, which is reasonably good.  If
you want to learn the fundamentals---how to write your own
library---then you can read the BOSL2 source code.  Or maybe other

D
dpa
Thu, Jan 13, 2022 2:09 PM

yes:

Am Do., 13. Jan. 2022 um 14:39 Uhr schrieb jon jon@jonbondy.com:

I find the BOSL2 library to be comprehensive, but also complex. That
said, the number of examples provided is the key to my being able to
find some code and then tweak it for my purposes.  I recommend the BOSL2
library with enthusiasm.

+1

yes: Am Do., 13. Jan. 2022 um 14:39 Uhr schrieb jon <jon@jonbondy.com>: > I find the BOSL2 library to be comprehensive, but also complex. That > said, the number of examples provided is the key to my being able to > find some code and then tweak it for my purposes. I recommend the BOSL2 > library with enthusiasm. > +1
TP
Torsten Paul
Thu, Jan 13, 2022 2:11 PM

If anyone feels very experimental, this:

o = render() import("oddShape.svg");
h = 1 * INCH;
t = os_circle(r = 1/4 * INCH);
translate(-o.center) offset_sweep(o.points, height=h, top=t);

ciao,
Torsten.

If anyone feels very experimental, this: include<BOSL2/std.scad> include<BOSL2/rounding.scad> o = render() import("oddShape.svg"); h = 1 * INCH; t = os_circle(r = 1/4 * INCH); translate(-o.center) offset_sweep(o.points, height=h, top=t); works with the build from https://github.com/openscad/openscad/pull/3956 - Linux: https://9933-1049088-gh.circle-artifacts.com/0/64-bit/OpenSCAD-2021.12.24.ai9933-_PR39562021.12.24.ai9933-x86_64.AppImage - Windows: https://9935-1049088-gh.circle-artifacts.com/0/64-bit/OpenSCAD-2021.12.24.ci9935-x86-64_PR3956.zip ciao, Torsten.
RD
Revar Desmera
Thu, Jan 13, 2022 6:28 PM

Paths from `render()`‽! That’d be wonderful! Would it return a list of paths like a Region?

-Revar

On Jan 13, 2022, at 6:12 AM, Torsten Paul Torsten.Paul@gmx.de wrote:

﻿If anyone feels very experimental, this:

o = render() import("oddShape.svg");
h = 1 * INCH;
t = os_circle(r = 1/4 * INCH);
translate(-o.center) offset_sweep(o.points, height=h, top=t);

ciao,
Torsten.

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

Paths from `render()`‽! That’d be wonderful! Would it return a list of paths like a Region? -Revar > On Jan 13, 2022, at 6:12 AM, Torsten Paul <Torsten.Paul@gmx.de> wrote: > > ﻿If anyone feels very experimental, this: > > > include<BOSL2/std.scad> > include<BOSL2/rounding.scad> > > o = render() import("oddShape.svg"); > h = 1 * INCH; > t = os_circle(r = 1/4 * INCH); > translate(-o.center) offset_sweep(o.points, height=h, top=t); > > > works with the build from https://github.com/openscad/openscad/pull/3956 > > - Linux: https://9933-1049088-gh.circle-artifacts.com/0/64-bit/OpenSCAD-2021.12.24.ai9933-_PR39562021.12.24.ai9933-x86_64.AppImage > - Windows: https://9935-1049088-gh.circle-artifacts.com/0/64-bit/OpenSCAD-2021.12.24.ci9935-x86-64_PR3956.zip > > ciao, > Torsten. > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org
RD
Revar Desmera
Thu, Jan 13, 2022 6:38 PM

Reading the PR notes, it looks like my answer is yes. Sweet!  This will open up so much user space power.

-Revar

On Jan 13, 2022, at 10:28 AM, Revar Desmera revarbat@gmail.com wrote:

﻿Paths from `render()`‽! That’d be wonderful! Would it return a list of paths like a Region?

-Revar

On Jan 13, 2022, at 6:12 AM, Torsten Paul Torsten.Paul@gmx.de wrote:

﻿If anyone feels very experimental, this:

o = render() import("oddShape.svg");
h = 1 * INCH;
t = os_circle(r = 1/4 * INCH);
translate(-o.center) offset_sweep(o.points, height=h, top=t);

ciao,
Torsten.

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

Reading the PR notes, it looks like my answer is yes. Sweet! This will open up so much user space power. -Revar > On Jan 13, 2022, at 10:28 AM, Revar Desmera <revarbat@gmail.com> wrote: > > ﻿Paths from `render()`‽! That’d be wonderful! Would it return a list of paths like a Region? > > -Revar > >> On Jan 13, 2022, at 6:12 AM, Torsten Paul <Torsten.Paul@gmx.de> wrote: >> >> ﻿If anyone feels very experimental, this: >> >> >> include<BOSL2/std.scad> >> include<BOSL2/rounding.scad> >> >> o = render() import("oddShape.svg"); >> h = 1 * INCH; >> t = os_circle(r = 1/4 * INCH); >> translate(-o.center) offset_sweep(o.points, height=h, top=t); >> >> >> works with the build from https://github.com/openscad/openscad/pull/3956 >> >> - Linux: https://9933-1049088-gh.circle-artifacts.com/0/64-bit/OpenSCAD-2021.12.24.ai9933-_PR39562021.12.24.ai9933-x86_64.AppImage >> - Windows: https://9935-1049088-gh.circle-artifacts.com/0/64-bit/OpenSCAD-2021.12.24.ci9935-x86-64_PR3956.zip >> >> ciao, >> Torsten. >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org
JW
Joe Weinpert
Thu, Jan 13, 2022 6:38 PM

Is there a way to generate a list of points from a 2D imported svg
shape that can be used in the above offset_sweep function?  In other words,
the shape is being imported, not generated.

Joe Weinpert

On Wed, Jan 12, 2022 at 6:18 PM Adrian Mariano avm4@cornell.edu wrote:

Personally I think the step procedure is pretty ugly.  If you are
trying to approximate a curve you need many steps, so it is also slow.
It works well only when the curve in convex, because in that case you
can use hull() to create sloped edges on the layers, and then the
result looks good.

BOSL2 is located here:

https://github.com/revarbat/BOSL2

And the specific function you need is this one:

By point list, yes, you need the (x,y) coordinates along the shapes
edge.  So your code would look like

shape = [[3,4],[10,10],...etc];  // Shape defined as list of (x,y)
coordinates, without repeating the first point.

offset_sweep(shape, height=1INCH, top=os_circle(r=1/4INCH));  //
Assume model is in metric but you want inches

On Wed, Jan 12, 2022 at 6:00 PM Joe Weinpert joe.weinpert@gmail.com
wrote:

Thanks.  The 'step' procedure is something I've been experimenting

with.  It is both good and bad.

Where can I find the BOSL2 library?

The 'point list' is what?  X/Y coordinates along the shape's edge?

On Wed, Jan 12, 2022, 5:51 PM Adrian Mariano avm4@cornell.edu wrote:

The only good way I know to do this is using offset_sweep() from BOSL2
(I actually wrote offset_sweep specifically to solve this problem of
SVG you will need to convert it somehow to a point list that you can
then embed into OpenSCAD.  The only fully general alternative I'm
aware of (that works on concave inputs) is to make a stair-step shape
by stacking a sequence of smaller and smaller layers.

On Wed, Jan 12, 2022 at 3:52 PM Joe Weinpert joe.weinpert@gmail.com

wrote:

I have many, many odd 2D shapes that will be imported over the next

few months.

I have no problem importing or extruding them.

However, I do have the need for the top edge to be rounded around the

whole shape as it is imported or extruded.  In other words, a rounded
chamfer around the top.

The attached example 2D shape is about 5" wide overall in real-time

and is to be extruded to 1" high.  What can be done to have this extrusion
contain a small, 1/4" radius chamfer around the top?

Any ideas?

Joe Weinpert

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