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

Export volume/area of regions in Construct Surface Modifier


As the Subject says, I want export the volume and area of regions, which  can ba found in Surfaces panel (List of identified regions). I hava a bunch of Data file to analyse to dynamicaly visualize the envolution of the volume of cracks.

I can do this by copy and paste the value table one frame by frame. However, this is a hard work for so many frames. I try to find some built-in export methods but seems failed. The export function `Table of values` only work for global attributes. Besides, there's seems no API in python script to export each volume of regions, but volume of total.

Is there any good way to realize that?


Hi Wang,

The list of volumetric regions identified by the Construct Surface Mesh modifier is not a regular data table but a generic PropertyContainer, which is part of the surface mesh object (a surface mesh consists of "vertices", "faces" and "regions"). From Python, the regions list is accessible through the SurfaceMesh.regions field.

OVITO currently has no built-in file exporter that would allow you to output the regions property container to a file, unfortunately. As a workaround to this limitation I can suggest you to convert the property container into a regular DataTable, which can then be exported to a text file (or a sequence of files when working with a trajectory) using OVITO's regular file export function (choose output format "Data Table Text File").

The conversion into a data table can be accomplished with the following Python script modifier function:

from import DataTable

def modify(frame, data):
    regions = data.surfaces['surface'].regions

    table = DataTable(identifier='regions', title='Volumetric regions')
    table.y = table.create_property('Volume', data=regions['Volume'])
    table.create_property('Filled', data=regions['Filled'])
    table.create_property('Surface Area', data=regions['Surface Area'])


After inserting this modifier function into the data pipeline (following the Construct Surface Mesh modifier) you should see a new data table named "Volumetric regions" in the data inspector.