WARNING: Ignoring unknown function 'select'

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

WARNING: Ignoring unknown function 'select'

gounthar
Hi there,

I'm trying to create sub vectors, and am having an issue.
WARNING: Ignoring unknown function 'select' in file boards adapter
utils.scad, line 21
The line 21 is             selectVector = select(points, selector);
First, I tried to use directly a range, but it failed (undef).
Now, I convert the range into a vector so that I get:
ECHO:[[17.445, 2.695, 0], [59.555, 2.695, 0], [17.445, 42.805, 0],
[59.555, 42.805, 0], [0, 0, 0], [77, 0, 0], [14, 45.5, 0], [63, 45.5,
0]]
ECHO:[1, 2, 3, 4, 5, 6, 7]
ECHO:"Select Vector", undef
ECHO:"Point 0 ", []

function range2vector(r) = [ for (i=r) i];

module getNearestPoints(points) {
    for (idx = [0 : len(points) - 1]) {
        if (idx == 0) {
            echo(points);
            selector = range2vector([1:len(points)-1]);
            echo(selector);
21            selectVector = select(points, selector);
            echo("Select Vector", selectVector);
            echo("Point 0 ", getAllDistances(points[0], selectVector));
        } else if (idx == len(points)-1) {
            selectVector = select(points, [0:len(points)-2]);
            echo("Last point ", getAllDistances(points[idx], selectVector));
        } else {
            selectVector = select(points,
concat([0:idx-1],[idx+1:len(points)-1]));
            echo("Point #", idx, getAllDistances(points[idx], selectVector));
        }
        getDistance(points[idx], points[idx + 1]);
    }
}

Could it be linked to previous warnings happening earlier in the file?

Thanks.

--
Bruno Verachten

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: WARNING: Ignoring unknown function 'select'

gounthar
My bad, I wronly read the documentation...
You have to define yourself the select function.

function select(vector, indices) = [ for (index = indices) vector[index] ];




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

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