myMod( [ [1,2],[3,4] ] );
module myMod(a) {
for( x=[1:5] )
for ( y=[1:5] ) {
s = (search([ [x,y] ],a)[0]);
echo(s);
if ( s != [] )
echo(str("Found [",x,",",y,"]") );
}
}
Note the extra [ ] in the first parameter to search, makes the target an
array in the array.
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/Array-question-tp19450p19453.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
search()
<https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Other_Language_Features#Search>
can be a bit confusing, but once you work out what it does it is handy.
> myMod( [ [1,2],[3,4] ] );
>
> module myMod(a) {
> for( x=[1:5] )
> for ( y=[1:5] ) {
> s = (search([ [x,y] ],a)[0]);
> echo(s);
> if ( s != [] )
> echo(str("Found [",x,",",y,"]") );
> }
> }
Note the extra [ ] in the first parameter to search, makes the target an
array in the array.
-----
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/Array-question-tp19450p19453.html
Sent from the OpenSCAD mailing list archive at Nabble.com.