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.

Options

Using entity in calls to functions that expect queries?

brooks_talleybrooks_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:
                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 adjacentFaces
gets 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".

Best Answer

Answers

  • Options
    brooks_talleybrooks_talley Member Posts: 27
    Argh. Should have seen that. Thank you!
Sign In or Register to comment.