Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

Selecting one entity from a query

Emily and I are currently trying to query for faces that are adjacent to another face. 

We are doing so by first finding the adjacent edges to a selected face, and then finding all adjacent faces to those edges. 

We would like to be able to select one face from the five faces returned in the query.

Current code is bellow:

 var tenonfaceedges = qEdgeAdjacent(definition.shaftface, EntityType.EDGE);   
 var camlockholeface = qEdgeAdjacent(tenonfaceedges, EntityType.FACE);



  • Emily_Qi_WangEmily_Qi_Wang Member Posts: 13 EDU
    edited February 2016
    Resolved by evaluating the query and then indexing the array for a particular face:

    var evaluatedTangentFaces = evaluateQuery(context, qEdgeAdjacent(tenonfaceedges, EntityType.FACE));

    Let us know if you have additional thoughts on this question!
  • kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 473
    You can get the same behavior as selecting a single evaluated face without the evaluate step by using qNthElement. With either strategy, the order of these elements isn't generally predictable, so if you need a particular one, you'll need to add more criteria.

Sign In or Register to comment.