Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- 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.
Using entity in calls to functions that expect queries?
brooks_talley
Member Posts: 27 ✭
I'm just getting started with FeatureScript, so this is probably really naive... but I've scoured the docs and done a lot of trial/error, and I'm still mystified.
I'm trying to create a feature to that makes ribs from edges that are the intersections of two faces, with the rib following a vector that's halfway between the two faces.
Here's the code in question:
The problem, I think, is that
What am I missing? I realize there are complexities here with curved faces and the direction of the x-axis on the two faces. But I'm not even getting far enough to have those problems; I'm less worried about the accuracy of the algorithm than the language mechanism of "I have an entity and need a query".
I'm trying to create a feature to that makes ribs from edges that are the intersections of two faces, with the rib following a vector that's halfway between the two faces.
Here's the code in question:
var averageNormal = vector(0, 0 , 0); const adjacentFaces is Query = qEdgeAdjacent(edgeProfile, EntityType.FACE); if (evaluateQuery(context, adjacentFaces) == []) { throw regenError("Edge has no adjacent faces", edgeProfile); } for (var face in adjacentFaces) { const faceNormal = evFaceNormalAtEdge(context, {"edge" : edgeProfile, "face" : face, "parameter" : 0.5}); averageNormal += faceNormal; } normalize(averageNormal);
The problem, I think, is that
var face in adjacentFacesgets me an entity of EntityType.FACE. And evFaceNormalAtEdge wants the face to be a Query, like all of the ev* functions.
What am I missing? I realize there are complexities here with curved faces and the direction of the x-axis on the two faces. But I'm not even getting far enough to have those problems; I'm less worried about the accuracy of the algorithm than the language mechanism of "I have an entity and need a query".
Tagged:
0
Best Answer
-
konstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭you probably want to iterate through a list of queries, so you need
<code><code>evaluateQuery(context, adjacentFaces<span>);<br></span>
for (var face in adjacentFaces){...}<code>adjacentFaces =
6
Answers