discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

My OpenScad library for string and vector operations

R
roipoussiere
Thu, Dec 31, 2015 5:30 PM

Hello everyone,

I have just uploaded my OpenScad library for string and vector operations!!

I am waiting for comments, bug reports, aditional features, any feedbacks.
:-)

Enjoy!!

And I have also a question, where to put this in the OpenScad repo ?
This library contains generic functions which could be usefull for a next
OpenScad version.

Thank you!

Nathanaël

--
View this message in context: http://forum.openscad.org/My-OpenScad-library-for-string-and-vector-operations-tp15399.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Hello everyone, I have just uploaded my OpenScad library for string and vector operations!! I am waiting for comments, bug reports, aditional features, any feedbacks. :-) Enjoy!! And I have also a question, where to put this in the OpenScad repo ? This library contains generic functions which could be usefull for a next OpenScad version. Thank you! Nathanaël -- View this message in context: http://forum.openscad.org/My-OpenScad-library-for-string-and-vector-operations-tp15399.html Sent from the OpenSCAD mailing list archive at Nabble.com.
DM
doug moen
Thu, Dec 31, 2015 7:38 PM

How can we access your library? Please provide a link.

On 31 December 2015 at 12:30, roipoussiere roipoussiere@gmail.com wrote:

Hello everyone,

I have just uploaded my OpenScad library for string and vector operations!!

I am waiting for comments, bug reports, aditional features, any feedbacks.
:-)

Enjoy!!

And I have also a question, where to put this in the OpenScad repo ?
This library contains generic functions which could be usefull for a next
OpenScad version.

Thank you!

Nathanaël

--
View this message in context:
http://forum.openscad.org/My-OpenScad-library-for-string-and-vector-operations-tp15399.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

How can we access your library? Please provide a link. On 31 December 2015 at 12:30, roipoussiere <roipoussiere@gmail.com> wrote: > Hello everyone, > > I have just uploaded my OpenScad library for string and vector operations!! > > I am waiting for comments, bug reports, aditional features, any feedbacks. > :-) > > Enjoy!! > > And I have also a question, where to put this in the OpenScad repo ? > This library contains generic functions which could be usefull for a next > OpenScad version. > > Thank you! > > Nathanaël > > > > -- > View this message in context: > http://forum.openscad.org/My-OpenScad-library-for-string-and-vector-operations-tp15399.html > Sent from the OpenSCAD mailing list archive at Nabble.com. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
MR
Marvin Roipoussiere
Thu, Dec 31, 2015 10:47 PM

Haha! I forgot the link, sorry.
http://www.thingiverse.com/thing:1237203

2015-12-31 20:38 GMT+01:00 doug moen doug@moens.org:

How can we access your library? Please provide a link.

On 31 December 2015 at 12:30, roipoussiere roipoussiere@gmail.com wrote:

Hello everyone,

I have just uploaded my OpenScad library for string and vector
operations!!

I am waiting for comments, bug reports, aditional features, any feedbacks.
:-)

Enjoy!!

And I have also a question, where to put this in the OpenScad repo ?
This library contains generic functions which could be usefull for a next
OpenScad version.

Thank you!

Nathanaël

--
View this message in context:
http://forum.openscad.org/My-OpenScad-library-for-string-and-vector-operations-tp15399.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Haha! I forgot the link, sorry. http://www.thingiverse.com/thing:1237203 2015-12-31 20:38 GMT+01:00 doug moen <doug@moens.org>: > How can we access your library? Please provide a link. > > On 31 December 2015 at 12:30, roipoussiere <roipoussiere@gmail.com> wrote: > >> Hello everyone, >> >> I have just uploaded my OpenScad library for string and vector >> operations!! >> >> I am waiting for comments, bug reports, aditional features, any feedbacks. >> :-) >> >> Enjoy!! >> >> And I have also a question, where to put this in the OpenScad repo ? >> This library contains generic functions which could be usefull for a next >> OpenScad version. >> >> Thank you! >> >> Nathanaël >> >> >> >> -- >> View this message in context: >> http://forum.openscad.org/My-OpenScad-library-for-string-and-vector-operations-tp15399.html >> Sent from the OpenSCAD mailing list archive at Nabble.com. >> >> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> > > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > >
R
runsun
Fri, Jan 1, 2016 4:19 AM

One other string lib that worth attention: the String Theory by 16807:

http://www.thingiverse.com/thing:526023


$  Runsun Pan, PhD

$ libs:

doctest ,

faces ( git ),

offline doc ( git ),

runscad.py( 1 , 2 , git ),

synwrite( 1 , 2 );

$ tips:

hash( 1 , 2 ),

sweep ,

var( 1 , 2 ),

lerp ,

animGif ,

precision( 1 , 2 ),

xl-control

--
View this message in context: http://forum.openscad.org/My-OpenScad-library-for-string-and-vector-operations-tp15399p15403.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

One other string lib that worth attention: the String Theory by 16807: http://www.thingiverse.com/thing:526023 ----- $ Runsun Pan, PhD $ libs: doctest , faces ( git ), offline doc ( git ), runscad.py( 1 , 2 , git ), synwrite( 1 , 2 ); $ tips: hash( 1 , 2 ), sweep , var( 1 , 2 ), lerp , animGif , precision( 1 , 2 ), xl-control -- View this message in context: http://forum.openscad.org/My-OpenScad-library-for-string-and-vector-operations-tp15399p15403.html Sent from the OpenSCAD mailing list archive at Nabble.com.
DM
doug moen
Fri, Jan 1, 2016 5:57 AM

Nathanaël: Thanks for sharing. There's a lot of cool OpenSCAD code out
there, and it's hard to find out about it. My only comment right now is
that I find it strange for getval to return -1 if the key isn't found. A
return value of undef would seem more idiomatic for OpenSCAD.

Runsun: Thanks for the reference to String Theory. I had no idea that
regular expressions were implemented for OpenSCAD. And the General Library
of Relativity is even cooler (for my purposes anyway, since I don't use
strings for much).

On 31 December 2015 at 23:19, runsun runsun@gmail.com wrote:

One other string lib that worth attention: the String Theory by 16807:

http://www.thingiverse.com/thing:526023


$  Runsun Pan, PhD

$ libs:

doctest ,

faces ( git ),

offline doc ( git ),

runscad.py( 1 , 2 , git ),

synwrite( 1 , 2 );

$ tips:

hash( 1 , 2 ),

sweep ,

var( 1 , 2 ),

lerp ,

animGif ,

precision( 1 , 2 ),

xl-control

--
View this message in context:
http://forum.openscad.org/My-OpenScad-library-for-string-and-vector-operations-tp15399p15403.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Nathanaël: Thanks for sharing. There's a lot of cool OpenSCAD code out there, and it's hard to find out about it. My only comment right now is that I find it strange for getval to return -1 if the key isn't found. A return value of undef would seem more idiomatic for OpenSCAD. Runsun: Thanks for the reference to String Theory. I had no idea that regular expressions were implemented for OpenSCAD. And the General Library of Relativity is even cooler (for my purposes anyway, since I don't use strings for much). On 31 December 2015 at 23:19, runsun <runsun@gmail.com> wrote: > One other string lib that worth attention: the String Theory by 16807: > > http://www.thingiverse.com/thing:526023 > > > > ----- > > $ Runsun Pan, PhD > > $ libs: > > doctest , > > faces ( git ), > > offline doc ( git ), > > runscad.py( 1 , 2 , git ), > > > synwrite( 1 , 2 ); > > > > $ tips: > > hash( 1 , 2 ), > > sweep , > > var( 1 , 2 ), > > lerp , > > animGif , > > precision( 1 , 2 ), > > xl-control > > > > > > > > > -- > View this message in context: > http://forum.openscad.org/My-OpenScad-library-for-string-and-vector-operations-tp15399p15403.html > Sent from the OpenSCAD mailing list archive at Nabble.com. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > >
R
runsun
Fri, Jan 1, 2016 7:55 PM

doug.moen wrote

I had no idea that regular expressions were implemented for OpenSCAD

It's cool, isn't it ? In fact I have coded similar thing for my lib, a
scanner like parser that can do this:

fml = "a+cos(2)+sin(5)";

match( fml, ps=[A_z] ) => [[0,0,"a",["a"]], [2,4, "cos",["cos"]],
[9,11,"sin",["sin"]]];

match( fml, ps=[["cos","sin"]] ) => [[2,4,"cos", ["cos"]], [9,11,
"sin",["sin"]]];

// Want only item 0 and 2 in the matches:
match( fml, ps=["+-", ["sin(","cos("], 0_9,")]"], want=[0,2])
=> [ [1,7, "+cos(2)", ["+", "2"]], [8,14,"+sin(5)", ["+", "5"]] ]

match( "EE+ccc+AAaa+BBbb+DDD", ps=[A_Z,a_z] )
=> [ [7, 10,"AAaa", ["AA","aa"]], [12,15,"BBbb", ["BB","bb"]] ]

And with that you can do :

calc( "x+1", ["x",3] )= 4
calc( "x(y+2)", ["x",3,"y",1] )= 9
calc( "x(y+2)^2", ["x",3,"y",1] )= 81
calc( "x*((y+2)^2)", ["x",3,"y",1] )= 27
calc( "2x+1.5y", ["x",3,"y",4] )= 12

This allows for an object easily customizable with different formula.

This was developed independently before I knew the existence of regex.  I'll
have to check if user 16807 is better for this kind of use.

BTW, as a side note, the function calc( ) needs a scope parameter --- a
perfect usage case for a hash.


$  Runsun Pan, PhD

$ libs:

doctest ,

faces ( git ),

offline doc ( git ),

runscad.py( 1 , 2 , git ),

synwrite( 1 , 2 );

$ tips:

hash( 1 , 2 ),

sweep ,

var( 1 , 2 ),

lerp ,

animGif ,

precision( 1 , 2 ),

xl-control

--
View this message in context: http://forum.openscad.org/My-OpenScad-library-for-string-and-vector-operations-tp15399p15407.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

doug.moen wrote > I had no idea that regular expressions were implemented for OpenSCAD It's cool, isn't it ? In fact I have coded similar thing for my lib, a scanner like parser that can do this: > fml = "a+cos(2)+sin(5)"; > > match( fml, ps=[A_z] ) => [[0,0,"a",["a"]], [2,4, "cos",["cos"]], > [9,11,"sin",["sin"]]]; > > match( fml, ps=[["cos","sin"]] ) => [[2,4,"cos", ["cos"]], [9,11, > "sin",["sin"]]]; > > // Want only item 0 and 2 in the matches: > match( fml, ps=["+-", ["sin(","cos("], 0_9,")]"], want=[0,2]) > => [ [1,7, "+cos(2)", ["+", "2"]], [8,14,"+sin(5)", ["+", "5"]] ] > > match( "EE+ccc+AAaa+BBbb+DDD", ps=[A_Z,a_z] ) > => [ [7, 10,"AAaa", ["AA","aa"]], [12,15,"BBbb", ["BB","bb"]] ] And with that you can do : > calc( "x+1", ["x",3] )= 4 > calc( "x(y+2)", ["x",3,"y",1] )= 9 > calc( "x(y+2)^2", ["x",3,"y",1] )= 81 > calc( "x*((y+2)^2)", ["x",3,"y",1] )= 27 > calc( "2x+1.5y", ["x",3,"y",4] )= 12 This allows for an object easily customizable with different formula. This was developed independently before I knew the existence of regex. I'll have to check if user 16807 is better for this kind of use. BTW, as a side note, the function calc( ) needs a scope parameter --- a perfect usage case for a hash. ----- $ Runsun Pan, PhD $ libs: doctest , faces ( git ), offline doc ( git ), runscad.py( 1 , 2 , git ), synwrite( 1 , 2 ); $ tips: hash( 1 , 2 ), sweep , var( 1 , 2 ), lerp , animGif , precision( 1 , 2 ), xl-control -- View this message in context: http://forum.openscad.org/My-OpenScad-library-for-string-and-vector-operations-tp15399p15407.html Sent from the OpenSCAD mailing list archive at Nabble.com.
M
MichaelAtOz
Sun, Jan 3, 2016 4:38 AM

roipoussiere wrote

And I have also a question, where to put this in the OpenScad repo ?

You can also list it  here
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Libraries#Other_Libraries


Newly minted Admin - PM me if you need anything, or if I've done something stupid...

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!

View this message in context: http://forum.openscad.org/My-OpenScad-library-for-string-and-vector-operations-tp15399p15424.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

roipoussiere wrote > And I have also a question, where to put this in the OpenScad repo ? You can also list it here <https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Libraries#Other_Libraries> ----- Newly minted Admin - PM me if you need anything, or if I've done something stupid... 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! -- View this message in context: http://forum.openscad.org/My-OpenScad-library-for-string-and-vector-operations-tp15399p15424.html Sent from the OpenSCAD mailing list archive at Nabble.com.