The areQueriesEquivalent method does not work when compared to evaluateQuery?
I'm developing a simplistic feature that takes two inputs:
- A face
- An edge
My only constraint is that the edge belong to the face. In other words, if I query the face for all edges, I expect that the edge selected will also be in the set. To accomplish that, I've written a simple FeatureScript function called faceContainsEdge
function faceContainsEdge(context is Context, faceQuery is Query, edgeQuery is Query) returns boolean
precondition
{
!isQueryEmpty(context, qEntityFilter(edge, EntityType.EDGE));
!isQueryEmpty(context, qEntityFilter(face, EntityType.FACE));
}
{
// Extract my edges
const faceEdgesQuery is Query = qAdjacent(faceQuery, AdjacencyType.EDGE);
// Verify whether the given edge query evaluates to one of the edges of the face
for (var faceEdgeQuery in evaluateQuery(context, faceEdgesQuery))
{
if (areQueriesEquivalent(context, faceEdgeQuery, edgeQuery))
{
return true;
}
}
return false;
}
The problem (obviously) is that this doesn't work. I can see via the addition of debug lines that both the edgeQuery and faceEdgesQuery evaluate correctly:
If I try to print the two queries, I see the following:
- Each
faceEdgeQueryin the loop is a map with structure:Query 1: { queryType : TRANSIENT , transientId : JIV } - The invariant
edgeQueryis a map with structure:Query 2: { queryType : UNION , subqueries : [ { flatFilter : NO , queryType : SM_FLAT_FILTER … ]
And the function returns false always. How is this areQueriesEquivalent supposed to function? Do I need to convert the results of evaluateQuery in some way? How can I make the comparison meaningful?
Comments
-
Correct - a Query (the "search" term) and an evaluated Query (the result) are not the same thing, If you find the edges of the face using qAdjacent then all you need to do is check if qIntersection(edges of face, selected edge) is empty or not.
Senior Director, Technical Services, EMEA1 -
Thanks Neil. I interpreted the evaluated Query to be a list of sub 'search terms', one of which would have an identical 'term' to that being sought. I think I still have to get used to working with queries a bit.
0 -
Sketch face has a certain peculiarity. The sketch segments you can select on the screen are wire bodies. Edges of the sketch face are not selectable.
2



