discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

odd shape III

JW
Joe Weinpert
Sun, Jan 16, 2022 6:16 PM

Thanks for all your help and pointers.  The following works now as
expected.  Would like to try different things such as steep angled side
topping off with a radius.

include<BOSL2/std.scad>
include<BOSL2/rounding.scad>
include <pathbuilder/pathbuilder.scad>

// Inkscape SVG path
objPath = "m 342.90003,358.02333 c -17.99286,0.81185 -30.32223,-20.88856
-6.71865,-24.03758 16.88561,-10.79732 -20.03126,-10.28204
-27.35932,-11.70948 -37.07082,-2.12289 -74.82867,-13.28583
-104.47467,-36.14505 -24.74472,-16.82199 6.06985,-34.22515
22.82105,-38.64347 12.57605,-8.11766 45.64911,-10.10405 41.27481,-28.09373
-21.88703,-10.96832 -49.44,-1.40288 -66.64094,14.41026 -14.24983,14.20294
-34.9447,18.91307 -54.29572,14.43611 -17.82597,-2.78354 -45.06864,-12.16807
-38.97227,-35.28131 4.71503,-20.28987 5.14435,-45.72284
-17.009616,-55.91851 C 63.952387,138.00383 31.319233,127.18815
4.6650364,106.89205 -9.9373433,82.327563 35.688067,84.640361
50.178576,87.454382 72.612859,88.247563 93.886477,102.66
116.37228,97.980052 123.11748,79.968912 89.608116,69.637168
77.911759,57.610527 62.707809,44.554392 38.377235,33.304517
36.5066,11.307517 49.450489,-7.0560881 76.599268,1.9067695
95.844793,0.96007991 138.61692,3.4682666 177.89163,21.499635
217.53749,35.883572 c 25.22282,12.027609 49.3191,-12.77849
74.91019,-5.331008 34.0276,6.744788 65.48384,22.58502 95.4376,39.519935
20.09121,14.267118 -1.35799,36.674211 -19.63921,36.773151 -16.79328,4.97808
-50.99454,-5.42638 -57.63504,0.77705 32.70828,22.42571 73.9426,11.14363
110.54962,16.64152 22.41783,18.54233 -15.77882,37.31572 -32.12701,42.41169
-18.60861,8.21893 -39.6846,2.67809 -58.49455,8.93302 10.55941,14.7401
35.50254,14.75874 53.03443,19.14379 25.74282,5.336 52.90342,4.73575
77.77611,13.46553 17.74919,7.97803 24.40774,31.64564 12.3753,47.32415
-15.21061,25.57157 -48.52265,28.59664 -67.45281,49.62076 -12.10676,20.26289
35.03067,25.59881 18.1882,44.16738 -19.35702,15.60126 -45.20843,8.17325
-67.92448,9.26802 -4.54616,-0.15022 -9.09845,-0.23765 -13.63581,-0.57523 z";

// pathbuilder: convert svg path to an array of points
rawPoints = svgPoints( objPath );
echo( "rawPoints[0]------------" );
echo( rawPoints[0] );

// BOSL2: remove all consecutive duplicate rows as well as the last row if
it matches the first row
objPoints = deduplicate( rawPoints[0], closed = true );
echo( "objPoints------------" );
echo( objPoints );

// BOSL2: draw it
offset_sweep(
objPoints,
height = 9.525,
top = os_circle( r = 3.175 ),
check_valid = false
);

Thanks for all your help and pointers. The following works now as expected. Would like to try different things such as steep angled side topping off with a radius. include<BOSL2/std.scad> include<BOSL2/rounding.scad> include <pathbuilder/pathbuilder.scad> // Inkscape SVG path objPath = "m 342.90003,358.02333 c -17.99286,0.81185 -30.32223,-20.88856 -6.71865,-24.03758 16.88561,-10.79732 -20.03126,-10.28204 -27.35932,-11.70948 -37.07082,-2.12289 -74.82867,-13.28583 -104.47467,-36.14505 -24.74472,-16.82199 6.06985,-34.22515 22.82105,-38.64347 12.57605,-8.11766 45.64911,-10.10405 41.27481,-28.09373 -21.88703,-10.96832 -49.44,-1.40288 -66.64094,14.41026 -14.24983,14.20294 -34.9447,18.91307 -54.29572,14.43611 -17.82597,-2.78354 -45.06864,-12.16807 -38.97227,-35.28131 4.71503,-20.28987 5.14435,-45.72284 -17.009616,-55.91851 C 63.952387,138.00383 31.319233,127.18815 4.6650364,106.89205 -9.9373433,82.327563 35.688067,84.640361 50.178576,87.454382 72.612859,88.247563 93.886477,102.66 116.37228,97.980052 123.11748,79.968912 89.608116,69.637168 77.911759,57.610527 62.707809,44.554392 38.377235,33.304517 36.5066,11.307517 49.450489,-7.0560881 76.599268,1.9067695 95.844793,0.96007991 138.61692,3.4682666 177.89163,21.499635 217.53749,35.883572 c 25.22282,12.027609 49.3191,-12.77849 74.91019,-5.331008 34.0276,6.744788 65.48384,22.58502 95.4376,39.519935 20.09121,14.267118 -1.35799,36.674211 -19.63921,36.773151 -16.79328,4.97808 -50.99454,-5.42638 -57.63504,0.77705 32.70828,22.42571 73.9426,11.14363 110.54962,16.64152 22.41783,18.54233 -15.77882,37.31572 -32.12701,42.41169 -18.60861,8.21893 -39.6846,2.67809 -58.49455,8.93302 10.55941,14.7401 35.50254,14.75874 53.03443,19.14379 25.74282,5.336 52.90342,4.73575 77.77611,13.46553 17.74919,7.97803 24.40774,31.64564 12.3753,47.32415 -15.21061,25.57157 -48.52265,28.59664 -67.45281,49.62076 -12.10676,20.26289 35.03067,25.59881 18.1882,44.16738 -19.35702,15.60126 -45.20843,8.17325 -67.92448,9.26802 -4.54616,-0.15022 -9.09845,-0.23765 -13.63581,-0.57523 z"; // pathbuilder: convert svg path to an array of points rawPoints = svgPoints( objPath ); echo( "rawPoints[0]------------" ); echo( rawPoints[0] ); // BOSL2: remove all consecutive duplicate rows as well as the last row if it matches the first row objPoints = deduplicate( rawPoints[0], closed = true ); echo( "objPoints------------" ); echo( objPoints ); // BOSL2: draw it offset_sweep( objPoints, height = 9.525, top = os_circle( r = 3.175 ), check_valid = false );
J
jon
Sun, Jan 16, 2022 7:14 PM

When I load this into OpenSCAD, I get a syntax error at line 7, the
"objPath = " line.

Jon

On 1/16/2022 1:16 PM, Joe Weinpert wrote:

include<BOSL2/std.scad>
include<BOSL2/rounding.scad>
include <pathbuilder/pathbuilder.scad>

// Inkscape SVG path
objPath = "m 342.90003,358.02333 c -17.99286,0.81185
-30.32223,-20.88856 -6.71865,-24.03758 16.88561,-10.79732
-20.03126,-10.28204 -27.35932,-11.70948 -37.07082,-2.12289
-74.82867,-13.28583 -104.47467,-36.14505 -24.74472,-16.82199
6.06985,-34.22515 22.82105,-38.64347 12.57605,-8.11766
45.64911,-10.10405 41.27481,-28.09373 -21.88703,-10.96832
-49.44,-1.40288 -66.64094,14.41026 -14.24983,14.20294
-34.9447,18.91307 -54.29572,14.43611 -17.82597,-2.78354
-45.06864,-12.16807 -38.97227,-35.28131 4.71503,-20.28987
5.14435,-45.72284 -17.009616,-55.91851 C 63.952387,138.00383
31.319233,127.18815 4.6650364,106.89205 -9.9373433,82.327563
35.688067,84.640361 50.178576,87.454382 72.612859,88.247563
93.886477,102.66 116.37228,97.980052 123.11748,79.968912
89.608116,69.637168 77.911759,57.610527 62.707809,44.554392
38.377235,33.304517 36.5066,11.307517 49.450489,-7.0560881
76.599268,1.9067695 95.844793,0.96007991 138.61692,3.4682666
177.89163,21.499635 217.53749,35.883572 c 25.22282,12.027609
49.3191,-12.77849 74.91019,-5.331008 34.0276,6.744788
65.48384,22.58502 95.4376,39.519935 20.09121,14.267118
-1.35799,36.674211 -19.63921,36.773151 -16.79328,4.97808
-50.99454,-5.42638 -57.63504,0.77705 32.70828,22.42571
73.9426,11.14363 110.54962,16.64152 22.41783,18.54233
-15.77882,37.31572 -32.12701,42.41169 -18.60861,8.21893
-39.6846,2.67809 -58.49455,8.93302 10.55941,14.7401 35.50254,14.75874
53.03443,19.14379 25.74282,5.336 52.90342,4.73575 77.77611,13.46553
17.74919,7.97803 24.40774,31.64564 12.3753,47.32415 -15.21061,25.57157
-48.52265,28.59664 -67.45281,49.62076 -12.10676,20.26289
35.03067,25.59881 18.1882,44.16738 -19.35702,15.60126
-45.20843,8.17325 -67.92448,9.26802 -4.54616,-0.15022
-9.09845,-0.23765 -13.63581,-0.57523 z";

// pathbuilder: convert svg path to an array of points
rawPoints = svgPoints( objPath );
echo( "rawPoints[0]------------" );
echo( rawPoints[0] );

// BOSL2: remove all consecutive duplicate rows as well as the last
row if it matches the first row
objPoints = deduplicate( rawPoints[0], closed = true );
echo( "objPoints------------" );
echo( objPoints );

// BOSL2: draw it
offset_sweep(
   objPoints,
   height = 9.525,
   top = os_circle( r = 3.175 ),
   check_valid = false
);

When I load this into OpenSCAD, I get a syntax error at line 7, the "objPath = " line. Jon On 1/16/2022 1:16 PM, Joe Weinpert wrote: > > include<BOSL2/std.scad> > include<BOSL2/rounding.scad> > include <pathbuilder/pathbuilder.scad> > > // Inkscape SVG path > objPath = "m 342.90003,358.02333 c -17.99286,0.81185 > -30.32223,-20.88856 -6.71865,-24.03758 16.88561,-10.79732 > -20.03126,-10.28204 -27.35932,-11.70948 -37.07082,-2.12289 > -74.82867,-13.28583 -104.47467,-36.14505 -24.74472,-16.82199 > 6.06985,-34.22515 22.82105,-38.64347 12.57605,-8.11766 > 45.64911,-10.10405 41.27481,-28.09373 -21.88703,-10.96832 > -49.44,-1.40288 -66.64094,14.41026 -14.24983,14.20294 > -34.9447,18.91307 -54.29572,14.43611 -17.82597,-2.78354 > -45.06864,-12.16807 -38.97227,-35.28131 4.71503,-20.28987 > 5.14435,-45.72284 -17.009616,-55.91851 C 63.952387,138.00383 > 31.319233,127.18815 4.6650364,106.89205 -9.9373433,82.327563 > 35.688067,84.640361 50.178576,87.454382 72.612859,88.247563 > 93.886477,102.66 116.37228,97.980052 123.11748,79.968912 > 89.608116,69.637168 77.911759,57.610527 62.707809,44.554392 > 38.377235,33.304517 36.5066,11.307517 49.450489,-7.0560881 > 76.599268,1.9067695 95.844793,0.96007991 138.61692,3.4682666 > 177.89163,21.499635 217.53749,35.883572 c 25.22282,12.027609 > 49.3191,-12.77849 74.91019,-5.331008 34.0276,6.744788 > 65.48384,22.58502 95.4376,39.519935 20.09121,14.267118 > -1.35799,36.674211 -19.63921,36.773151 -16.79328,4.97808 > -50.99454,-5.42638 -57.63504,0.77705 32.70828,22.42571 > 73.9426,11.14363 110.54962,16.64152 22.41783,18.54233 > -15.77882,37.31572 -32.12701,42.41169 -18.60861,8.21893 > -39.6846,2.67809 -58.49455,8.93302 10.55941,14.7401 35.50254,14.75874 > 53.03443,19.14379 25.74282,5.336 52.90342,4.73575 77.77611,13.46553 > 17.74919,7.97803 24.40774,31.64564 12.3753,47.32415 -15.21061,25.57157 > -48.52265,28.59664 -67.45281,49.62076 -12.10676,20.26289 > 35.03067,25.59881 18.1882,44.16738 -19.35702,15.60126 > -45.20843,8.17325 -67.92448,9.26802 -4.54616,-0.15022 > -9.09845,-0.23765 -13.63581,-0.57523 z"; > > // pathbuilder: convert svg path to an array of points > rawPoints = svgPoints( objPath ); > echo( "rawPoints[0]------------" ); > echo( rawPoints[0] ); > > > // BOSL2: remove all consecutive duplicate rows as well as the last > row if it matches the first row > objPoints = deduplicate( rawPoints[0], closed = true ); > echo( "objPoints------------" ); > echo( objPoints ); > > // BOSL2: draw it > offset_sweep( >    objPoints, >    height = 9.525, >    top = os_circle( r = 3.175 ), >    check_valid = false > );
AM
Adrian Mariano
Sun, Jan 16, 2022 11:52 PM

In response to the complaint of a syntax error, it works fine for me.
Perhaps the very long line introduced some problem for the other user.

You should be able to create any shape you want by using os_profile if
necessary to specify the shape.

On Sun, Jan 16, 2022 at 1:16 PM Joe Weinpert joe.weinpert@gmail.com wrote:

Thanks for all your help and pointers.  The following works now as expected.  Would like to try different things such as steep angled side topping off with a radius.

include<BOSL2/std.scad>
include<BOSL2/rounding.scad>
include <pathbuilder/pathbuilder.scad>

// Inkscape SVG path
objPath = "m 342.90003,358.02333 c -17.99286,0.81185 -30.32223,-20.88856 -6.71865,-24.03758 16.88561,-10.79732 -20.03126,-10.28204 -27.35932,-11.70948 -37.07082,-2.12289 -74.82867,-13.28583 -104.47467,-36.14505 -24.74472,-16.82199 6.06985,-34.22515 22.82105,-38.64347 12.57605,-8.11766 45.64911,-10.10405 41.27481,-28.09373 -21.88703,-10.96832 -49.44,-1.40288 -66.64094,14.41026 -14.24983,14.20294 -34.9447,18.91307 -54.29572,14.43611 -17.82597,-2.78354 -45.06864,-12.16807 -38.97227,-35.28131 4.71503,-20.28987 5.14435,-45.72284 -17.009616,-55.91851 C 63.952387,138.00383 31.319233,127.18815 4.6650364,106.89205 -9.9373433,82.327563 35.688067,84.640361 50.178576,87.454382 72.612859,88.247563 93.886477,102.66 116.37228,97.980052 123.11748,79.968912 89.608116,69.637168 77.911759,57.610527 62.707809,44.554392 38.377235,33.304517 36.5066,11.307517 49.450489,-7.0560881 76.599268,1.9067695 95.844793,0.96007991 138.61692,3.4682666 177.89163,21.499635 217.53749,35.883572 c 25.22282,12.027609 49.3191,-12.77849 74.91019,-5.331008 34.0276,6.744788 65.48384,22.58502 95.4376,39.519935 20.09121,14.267118 -1.35799,36.674211 -19.63921,36.773151 -16.79328,4.97808 -50.99454,-5.42638 -57.63504,0.77705 32.70828,22.42571 73.9426,11.14363 110.54962,16.64152 22.41783,18.54233 -15.77882,37.31572 -32.12701,42.41169 -18.60861,8.21893 -39.6846,2.67809 -58.49455,8.93302 10.55941,14.7401 35.50254,14.75874 53.03443,19.14379 25.74282,5.336 52.90342,4.73575 77.77611,13.46553 17.74919,7.97803 24.40774,31.64564 12.3753,47.32415 -15.21061,25.57157 -48.52265,28.59664 -67.45281,49.62076 -12.10676,20.26289 35.03067,25.59881 18.1882,44.16738 -19.35702,15.60126 -45.20843,8.17325 -67.92448,9.26802 -4.54616,-0.15022 -9.09845,-0.23765 -13.63581,-0.57523 z";

