Forum Navigation
You need to log in to create posts and topics.

Continuation on the topic " Export volume/area of regions in Construct Surface Modifier"

Hello,

I have two questions about the surface mesh and the volumetric regions (in the scripting interface):

1) The solution on how to export the volumes and areas of all volumetric regions did work as given in a previous thread, however, the "Filled" property must be deleted, as the error below occurs. Can this be corrected?

2) Is it possible to export the mesh elements corresponding to the empty/filled volumes found. Eg. A list of all mesh element positions and with the same identifier as the empty/filled volumes. Or then simply outputting the position of the empty/filled volume as a list.

 

Error message:

table.create_property('Filled', data=regions['Filled'])
File "...ovito-pro-3.2.1-x86_64/bin/../lib/ovito/plugins/python/ovito/data/stdobj/property_container.py", line 192, in _PropertyContainer_create_property
raise TypeError("Invalid property data type. Only 'int', 'int64' or 'float' are allowed.")

Hi Frederic,

1) This appears to be an issue that is specific to the Linux version of OVITO's embedded Python interpreter. I am working on a fix. In the meantime, you can extend the code line as follows to avoid the error:

table.create_property('Filled', data=regions['Filled'], dtype=int)

2) I'm not sure what you mean with mesh "elements". Do you mean the mesh faces, which form the surface enclosing a specific region?

You could call the SurfaceMesh.get_faces() and SurfaceMesh.get_vertices() methods to obtain the list of triangles/vertices the surface mesh is made of. Next, you could access the SurfaceMesh.faces['Region'] array, which stores the index of the volumetric region each triangular face is adjacent to. Note that triangle faces come in pairs if you activated the identify_regions option: One for either side of the boundary surface, which separates two volumetric regions. Let me know if you have further questions or require more help.

Hi Alexander,

Thank you, this solved both of my problems.