Sum all areas of all faces of the element separately by assigned materials.

For example, for elements of the Morph type, you can assign your own poking to different faces (hold CTRL + SHIFT and click on the desired faces - they will be selected.

Then, in the element editor, set the name of the material).



All coverage areas can be obtained with one command.

The result is displayed in a table.

Handling:

int ires = ac_request_special("GetMaterialSurfaceSquareTable", int iTableDescr);

Here:

iTableDescr - table with the result.

Before calling the function, you need to create a table object.

The function will create columns:

"materialindex" - integer type;

"materialname" - string type;

"square" - floating point type.


Example. Get the areas of all surfaces of the selected Morph element separately by materials and display in the message window.


int main()

{

   ac_request_special("load_elements_list_from_selection", 1, "MorphType", 0);

   ac_request("get_loaded_elements_list_count",1);

   int iсount = ac_getnumvalue();

   if (icount == 0)

   {

      cout << "First select an element of type Morph";

      return;

   }


   ac_request("set_current_element_from_list", 1, 0);

   

   int iTableMat;

   object("create", "ts_table", iTableMat);

   ac_request_special("GetMaterialSurfaceSquareTable", iTableMat);

   string str;

   ts_table(iTableMat, "print_to_str", strrr);

   coutvar << str;

   object("delete", iTableMat);

   cout << "Program completed successfully";

}


Result: