Hello @ferdinand ,
First of all thanks a lot for your answer, it does exactly what I was trying to achieve, print the names of the volume grids stored on a Volume Loader with Python, I just added the GetName() on the last loop for that.
Sorry about the rule violation, I thought it was a good idea to have the C++ and the Python code equivalent at the same place because of the same reason that you mentioned, if someone was looking for doing this they could find both versions at the same place, also as you mentioned, sometimes it can be tricky to decide when something is on-topic or not.
Here is the updated code with the grid name:
"""Demonstrates accessing volume caches. Volumes are composed differently based on part of application using them but this script demonstrates how most of them can be accessed. """ import c4d doc: c4d.documents.BaseDocument # The active document op: c4d.BaseObject | None # The active object, None if unselected def main() -> None: """ """ if not op: return # Volume output is contained in the caches of objects. In this case an Ovolume is directly # the cache content of some tangible scene object. cache: c4d.BaseObject = op.GetCache() if cache.CheckType(c4d.Ovolume): print (f"{cache = }") # Sometimes, e.g., Pyro, volumes are loaded from VDB files on disk, in that case the loading # tangible scene object usually holds a Ovolumeloader as the first child of its cache. if cache.CheckType(c4d.Ovolumeloader): cache = cache.GetCache() # Many things contain not only a singular volume but sets of them. Which then hold their content # as children. Stuff can get more complex as always the case with caches in Cinema 4D, but the # cache structure of a Pyro Output object loading data from disk could look like this: # # PyroOutput # Cache: Ovolumeloader # Cache: Ovolumeset # Child: Ovolume (Color) # Child: Ovolume (Density) # ... if cache.CheckType(c4d.Ovolumeset): cache = cache.GetCache() for item in cache.GetChildren(): print (f"{item = }") print ("grid name = " + item.GetName()) if __name__ == '__main__': main()