// pathbuilder: convert svg path to an array of points
rawPoints = svgPoints( objPath );
echo( "rawPoints[0]------------" );
echo( rawPoints[0] );

// BOSL2: remove all consecutive duplicate rows as well as the last row if it matches the first row
objPoints = deduplicate( rawPoints[0], closed = true );
echo( "objPoints------------" );
echo( objPoints );

// BOSL2: draw it
offset_sweep(
objPoints,
height = 9.525,
top = os_circle( r = 3.175 ),
check_valid = false
);


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

In response to the complaint of a syntax error, it works fine for me. Perhaps the very long line introduced some problem for the other user. You should be able to create any shape you want by using os_profile if necessary to specify the shape. On Sun, Jan 16, 2022 at 1:16 PM Joe Weinpert <joe.weinpert@gmail.com> wrote: > > Thanks for all your help and pointers. The following works now as expected. Would like to try different things such as steep angled side topping off with a radius. > > > include<BOSL2/std.scad> > include<BOSL2/rounding.scad> > include <pathbuilder/pathbuilder.scad> > > // Inkscape SVG path > objPath = "m 342.90003,358.02333 c -17.99286,0.81185 -30.32223,-20.88856 -6.71865,-24.03758 16.88561,-10.79732 -20.03126,-10.28204 -27.35932,-11.70948 -37.07082,-2.12289 -74.82867,-13.28583 -104.47467,-36.14505 -24.74472,-16.82199 6.06985,-34.22515 22.82105,-38.64347 12.57605,-8.11766 45.64911,-10.10405 41.27481,-28.09373 -21.88703,-10.96832 -49.44,-1.40288 -66.64094,14.41026 -14.24983,14.20294 -34.9447,18.91307 -54.29572,14.43611 -17.82597,-2.78354 -45.06864,-12.16807 -38.97227,-35.28131 4.71503,-20.28987 5.14435,-45.72284 -17.009616,-55.91851 C 63.952387,138.00383 31.319233,127.18815 4.6650364,106.89205 -9.9373433,82.327563 35.688067,84.640361 50.178576,87.454382 72.612859,88.247563 93.886477,102.66 116.37228,97.980052 123.11748,79.968912 89.608116,69.637168 77.911759,57.610527 62.707809,44.554392 38.377235,33.304517 36.5066,11.307517 49.450489,-7.0560881 76.599268,1.9067695 95.844793,0.96007991 138.61692,3.4682666 177.89163,21.499635 217.53749,35.883572 c 25.22282,12.027609 49.3191,-12.77849 74.91019,-5.331008 34.0276,6.744788 65.48384,22.58502 95.4376,39.519935 20.09121,14.267118 -1.35799,36.674211 -19.63921,36.773151 -16.79328,4.97808 -50.99454,-5.42638 -57.63504,0.77705 32.70828,22.42571 73.9426,11.14363 110.54962,16.64152 22.41783,18.54233 -15.77882,37.31572 -32.12701,42.41169 -18.60861,8.21893 -39.6846,2.67809 -58.49455,8.93302 10.55941,14.7401 35.50254,14.75874 53.03443,19.14379 25.74282,5.336 52.90342,4.73575 77.77611,13.46553 17.74919,7.97803 24.40774,31.64564 12.3753,47.32415 -15.21061,25.57157 -48.52265,28.59664 -67.45281,49.62076 -12.10676,20.26289 35.03067,25.59881 18.1882,44.16738 -19.35702,15.60126 -45.20843,8.17325 -67.92448,9.26802 -4.54616,-0.15022 -9.09845,-0.23765 -13.63581,-0.57523 z"; > > // pathbuilder: convert svg path to an array of points > rawPoints = svgPoints( objPath ); > echo( "rawPoints[0]------------" ); > echo( rawPoints[0] ); > > > // BOSL2: remove all consecutive duplicate rows as well as the last row if it matches the first row > objPoints = deduplicate( rawPoints[0], closed = true ); > echo( "objPoints------------" ); > echo( objPoints ); > > // BOSL2: draw it > offset_sweep( > objPoints, > height = 9.525, > top = os_circle( r = 3.175 ), > check_valid = false > ); > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org