Skip to content

Instantly share code, notes, and snippets.

/maskVolume.py Secret

Created February 23, 2017 15:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/48328c1f5908ce954d368810d8a36eab to your computer and use it in GitHub Desktop.
Save anonymous/48328c1f5908ce954d368810d8a36eab to your computer and use it in GitHub Desktop.
def get_mask_volume():
temp_fn = os.path.join(app.GetUserTempDirectory("stats"), "data.csv")
doc.GeneratePreview()
doc.SetModelStatisticsTemplate("JustVolume", True)
doc.UpdateModelStatisticsData()
doc.ExportModelStatisticsData(temp_fn)
with open(temp_fn, 'rb') as csv_file:
reader = csv.reader(csv_file)
next(reader)
next(reader)
volume = float(next(reader)[0])
return volume
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment