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
-
If 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
-
If 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

