discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

New forum member, extruding along path

C
cgriffith
Fri, Aug 9, 2019 3:29 AM

rounded_sweep also works for me.

First let me say thank you so much Adrian.  I had no idea BOSL2 or
rounded_sweep even existed.  What I find kinda disappointing is that even
now that I know it exists, after reading documentation, I still don't think
I would have realized I could use it to solve my problem.

I can still use my same profile.  I convert my profile bezier to points and
use rounded_sweep.

So in conclusion, I have to convert both my cutter bezier and profile bezier
to coordinate points, then feed them into rounded_sweep.

Thanks again!

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

rounded_sweep also works for me. First let me say thank you so much Adrian. I had no idea BOSL2 or rounded_sweep even existed. What I find kinda disappointing is that even now that I know it exists, after reading documentation, I still don't think I would have realized I could use it to solve my problem. I can still use my same profile. I convert my profile bezier to points and use rounded_sweep. So in conclusion, I have to convert both my cutter bezier and profile bezier to coordinate points, then feed them into rounded_sweep. Thanks again! -- Sent from: http://forum.openscad.org/
A
adrianv
Fri, Aug 9, 2019 3:55 AM

Well, as it says at the top level, BOSL2 is in pre-alpha.  It's not stable
yet.  Changes are being made that break code, without any regard yet for
maintaining compatibility with previous BOSL2 versions.  So it hasn't been
strongly announced.

When you say that you wouldn't have realized that rounded_sweep could solve
your problem, I take it this means the documentation is inadequate?  How can
I improve the documentation in a way that would help you understand the
capabilities of rounded_sweep?  Maybe I should add the cookie cutter
example, but what else would help?  (Note: I wrote rounded_sweep, kind of a
culmination of an effort for producing rounded shapes...but it can do more
than just round things.)

cgriffith wrote

rounded_sweep also works for me.

First let me say thank you so much Adrian.  I had no idea BOSL2 or
rounded_sweep even existed.  What I find kinda disappointing is that even
now that I know it exists, after reading documentation, I still don't
think
I would have realized I could use it to solve my problem.

I can still use my same profile.  I convert my profile bezier to points
and
use rounded_sweep.

Well, as it says at the top level, BOSL2 is in pre-alpha. It's not stable yet. Changes are being made that break code, without any regard yet for maintaining compatibility with previous BOSL2 versions. So it hasn't been strongly announced. When you say that you wouldn't have realized that rounded_sweep could solve your problem, I take it this means the documentation is inadequate? How can I improve the documentation in a way that would help you understand the capabilities of rounded_sweep? Maybe I should add the cookie cutter example, but what else would help? (Note: I wrote rounded_sweep, kind of a culmination of an effort for producing rounded shapes...but it can do more than just round things.) cgriffith wrote > rounded_sweep also works for me. > > First let me say thank you so much Adrian. I had no idea BOSL2 or > rounded_sweep even existed. What I find kinda disappointing is that even > now that I know it exists, after reading documentation, I still don't > think > I would have realized I could use it to solve my problem. > > I can still use my same profile. I convert my profile bezier to points > and > use rounded_sweep. -- Sent from: http://forum.openscad.org/
G
gasstationwithoutpumps
Sat, Aug 10, 2019 5:13 PM

adrianv wrote

Well, as it says at the top level, BOSL2 is in pre-alpha.  It's not stable
yet.  Changes are being made that break code, without any regard yet for
maintaining compatibility with previous BOSL2 versions.  So it hasn't
been
strongly announced.

I've made some progress on my cookie cutter, but not quite gotten everything
to work.  I gave up on doing the outline as a difference between two
solids—I could not get CGAL to render the result, even when the preview
looked fine, despite all the usual tweaking to avoid identical coordinates.
Instead I do all lines by making 2 copies—one with a slight positive offset
and one with a slight negative offset, then make a closed curve from one
copy forward followed by the other reversed.  Doing rounded_sweep on this
closed curve comes very close to doing what I want.

I've been running into problems with rounded_sweep with tight concave
curves—sometimes getting a point that way out of range.  I think the problem
is that the offset curve is sometimes running backwards (when the offset is
larger than the radius of curvature), but I've not yet looked for a bug in
the code for offset.  I've been considering breaking up tight curves into
separate pieces, but have not yet worked out the details of that—I'm not
sure that it will be as good as fixing offset would be, and might be just as
difficult.


gasstationwithoutpumps.wordpress.com
www.thingiverse.com/gasstationwithoutpumps/things

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

adrianv wrote > Well, as it says at the top level, BOSL2 is in pre-alpha. It's not stable > yet. Changes are being made that break code, without any regard yet for > maintaining compatibility with previous BOSL2 versions. So it hasn't > been > strongly announced. I've made some progress on my cookie cutter, but not quite gotten everything to work. I gave up on doing the outline as a difference between two solids—I could not get CGAL to render the result, even when the preview looked fine, despite all the usual tweaking to avoid identical coordinates. Instead I do all lines by making 2 copies—one with a slight positive offset and one with a slight negative offset, then make a closed curve from one copy forward followed by the other reversed. Doing rounded_sweep on this closed curve comes very close to doing what I want. I've been running into problems with rounded_sweep with tight concave curves—sometimes getting a point that way out of range. I think the problem is that the offset curve is sometimes running backwards (when the offset is larger than the radius of curvature), but I've not yet looked for a bug in the code for offset. I've been considering breaking up tight curves into separate pieces, but have not yet worked out the details of that—I'm not sure that it will be as good as fixing offset would be, and might be just as difficult. ----- gasstationwithoutpumps.wordpress.com www.thingiverse.com/gasstationwithoutpumps/things -- Sent from: http://forum.openscad.org/
C
cgriffith
Sat, Aug 10, 2019 5:35 PM

@gasstationwithoutpumps Can you provide an example of "the outline"?  I see
on your blog your doing Shakespeare cookie cutters; can you provide the
points for that outline?

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

@gasstationwithoutpumps Can you provide an example of "the outline"? I see on your blog your doing Shakespeare cookie cutters; can you provide the points for that outline? -- Sent from: http://forum.openscad.org/
G
gasstationwithoutpumps
Sat, Aug 10, 2019 9:16 PM

cgriffith wrote

@gasstationwithoutpumps Can you provide an example of "the outline"?  I
see
on your blog your doing Shakespeare cookie cutters; can you provide the
points for that outline?

I've not decided yet whether to release the Shakespeare cookie cutter design
as open source.  The outer edge of the cutter is not causing any problems
anyway (once I switched over to handling it the same way that I handled the
interior lines).  The remaining problems are coming from the nose, which has
a tight turn in the curve.

I'm going to play around with some simpler curves to see if I can figure out
what triggers the problems, and I'll post here when I have either a simple
example of the problem or a fix.

If I don't release the Shakespeare cookie cutter, I'll release a simpler SVG
design to show how to use the inkscape plug-in, modify the output scad file,
and add rounded profiles.


gasstationwithoutpumps.wordpress.com
www.thingiverse.com/gasstationwithoutpumps/things

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

cgriffith wrote > @gasstationwithoutpumps Can you provide an example of "the outline"? I > see > on your blog your doing Shakespeare cookie cutters; can you provide the > points for that outline? I've not decided yet whether to release the Shakespeare cookie cutter design as open source. The outer edge of the cutter is not causing any problems anyway (once I switched over to handling it the same way that I handled the interior lines). The remaining problems are coming from the nose, which has a tight turn in the curve. I'm going to play around with some simpler curves to see if I can figure out what triggers the problems, and I'll post here when I have either a simple example of the problem or a fix. If I don't release the Shakespeare cookie cutter, I'll release a simpler SVG design to show how to use the inkscape plug-in, modify the output scad file, and add rounded profiles. ----- gasstationwithoutpumps.wordpress.com www.thingiverse.com/gasstationwithoutpumps/things -- Sent from: http://forum.openscad.org/
G
gasstationwithoutpumps
Sun, Aug 11, 2019 2:21 AM

I fixed the problem of bad points from the offsets by raising the quality to
quality=2.

I'm still running into problems with CGAL assertion errors from unions when
I have too many points in the paths. Everything looks ok in the previews,
and I can render each piece separately, but a union of even 2 overlapping
pieces failed when I had high-resolution paths, but worked fine for slightly
lower resolution paths.

Debugging is very slow, because the high-resolution runs often take over 40
minutes to run before reporting the assertion failure.


gasstationwithoutpumps.wordpress.com
www.thingiverse.com/gasstationwithoutpumps/things

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

I fixed the problem of bad points from the offsets by raising the quality to quality=2. I'm still running into problems with CGAL assertion errors from unions when I have too many points in the paths. Everything looks ok in the previews, and I can render each piece separately, but a union of even 2 overlapping pieces failed when I had high-resolution paths, but worked fine for slightly lower resolution paths. Debugging is very slow, because the high-resolution runs often take over 40 minutes to run before reporting the assertion failure. ----- gasstationwithoutpumps.wordpress.com www.thingiverse.com/gasstationwithoutpumps/things -- Sent from: http://forum.openscad.org/
G
gasstationwithoutpumps
Sun, Aug 11, 2019 3:05 AM

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.
//  simple stamp of a rounded shape, to demonstrate problems with //
rounded_sweep//  Using the "rounding" library from BOSL2.//// Kevin
Karplus// 2019 Aug 10use <BOSL2/std.scad> include <BOSL2/rounding.scad>
include <BOSL2/paths.scad> use <scad-utils/lists.scad>  // for reverse()use
$fs=0.1;    // fineness for steps (sets offset_maxstep also)    // also need
to set smoothness high in call to cookie_cuttercut_height=12;  // the
height of the cutteremboss_height=cut_height-2.5;  // the height of the
embossing linestop_round=0.5; // how far back from vertical the top (cutting
or embossing) edge is roudned.half_base_width = 1;  // half the thickness
of the cutting and embossing ribs    // at their basesspread=3.5; // how far
out does the base extend from the central line?thickness=2;    // the
thickness of the flat plate for the edge of the cutterfunction
outer_profile(top,height) =    [[0,0], [-top/2,0], [-top,top/2],
[-half_base_width,height-thickness-0.5],
[-(half_base_width+spread)/2,height-thickness],[-(spread-2tan(2)),height-thickness],[-spread,height],
[-(spread-1),height]]; profile1=outer_profile(top_round,cut_height);
profile3 = outer_profile(top_round,emboss_height);function rounding(top) =
[0,top/18,top/18,0.15,(spread-half_base_width)/50,(spread-half_base_width)/20,0.2,0];rounding1
= rounding(top_round);cut_profile = round_corners(profile1,
size=rounding1,closed=false); emboss_profile = round_corners(profile3,
size=rounding1,closed=false);  module test_profiles(){    color("red")
linear_extrude(20) polygon(concat(cut_profile,            reverse([ for
(pt=cut_profile) [-pt[0], pt[1]]  ])));    color("blue")
translate([0,0,-10])linear_extrude(10)polygon(concat(emboss_profile,
reverse([ for (pt=emboss_profile) [-pt[0], pt[1]]  ])));}//
test_profiles();module cut_outline(bezier_path, smoothness=4){    // split
the bezier segments of the closed path into two groups    mid_index =
floor(len(bezier_path)/2);    path1 = [for (i=[0:mid_index])
bezier_path[i]];    path2 = concat([for (i=[mid_index+1:len(bezier_path)-1])
bezier_path[i]],                [bezier_path[0]]);    //    path2 = [for
(i=[mid_index+1:len(bezier_path)-1]) bezier_path[i]];
color("red",0.5) extrude_open(path1, smoothness=smoothness,
profile=cut_profile, height=cut_height);    color("blue",0.5)
extrude_open(path2, smoothness=smoothness, profile=cut_profile,
height=cut_height);}module extrude_solid(bezier_path, smoothness=4,
profile=emboss_profile, height=emboss_height){      path =
bezier_coordinates(bezier_path,smoothness);    cutter =
offset(simplify2d_path(path), r=-top_round, closed=true);
rounded_sweep(cutter, height=height,     bottom=rs_custom(profile),
quality=4, offset_maxstep=$fs);        // alignment test (remove * to see
shape above solid)    * translate([0,0,height+1]) linear_extrude(height=5)
polygon(path);}module extrude_open(bezier_path, smoothness=4,
profile=emboss_profile, height=emboss_height){    path =
simplify2d_path(bezier_coordinates(bezier_path,smoothness));        //
alignment check//    echo("path=",path);
  color("red")
translate([0,0,cut_height+1]) linear_extrude(height=5) polygon(path);
// generate a polygon that wraps around the path.    // Open the path by
dropping the last point, if it is closed.    closed =
norm(path[0]-path[len(path)-1])< 0.001;    shortened_path = [for
(i=[0:len(path)-1-(closed? 1: 0)]) path[i]];    there =
offset(shortened_path,r=0.001,closed=false);    back =
reverse(offset(shortened_path,r=-0.001,closed=false));    round_trip =
simplify2d_path(offset(concat(there,back),0.001));//  check for generation
of polygon for //    echo("round_trip=", round_trip);*    color ("blue")
linear_extrude(height=5) polygon(round_trip);
rounded_sweep(round_trip, height=height,        bottom=rs_custom(profile),
quality=3, offset_maxstep=$fs);  }module
cookie_cutter(y_height=85,smoothness=6){    scale_factor=y_height/200;
mirror([1,0,0]) translate(scale_factor*[0,300,0])    {            * let
(path= outline())            {  color("green")
cut_outline(scale_factorpath, smoothness=smoothness);            }
echo("outline done");                        for (path= interior_closed())
{    color("pink") extrude_solid(scale_factor
path,
smoothness=smoothness);            }            echo("interior_closed
done");                        * for( path=interior_open())
{    color("orange")                    extrude_open(scale_factor*path,
smoothness=smoothness);            }            echo("interior_open done");
}}// this shape succeeds color("blue") cookie_cutter(smoothness=4);//
increasing the resolution of the path causes the shape to fail, // even in
preview. color("red") translate([30,0,0]) cookie_cutter(smoothness=5);
nostril.scad:
/** * This file contains a 2D vector representation of your InkScape file. *
You can set the global variable "$fn" to alter the precision of the curves.

  • You should use "linear_extrude" or "rotate_extrude" to give it some
    volume. /translate([0, 300]) { for(path_long=interior_closed())
    color("red") linear_extrude(4)  bezier_polygon(path_long);}function
    interior_closed() = [nostril()];function interior_open() = [];function
    outline() = []; // Path ID: function nostril()= [[[-33.543028, -315.11091],
    [-33.982110999999996, -314.57131], [-33.70377, -313.82149], [-33.465188,
    -313.25593]], [[-33.465188, -313.25593], [-32.820589, -311.72486],
    [-31.397714999999998, -310.62104], [-29.825916, -310.15808999999996]],
    [[-29.825916, -310.15808999999996], [-28.17155, -309.61960999999997],
    [-26.233151, -309.49926999999997], [-24.694009, -310.43373999999994]],
    [[-24.694009, -310.43373999999994], [-23.641358, -311.07556999999997],
    [-22.719163, -312.09065999999996], [-22.481952, -313.3294399999999]],
    [[-22.481952, -313.3294399999999], [-22.406302, -313.9976199999999],
    [-22.811264, -314.6410199999999], [-23.409109, -314.9280799999999]],
    [[-23.409109, -314.9280799999999], [-24.109048, -315.2958499999999],
    [-24.877931, -315.5286499999999], [-25.525149, -315.9960799999999]],
    [[-25.525149, -315.9960799999999], [-26.422848, -316.6023199999999],
    [-27.405955, -317.0753999999999], [-28.418993, -317.4535999999999]],
    [[-28.418993, -317.4535999999999], [-29.732035, -317.89772999999985],
    [-31.176294, -317.4297999999999], [-32.288394, -316.6914599999999]],
    [[-32.288394, -316.6914599999999], [-32.800359, -316.3218699999999],
    [-33.217493999999995, -315.8164799999999], [-33.499751999999994,
    -315.2546399999999]], [[-33.499751999999994, -315.2546399999999],
    [-33.50915199999999, -315.2063399999999], [-33.499247, -315.14634999999987],
    [-33.543032, -315.1109099999999]], [[-33.543032, -315.1109099999999],
    [-33.543032, -315.1109099999999], [-33.543028, -315.11091], [-33.543028,
    -315.11091]], [[-33.543028, -315.11091], [-33.543028, -315.11091],
    [-33.543028, -315.11091], [-33.543028, -315.11091]]];/
    * * Stripped down
    version of "bezier_v2.scad". * For full version, see:
    https://www.thingiverse.com/thing:2170645 /function BEZ03(u) = pow((1-u),
    3);function BEZ13(u) = 3
    u*(pow((1-u),2));function BEZ23(u) =
    3*(pow(u,2))*(1-u);function BEZ33(u) = pow(u,3);function bezier_2D_point(p0,
    p1, p2, p3, u) = [
    BEZ03(u)*p0[0]+BEZ13(u)*p1[0]+BEZ23(u)*p2[0]+BEZ33(u)*p3[0],
    BEZ03(u)*p0[1]+BEZ13(u)*p1[1]+BEZ23(u)*p2[1]+BEZ33(u)*p3[1]];function
    bezier_coordinates(points, steps) = [ for (c = points) for (step =
    [0:steps]) bezier_2D_point(c[0], c[1], c[2],c[3], step/steps)];module
    bezier_polygon(points) { steps = $fn <= 0 ? 30 : $fn;
    polygon(bezier_coordinates(points, steps));}

gasstationwithoutpumps.wordpress.com
www.thingiverse.com/gasstationwithoutpumps/things

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

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. // simple stamp of a rounded shape, to demonstrate problems with // rounded_sweep// Using the "rounding" library from BOSL2.//// Kevin Karplus// 2019 Aug 10use <BOSL2/std.scad> include <BOSL2/rounding.scad> include <BOSL2/paths.scad> use <scad-utils/lists.scad> // for reverse()use $fs=0.1; // fineness for steps (sets offset_maxstep also) // also need to set smoothness high in call to cookie_cuttercut_height=12; // the height of the cutteremboss_height=cut_height-2.5; // the height of the embossing linestop_round=0.5; // how far back from vertical the top (cutting or embossing) edge is roudned.half_base_width = 1; // half the thickness of the cutting and embossing ribs // at their basesspread=3.5; // how far out does the base extend from the central line?thickness=2; // the thickness of the flat plate for the edge of the cutterfunction outer_profile(top,height) = [[0,0], [-top/2,0], [-top,top/2], [-half_base_width,height-thickness-0.5], [-(half_base_width+spread)/2,height-thickness],[-(spread-2*tan(2)),height-thickness],[-spread,height], [-(spread-1),height]]; profile1=outer_profile(top_round,cut_height); profile3 = outer_profile(top_round,emboss_height);function rounding(top) = [0,top/18,top/18,0.15,(spread-half_base_width)/50,(spread-half_base_width)/20,0.2,0];rounding1 = rounding(top_round);cut_profile = round_corners(profile1, size=rounding1,closed=false); emboss_profile = round_corners(profile3, size=rounding1,closed=false); module test_profiles(){ color("red") linear_extrude(20) polygon(concat(cut_profile, reverse([ for (pt=cut_profile) [-pt[0], pt[1]] ]))); color("blue") translate([0,0,-10])linear_extrude(10)polygon(concat(emboss_profile, reverse([ for (pt=emboss_profile) [-pt[0], pt[1]] ])));}// test_profiles();module cut_outline(bezier_path, smoothness=4){ // split the bezier segments of the closed path into two groups mid_index = floor(len(bezier_path)/2); path1 = [for (i=[0:mid_index]) bezier_path[i]]; path2 = concat([for (i=[mid_index+1:len(bezier_path)-1]) bezier_path[i]], [bezier_path[0]]); // path2 = [for (i=[mid_index+1:len(bezier_path)-1]) bezier_path[i]]; color("red",0.5) extrude_open(path1, smoothness=smoothness, profile=cut_profile, height=cut_height); color("blue",0.5) extrude_open(path2, smoothness=smoothness, profile=cut_profile, height=cut_height);}module extrude_solid(bezier_path, smoothness=4, profile=emboss_profile, height=emboss_height){ path = bezier_coordinates(bezier_path,smoothness); cutter = offset(simplify2d_path(path), r=-top_round, closed=true); rounded_sweep(cutter, height=height, bottom=rs_custom(profile), quality=4, offset_maxstep=$fs); // alignment test (remove * to see shape above solid) * translate([0,0,height+1]) linear_extrude(height=5) polygon(path);}module extrude_open(bezier_path, smoothness=4, profile=emboss_profile, height=emboss_height){ path = simplify2d_path(bezier_coordinates(bezier_path,smoothness)); // alignment check// echo("path=",path);* color("red") translate([0,0,cut_height+1]) linear_extrude(height=5) polygon(path); // generate a polygon that wraps around the path. // Open the path by dropping the last point, if it is closed. closed = norm(path[0]-path[len(path)-1])< 0.001; shortened_path = [for (i=[0:len(path)-1-(closed? 1: 0)]) path[i]]; there = offset(shortened_path,r=0.001,closed=false); back = reverse(offset(shortened_path,r=-0.001,closed=false)); round_trip = simplify2d_path(offset(concat(there,back),0.001));// check for generation of polygon for // echo("round_trip=", round_trip);* color ("blue") linear_extrude(height=5) polygon(round_trip); rounded_sweep(round_trip, height=height, bottom=rs_custom(profile), quality=3, offset_maxstep=$fs); }module cookie_cutter(y_height=85,smoothness=6){ scale_factor=y_height/200; mirror([1,0,0]) translate(scale_factor*[0,300,0]) { * let (path= outline()) { color("green") cut_outline(scale_factor*path, smoothness=smoothness); } echo("outline done"); for (path= interior_closed()) { color("pink") extrude_solid(scale_factor*path, smoothness=smoothness); } echo("interior_closed done"); * for( path=interior_open()) { color("orange") extrude_open(scale_factor*path, smoothness=smoothness); } echo("interior_open done"); }}// this shape succeeds color("blue") cookie_cutter(smoothness=4);// increasing the resolution of the path causes the shape to fail, // even in preview. color("red") translate([30,0,0]) cookie_cutter(smoothness=5); nostril.scad: /** * This file contains a 2D vector representation of your InkScape file. * You can set the global variable "$fn" to alter the precision of the curves. * You should use "linear_extrude" or "rotate_extrude" to give it some volume. */translate([0, 300]) { for(path_long=interior_closed()) color("red") linear_extrude(4) bezier_polygon(path_long);}function interior_closed() = [nostril()];function interior_open() = [];function outline() = []; // Path ID: function nostril()= [[[-33.543028, -315.11091], [-33.982110999999996, -314.57131], [-33.70377, -313.82149], [-33.465188, -313.25593]], [[-33.465188, -313.25593], [-32.820589, -311.72486], [-31.397714999999998, -310.62104], [-29.825916, -310.15808999999996]], [[-29.825916, -310.15808999999996], [-28.17155, -309.61960999999997], [-26.233151, -309.49926999999997], [-24.694009, -310.43373999999994]], [[-24.694009, -310.43373999999994], [-23.641358, -311.07556999999997], [-22.719163, -312.09065999999996], [-22.481952, -313.3294399999999]], [[-22.481952, -313.3294399999999], [-22.406302, -313.9976199999999], [-22.811264, -314.6410199999999], [-23.409109, -314.9280799999999]], [[-23.409109, -314.9280799999999], [-24.109048, -315.2958499999999], [-24.877931, -315.5286499999999], [-25.525149, -315.9960799999999]], [[-25.525149, -315.9960799999999], [-26.422848, -316.6023199999999], [-27.405955, -317.0753999999999], [-28.418993, -317.4535999999999]], [[-28.418993, -317.4535999999999], [-29.732035, -317.89772999999985], [-31.176294, -317.4297999999999], [-32.288394, -316.6914599999999]], [[-32.288394, -316.6914599999999], [-32.800359, -316.3218699999999], [-33.217493999999995, -315.8164799999999], [-33.499751999999994, -315.2546399999999]], [[-33.499751999999994, -315.2546399999999], [-33.50915199999999, -315.2063399999999], [-33.499247, -315.14634999999987], [-33.543032, -315.1109099999999]], [[-33.543032, -315.1109099999999], [-33.543032, -315.1109099999999], [-33.543028, -315.11091], [-33.543028, -315.11091]], [[-33.543028, -315.11091], [-33.543028, -315.11091], [-33.543028, -315.11091], [-33.543028, -315.11091]]];/** * Stripped down version of "bezier_v2.scad". * For full version, see: https://www.thingiverse.com/thing:2170645 */function BEZ03(u) = pow((1-u), 3);function BEZ13(u) = 3*u*(pow((1-u),2));function BEZ23(u) = 3*(pow(u,2))*(1-u);function BEZ33(u) = pow(u,3);function bezier_2D_point(p0, p1, p2, p3, u) = [ BEZ03(u)*p0[0]+BEZ13(u)*p1[0]+BEZ23(u)*p2[0]+BEZ33(u)*p3[0], BEZ03(u)*p0[1]+BEZ13(u)*p1[1]+BEZ23(u)*p2[1]+BEZ33(u)*p3[1]];function bezier_coordinates(points, steps) = [ for (c = points) for (step = [0:steps]) bezier_2D_point(c[0], c[1], c[2],c[3], step/steps)];module bezier_polygon(points) { steps = $fn <= 0 ? 30 : $fn; polygon(bezier_coordinates(points, steps));} ----- gasstationwithoutpumps.wordpress.com www.thingiverse.com/gasstationwithoutpumps/things -- Sent from: http://forum.openscad.org/
C
cgriffith
Sat, Aug 17, 2019 2:38 PM

Hi Kevin,

I was trying to see if I could find a solution to your issue.  I could not.
What I did see... 1) You are using the output of the inkscape extension
directly in BOSL library which is incompatable.  Like my post above, they
use different formats for the path.  If you pass the output of nostril()
funciton directly into...

//converts a quadratic bezier grouped into 4 point sub-paths with duplicate
control points
//accross adjacent sub-path, to 3 point sub-paths sharing duplicat control
points
//like BOSL lib expects
function inkscape_path_to_bosl(inkscape_path) = [
for(path = inkscape_path)
for (i = [0:1:2])
path[i]
];

It will format the path that BOSL expects.  2) Your nostril() path has more
points than needed which leads to odd things around the point where path end
meets the beginning.  However, even if I clean the path up, I was still
getting that strange tangent artifact.  I could not get that to go away.

So maybe you were correct when you wrote, " I think the problem
is that the offset curve is sometimes running backwards (when the offset is
larger than the radius of curvature".

I have extracted the converted and cleaned up nostril path here in case
someone else had time to troubleshoot.

BOSL_nostril=[[-33.543, -315.111],
[-33.9821, -314.571], [-33.7038, -313.821], [-33.4652, -313.256],
[-32.8206, -311.725], [-31.3977, -310.621], [-29.8259, -310.158],
[-28.1715, -309.62], [-26.2332, -309.499], [-24.694, -310.434],
[-23.6414, -311.076], [-22.7192, -312.091], [-22.482, -313.329],
[-22.4063, -313.998], [-22.8113, -314.641], [-23.4091, -314.928],
[-24.109, -315.296], [-24.8779, -315.529], [-25.5251, -315.996],
[-26.4228, -316.602], [-27.406, -317.075], [-28.419, -317.454],
[-29.732, -317.898], [-31.1763, -317.43], [-32.2884, -316.691],
[-32.8004, -316.322], [-33.2175, -315.816], [-33.543, -315.111],
[-33.9821, -314.571], [-33.7038, -313.821], [-33.4652, -313.256]];

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

Hi Kevin, I was trying to see if I could find a solution to your issue. I could not. What I did see... 1) You are using the output of the inkscape extension directly in BOSL library which is incompatable. Like my post above, they use different formats for the path. If you pass the output of nostril() funciton directly into... //converts a quadratic bezier grouped into 4 point sub-paths with duplicate control points //accross adjacent sub-path, to 3 point sub-paths sharing duplicat control points //like BOSL lib expects function inkscape_path_to_bosl(inkscape_path) = [ for(path = inkscape_path) for (i = [0:1:2]) path[i] ]; It will format the path that BOSL expects. 2) Your nostril() path has more points than needed which leads to odd things around the point where path end meets the beginning. However, even if I clean the path up, I was still getting that strange tangent artifact. I could not get that to go away. So maybe you were correct when you wrote, " I think the problem is that the offset curve is sometimes running backwards (when the offset is larger than the radius of curvature". I have extracted the converted and cleaned up nostril path here in case someone else had time to troubleshoot. BOSL_nostril=[[-33.543, -315.111], [-33.9821, -314.571], [-33.7038, -313.821], [-33.4652, -313.256], [-32.8206, -311.725], [-31.3977, -310.621], [-29.8259, -310.158], [-28.1715, -309.62], [-26.2332, -309.499], [-24.694, -310.434], [-23.6414, -311.076], [-22.7192, -312.091], [-22.482, -313.329], [-22.4063, -313.998], [-22.8113, -314.641], [-23.4091, -314.928], [-24.109, -315.296], [-24.8779, -315.529], [-25.5251, -315.996], [-26.4228, -316.602], [-27.406, -317.075], [-28.419, -317.454], [-29.732, -317.898], [-31.1763, -317.43], [-32.2884, -316.691], [-32.8004, -316.322], [-33.2175, -315.816], [-33.543, -315.111], [-33.9821, -314.571], [-33.7038, -313.821], [-33.4652, -313.256]]; -- Sent from: http://forum.openscad.org/
G
gasstationwithoutpumps
Thu, Aug 22, 2019 6:32 PM

cgriffith wrote

Hi Kevin,

I was trying to see if I could find a solution to your issue.  I could
not.
What I did see... 1) You are using the output of the inkscape extension
directly in BOSL library which is incompatable.  Like my post above, they
use different formats for the path.  If you pass the output of nostril()
funciton directly into...

//converts a quadratic bezier grouped into 4 point sub-paths with
duplicate
control points
//accross adjacent sub-path, to 3 point sub-paths sharing duplicat control
points
//like BOSL lib expects
function inkscape_path_to_bosl(inkscape_path) = [
for(path = inkscape_path)
for (i = [0:1:2])
path[i]
];

It will format the path that BOSL expects.  2) Your nostril() path has
more
points than needed which leads to odd things around the point where path
end
meets the beginning.  However, even if I clean the path up, I was still
getting that strange tangent artifact.  I could not get that to go away.

The bezier_coordinates() call provided with the inkscape plugin does the
necessary conversions while giving some control over the smoothness of the
resulting path.

I'have had good results for 3D printing by doing linear_extrude of the paths
converted by the inkscape plugin—it is only the rounding that is causing
problems.  OpenSCAD seems to be good for 3D printing, but not for designing
for injection molding, where draft angles, rounding, and filleting need to
be easily controlled.  The BOSL2 rounding functions came close to giving the
functionality I need, but still fell a little short of getting me to a
finished design.


gasstationwithoutpumps.wordpress.com
www.thingiverse.com/gasstationwithoutpumps/things

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

cgriffith wrote > Hi Kevin, > > I was trying to see if I could find a solution to your issue. I could > not. > What I did see... 1) You are using the output of the inkscape extension > directly in BOSL library which is incompatable. Like my post above, they > use different formats for the path. If you pass the output of nostril() > funciton directly into... > > //converts a quadratic bezier grouped into 4 point sub-paths with > duplicate > control points > //accross adjacent sub-path, to 3 point sub-paths sharing duplicat control > points > //like BOSL lib expects > function inkscape_path_to_bosl(inkscape_path) = [ > for(path = inkscape_path) > for (i = [0:1:2]) > path[i] > ]; > > It will format the path that BOSL expects. 2) Your nostril() path has > more > points than needed which leads to odd things around the point where path > end > meets the beginning. However, even if I clean the path up, I was still > getting that strange tangent artifact. I could not get that to go away. The bezier_coordinates() call provided with the inkscape plugin does the necessary conversions while giving some control over the smoothness of the resulting path. I'have had good results for 3D printing by doing linear_extrude of the paths converted by the inkscape plugin—it is only the rounding that is causing problems. OpenSCAD seems to be good for 3D printing, but not for designing for injection molding, where draft angles, rounding, and filleting need to be easily controlled. The BOSL2 rounding functions came close to giving the functionality I need, but still fell a little short of getting me to a finished design. ----- gasstationwithoutpumps.wordpress.com www.thingiverse.com/gasstationwithoutpumps/things -- Sent from: http://forum.openscad.org/
C
cgriffith
Fri, Aug 23, 2019 2:39 AM

@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/

@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/