getting data from histogram using python script.

Hi,

I have a openfoam simulation with lagrangian data. I need to count the number of particles in a zone. I have done this using sphere clip and histogram. The histogram produces one row with diameter and number of particles. Now I want to automate this process, as there are many regions.

I have created a script and ran it as macro.

writer = CreateWriter(‘data.csv’)
writer.UpdatePipeline() // result from 1st region
clip1.ClipType.Center = [0.2, 0.2, 0.36]
clip1.ClipType.Center = [0.2, 0.2, 0.36] //changing the clip location
barChartView1.Update()
writer.UpdatePipeline() // result from 2nd region

but the file has only the last result. I want the data to be appended to the same file row by row. Is there any other way.