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.
area of each face
papawo
Member, Developers Posts: 206 PRO
How can I get the area of each faces of a box?
It gives me the correct number of the faces but I cannot get each area of the faces.
evarea is giving me the total area of all the faces.
It gives me the correct number of the faces but I cannot get each area of the faces.
evarea is giving me the total area of all the faces.
Tagged:
0
Best Answer
-
kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565If a query refers to multiple entities in the current context (e.g. faceQuery referring to 6 faces of a cuboid), you can iterate through all the entities it refers to by calling evaluateQuery.
evaulateQuery returns an array of specific queries for individual items. You can iterate through this array to evaluate the area of each face individually:var faceQuery is Query = qCreatedBy(id + "cuboid1", EntityType.FACE); var faces is array = evaluateQuery(context, faceQuery); for (var i = 0; i < size(faces); i += 1) { var area = evArea(context, { "entities" : faces[i] }); println(area); }
7
Answers
evaulateQuery returns an array of specific queries for individual items. You can iterate through this array to evaluate the area of each face individually: