New forum member, extruding along path

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

Re: New forum member, extruding along path

adrianv
gasstationwithoutpumps wrote
> Here is a simplified example of problems with rounded_sweep with a
> high-resolution path.  It comes in 2 files: one modified from the output
> of
> the inkscape plugin, the other a generic cookie-cutter module that can be
> used with any suitably edited inkscape output.

In the code you note that the blue object succeeds and the red one fails,
where the only difference is a smoothness parameter.  I investigated the
situation.  

For the red object, you have a profile that makes a step of 1.6e-4, that is
0.16 microns if your units are mm.  The offset() function has a "zero" test
that uses a fuzz value of 1e-4.  In general, my understanding is that
details finer than about 1e-4 cannot be handled properly, and that locations
are rounded to a grid of about this size.  

I understand that this situation arises naturally as a result of your bezier
curves and wasn't something you intended to do.  I can change the 1e-4 to
1e-6 and then the red object works.  Another way to make it work is to just
scale it up.  I did a factor of 100 and it worked fine.   This doesn't
really address the underlying problem, though.  You don't actually need a
0.16 micron step there.  Maybe the code should round it to zero?  I'm not
sure.  





--
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: New forum member, extruding along path

adrianv
In reply to this post by cgriffith
Revar has posted an update to BOSL2 with some changes I made that should work
for gasstationwithoutputs' case out of the box.  I quantize the path and I
adjusted the tests so they should work properly with the quantized path.  It
works on the posted test case.  

Regarding documentation and clarity, I have been thinking of renaming the
module from rounded_sweep to offset_sweep.  I'm wondering, cgriffith, if
that name is more clear to you and might be more easily understood, since
what it really does is a sweep operation from a sequence of offsets.
Rounding is only one application, so I thought that "rounded" might prevent
a user from recognizing the full applicability, as perhaps happened in this
case.  


cgriffith wrote

> @gasstationwithoutpumps
>
> I am glad to hear you got a working solution, but I would still like to
> know
> why that particular path presents problems when used with rounded_sweep.
> Maybe someone closer to that algorithm can explain
>
> @adrianv
>
> You had asked a very important question that I have been trying to find a
> good way to answer.  Let me first say that the documentation for BOSL and
> BOSL2 are the best I have seen; examples and pics of results are so
> helpful.
> I really appreciate the hard work you have put in.  I can't say what I
> would
> change because I feel it is my own inability to comprehend some of the
> content or my own lack of imagination to see how something could be used,
> not a fault of the documentation.  Seriously, thank you so much for your
> valued work.
>
>
>
>
> --
> Sent from: http://forum.openscad.org/
>
> _______________________________________________
> OpenSCAD mailing list

> Discuss@.openscad

> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org





--
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: New forum member, extruding along path

cgriffith
yes, offset_sweep is more descriptive.  Thank you again for your hard work on
a very nice set of documentation.



--
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: New forum member, extruding along path

gasstationwithoutpumps
In reply to this post by adrianv
adrianv wrote

> Revar has posted an update to BOSL2 with some changes I made that should
> work
> for gasstationwithoutputs' case out of the box.  I quantize the path and I
> adjusted the tests so they should work properly with the quantized path.
> It
> works on the posted test case.  
>
> Regarding documentation and clarity, I have been thinking of renaming the
> module from rounded_sweep to offset_sweep.  I'm wondering, cgriffith, if
> that name is more clear to you and might be more easily understood, since
> what it really does is a sweep operation from a sequence of offsets.
> Rounding is only one application, so I thought that "rounded" might
> prevent
> a user from recognizing the full applicability, as perhaps happened in
> this
> case.  

This was exciting news, so  I tried out the code—indeed the small example I
had posted ran just fine!
Unfortunately, when I tried the full version of the cookie cutter, I got an
assertion failure:
CGAL error in CGAL_Nef_polyhedron3() … e->incident_sface() !=
SFace_const_handle() … SM_const_decorator.h Line:330
after about half an hour.

I've no idea what that assertion failure means.  There were no problems with
the preview (other than it taking 6 minutes to run), so I'm not sure where
to look for problems.  I could comment out parts of the code to try to do
binary search to find the problematic section, but with the very slow
processing of OpenSCAD, I'm not sure I have the patience.

Incidentally, why does the Console window (on macos) not allow copying?  I
often want to copy numbers that I've echoed to the console, or (as here)
want to record an error message accurately.




-----
gasstationwithoutpumps.wordpress.com
www.thingiverse.com/gasstationwithoutpumps/things
--
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: New forum member, extruding along path

cgriffith
I am able to copy console content.  I simply highlight what I want,
right-click, select copy from pop-up menu.

regarding your path, I believe you need to pay close attention to the number
and closeness of the bezier points.  As noted earlier in this thread, your
particular path has lots of unecessary points.  This leads to degredation of
performance and might be causing issue for offset_sweep.



--
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: New forum member, extruding along path

adrianv
In reply to this post by gasstationwithoutpumps
gasstationwithoutpumps wrote

> This was exciting news, so  I tried out the code—indeed the small example
> I
> had posted ran just fine!
> Unfortunately, when I tried the full version of the cookie cutter, I got
> an
> assertion failure:
> CGAL error in CGAL_Nef_polyhedron3() … e->incident_sface() !=
> SFace_const_handle() … SM_const_decorator.h Line:330
> after about half an hour.
>
> I've no idea what that assertion failure means.  There were no problems
> with
> the preview (other than it taking 6 minutes to run), so I'm not sure where
> to look for problems.

I do think that you would benefit from trying to simplify all of your
profiles.  You don't need to define cookie cutters with submicron resolution
like your first example does.  Are you using a super high resolution SLS
printer?  Because that's the only reason you'd benefit from resolution even
approaching (by which I mean 100-1000 times coarser than) what you're
including in your model.  I would suggest that the beziers should be sampled
not more than every 0.1mm, for example.  And as you've seen, using the
sampling that you are using makes things slow.  

My first question is whether you can process your model with your
"smoothness" parameter smaller.  Does it only fail when you increase that
parameter?  (And why did you want it so large anyway?) Another thing you
might try would be quantizing all of your inputs to 1/1024.  OpenSCAD
apparently does this internally---it cannot represent geometry finer than
that---and this could create problems with polyhedron generation if it leads
to degenerate faces.   So try wrapping all of your data vectors with
quant(point_list, 1/1024).  

In regards to the meaning of the error message, weird error messages like
that that arise when constructing a polyhedron mean that the polyhedron is
somehow invalid.  It either intersects itself or has reversed or invalid
faces.  I would be willing to take a look at your full code and try to see
what the cause of the problem is and to make sure it's not a bug in
rounded_sweep().   You can attach files to your reply rather than including
it inline in your message.  


>  I could comment out parts of the code to try to do
> binary search to find the problematic section, but with the very slow
> processing of OpenSCAD, I'm not sure I have the patience.

This strategy will probably not work.  Presumably rounded_sweep() is
producing an invalid polyhedron.  The question is: why?   If you want a
divide-and-conquer strategy, this is how I tested your small example:  I
used a subset of your full profile.  I discovered I could process most of
the profile but that a certain part (with the 0.16 micron step) was causing
the failure.   If you can decrease your point density so the run time is not
so slow---and that doesn't fix the problem---then this testing strategy
might be tolerable.  




--
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: New forum member, extruding along path

gasstationwithoutpumps
In reply to this post by cgriffith
cgriffith wrote
> I am able to copy console content.  I simply highlight what I want,
> right-click, select copy from pop-up menu.

That works and it shows the command-C shortcut, but the shortcut doesn't
work.  How should I report this minor bug?


cgriffith wrote
> regarding your path, I believe you need to pay close attention to the
> number
> and closeness of the bezier points.  As noted earlier in this thread, your
> particular path has lots of unnecessary points.  This leads to degradation
> of
> performance and might be causing issue for offset_sweep.

I am generating the Bezier path from the Inkscape plugin, and inserting
points on each segment of the Bezier path uniformly (same number of points
on each segment).  Unfortunately, this results in some points being very
close together and some being very far apart, because the segments produced
by Inkscape are of very different lengths.   I could try writing a
"simplify"  routine that thins out points that are too close together, but
coming up with good criteria for that is difficult.  (I already use
simplify_2dpath, but that is not enough.)




-----
gasstationwithoutpumps.wordpress.com
www.thingiverse.com/gasstationwithoutpumps/things
--
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: New forum member, extruding along path

gasstationwithoutpumps
In reply to this post by adrianv
adrianv wrote

>
> I do think that you would benefit from trying to simplify all of your
> profiles.  You don't need to define cookie cutters with submicron
> resolution
> like your first example does.  Are you using a super high resolution SLS
> printer?  Because that's the only reason you'd benefit from resolution
> even
> approaching (by which I mean 100-1000 times coarser than) what you're
> including in your model.  I would suggest that the beziers should be
> sampled
> not more than every 0.1mm, for example.  And as you've seen, using the
> sampling that you are using makes things slow.  
>
> My first question is whether you can process your model with your
> "smoothness" parameter smaller.  Does it only fail when you increase that
> parameter?  (And why did you want it so large anyway?) Another thing you
> might try would be quantizing all of your inputs to 1/1024.  OpenSCAD
> apparently does this internally---it cannot represent geometry finer than
> that---and this could create problems with polyhedron generation if it
> leads
> to degenerate faces.   So try wrapping all of your data vectors with
> quant(point_list, 1/1024).  

I'll try that quantification—I had not seen that function before in
OpenSCAD.  Ah, I see it is defined in BOSL2/math.scad


I'll try reducing the "smoothness" parameter, but some of the curves are
rather low-poly with small values.  What I want is a way to get more or less
uniform sampling along the arc length adjustable from about 0.1–0.5mm,
despite the Bezier segments from Inkscape being so variable in length.




-----
gasstationwithoutpumps.wordpress.com
www.thingiverse.com/gasstationwithoutpumps/things
--
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: New forum member, extruding along path

gasstationwithoutpumps
The problem with the assertion failures is not from the complexity of the
curves—even if I used very angular curves, with only 5–10 straight line
segments, I still got assertion failures.

By noting which objects did not get rendered, I reduced the problem to two
objects, each of which renders separately, but when unioned, I get the
assertion failures.  I've tried translating the objects by small amounts,
which changes which assertion fails, but does not remove the assertion
failures.

I'll work on trying to create a small test case.

The profiles that are being used have fine resolution because they are being
created by the round_corners() function from a small number of
points—setting $fs larger to reduce the number of points on the profile sped
things up, but just led to getting the assertion failure sooner.



-----
gasstationwithoutpumps.wordpress.com
www.thingiverse.com/gasstationwithoutpumps/things
--
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: New forum member, extruding along path

gasstationwithoutpumps
In reply to this post by gasstationwithoutpumps
I have created a test case that causes the assertion failure with none of the
problems of close-together points in the definition.  The preview works
fine, but the rendering gets an assertion failure.

test-assertion.scad
<http://forum.openscad.org/file/t2612/test-assertion.scad>  



-----
gasstationwithoutpumps.wordpress.com
www.thingiverse.com/gasstationwithoutpumps/things
--
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: New forum member, extruding along path

MichaelAtOz
Administrator
In case others try this, just comment out the "use <shakespeare...&quot;
line.

Try

translate([0,-10,0]) // so they don't touch
#extrude_open(path1);
//#extrude_open(path2);
cube(1);

re assertion violations, just have a 'cube(1);' with your object will force
CGAL union.

Preview the above it points to some triangulation visual artefacts, on the
bottom, that may be a clue.
Looks likely there are holes.
Without the cube, path1 can be rendered and exported.
The STL shows this:
&lt;nabble_img src=&quot;Capture_sheakspear_holes.jpg&quot;
border=&quot;0&quot;/>

[looks like nabble images are broken again, on preview, I'll post anyway
JIC]



-----
Admin - email* me if you need anything, or if I've done something stupid...

* click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.

The TPP is no simple “trade agreement.”   Fight it! http://www.ourfairdeal.org/   time is running out!
--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Admin - email* me if you need anything,
or if I've done something stupid...
* click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.


The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!
Reply | Threaded
Open this post in threaded view
|

Re: New forum member, extruding along path

MichaelAtOz
Administrator

Here is that image

 

> -----Original Message-----

> From: Discuss [mailto:[hidden email]] On Behalf Of MichaelAtOz

> Sent: Tue, 3 Sep 2019 16:00

> To: [hidden email]

> Subject: Re: [OpenSCAD] New forum member, extruding along path

>

> In case others try this, just comment out the "use <shakespeare...&quot;

> line.

>

> Try

>

> translate([0,-10,0]) // so they don't touch

> #extrude_open(path1);

> //#extrude_open(path2);

> cube(1);

>

> re assertion violations, just have a 'cube(1);' with your object will force

> CGAL union.

>

> Preview the above it points to some triangulation visual artefacts, on the

> bottom, that may be a clue.

> Looks likely there are holes.

> Without the cube, path1 can be rendered and exported.

> The STL shows this:

> &lt;nabble_img src=&quot;Capture_sheakspear_holes.jpg&quot;

> border=&quot;0&quot;/>

>

> [looks like nabble images are broken again, on preview, I'll post anyway

> JIC]

>

>

>

> -----

> Admin - email* me if you need anything, or if I've done something stupid...

>

> * click on my MichaelAtOz label, there is a link to email me.

>

> Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent

> possible under law, I have waived all copyright and related or neighbouring rights to this work.

> Obviously inclusion of works of previous authors is not included in the above.

>

> The TPP is no simple “trade agreement.”   Fight it! http://www.ourfairdeal.org/   time is running

> out!

> --

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

>

> _______________________________________________

> OpenSCAD mailing list

> [hidden email]

> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


Virus-free. www.avg.com

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Admin - email* me if you need anything,
or if I've done something stupid...
* click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.


The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!
Reply | Threaded
Open this post in threaded view
|

Re: New forum member, extruding along path

MichaelAtOz
Administrator

This is it, the STL, cut in half.

You can see that internal geometry, almost certainly makes self-intersections.

 

Also not the green triangles to the left of the arrow, green means 'outside' face.

 


From: Discuss [mailto:[hidden email]] On Behalf Of OzAtMichael
Sent: Tue, 3 Sep 2019 16:45
To: 'OpenSCAD general discussion'
Subject: Re: [OpenSCAD] New forum member, extruding along path

 

Here is that image

 

> -----Original Message-----

> From: Discuss [mailto:[hidden email]] On Behalf Of MichaelAtOz

> Sent: Tue, 3 Sep 2019 16:00

> To: [hidden email]

> Subject: Re: [OpenSCAD] New forum member, extruding along path

>

> In case others try this, just comment out the "use <shakespeare...&quot;

> line.

>

> Try

>

> translate([0,-10,0]) // so they don't touch

> #extrude_open(path1);

> //#extrude_open(path2);

> cube(1);

>

> re assertion violations, just have a 'cube(1);' with your object will force

> CGAL union.

>

> Preview the above it points to some triangulation visual artefacts, on the

> bottom, that may be a clue.

> Looks likely there are holes.

> Without the cube, path1 can be rendered and exported.

> The STL shows this:

> &lt;nabble_img src=&quot;Capture_sheakspear_holes.jpg&quot;

> border=&quot;0&quot;/>

>

> [looks like nabble images are broken again, on preview, I'll post anyway

> JIC]

>

>

>

> -----

> Admin - email* me if you need anything, or if I've done something stupid...

>

> * click on my MichaelAtOz label, there is a link to email me.

>

> Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent

> possible under law, I have waived all copyright and related or neighbouring rights to this work.

> Obviously inclusion of works of previous authors is not included in the above.

>

> The TPP is no simple “trade agreement.”   Fight it! http://www.ourfairdeal.org/   time is running

> out!

> --

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

>

> _______________________________________________

> OpenSCAD mailing list

> [hidden email]

> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

 

Virus-free. www.avg.com


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Admin - email* me if you need anything,
or if I've done something stupid...
* click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.


The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!
Reply | Threaded
Open this post in threaded view
|

Re: New forum member, extruding along path

MichaelAtOz
Administrator
Note: Nabble appear to have fixed the recent problem with 'Insert Image' on
the forum.



-----
Admin - email* me if you need anything, or if I've done something stupid...

* click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.

The TPP is no simple “trade agreement.”   Fight it! http://www.ourfairdeal.org/   time is running out!
--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Admin - email* me if you need anything,
or if I've done something stupid...
* click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.


The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!
Reply | Threaded
Open this post in threaded view
|

Re: New forum member, extruding along path

adrianv
In reply to this post by gasstationwithoutpumps
Excellent!  You've narrowed the problem down quite well.  

First of all, let me clarify this matter about the assertion failures.  You
can make one invalid polyhedron and this doesn't cause the message.  But it
doesn't mean your model is good.  If you add a second object to the model,
you'll then get the message.   So if you replace the second object with a
cube, you still get the error.  

A second point: there is a function called path_cut() that you could use to
resample your profiles so that they have uniformly spaced samples.  It seems
like what is really desired is sampling that is proportional to the local
curvature.  But I'm not sure how that could be done robustly on an arbitrary
path.  It could in principle be done on beziers, since we can evaluate
curvature on those.  Note that all simplify_path() does is discard duplicate
points.  

Now, on to the main point.  In your example, you construct a shape which is
a sort of C shape and then you run rounded_sweep() on it.  The profile you
give to rounded sweep expands your input shape enough that the two ends of
the shape intersect.  This is not allowed!  No self intersection!   I'm
going to try to include an image showing what happens.  

Instead of looking at the 3d shape I'm plotting the sequence of offsets that
will give rise to the shape.  When the curve contacts the other arm of the
curve, crazy stuff happens in offset().  But even if it didn't, you'd still
get an invalid polyhedron.   Is your goal to have everything blend together
into a top layer with random holes in it in places?  It seems sort of odd.
But if you want a top like that you're going to have to add it separately.
You might, for example, take the convex hull of your 2d profile for your
entire cutter, expand it a bit with offset(), extrude it to the desired
thickness and union that onto your cutter.  

In the picture I'm going to try to attach, I've shown your base profile in
yellow, then the subsequent profiles in red, green and purple.  I omitted
the last profile because things have already failed at profile #3.  For this
example I turned check_valid off because the result is comprehensible.  With
check valid on, you get wild and crazy results that it's hard to make sense
of.  The function version of offset() that I wrote is not smart enough to do
something intelligent with this kind of situation (which would require
returning multiple separate paths for various internal holes that arise).  
Also the polyhedron faceting code wouldn't know what to do with multiple
separate paths.   It's your responsibility to avoid these self-intersection
situations.  

<http://forum.openscad.org/file/t2477/outlines.png>


gasstationwithoutpumps wrote
> I have created a test case that causes the assertion failure with none of
> the
> problems of close-together points in the definition.  The preview works
> fine, but the rendering gets an assertion failure.





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

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