Get multiple vertices from a query

Kaiden_Shinew
Kaiden_Shinew Member Posts: 2 ✭

How would I go about getting multiple vertices from a query?

I have a parameter that creates a query of 3 points. I am attempting to make a plane using the 3 points.

Here is what I have so far:

annotation {"Name" : "Points", "Filter" : (EntityType.VERTEX), "MaxNumberOfPicks" : 3}
definition.points is Query;

var points = {};
        
for (var i, point in evaluateQuery(context, definition.points)) {
    points[i] = point;
}

var origin = (points[0] + points[1] + points[2])/3;
var normal = cross(points[0] - points[1], points[0] - points[2]);

opPlane(context, id + "plane1", {
    "plane" : plane(origin, normal)
}

When I print the `point` variable, I am hoping for a Vector, but I instead get this:

{ queryType : TRANSIENT , transientId : I2 }

Comments

  • NeilCooke
    NeilCooke Moderator, Onshape Employees Posts: 6,126 image

    You need to use evVertexPoint to get the coordinates for each vertex.

    Senior Director, Technical Services, EMEA