welcome to forum and I hope you had a interesting learning journey so far. But I would like to point out that "organiz[ing] what [...] took the most memory" is a not a trivial task in Cinema's Python, not to say an impossible one.
In C++ you have the function
sizeof, which you can use to measure the total size of an object and all its fields. The problem is when you have some form of linked data that this will obviously not be counted correctly. Which is why there is a special function in Cinema's internal API to measure the size of a
BaseObject and roughly everything that is attached to it - its matching dialog will tell you that that number is an approximation.
This function has not been exposed to the public C++ or Python API.
You can measure the size of objects (in the Pythonic sense) in Python itself with
sys.getsizeof, but you will measure here the size of the python object that is the binding to the C++ data structure magened by Cinema 4D. The Python API is basically just one giant remote control.
sys.getsizeof is in general a bit dicey, but for Cinema it is especially useless, e.g.:
vec = c4d.Vector(1, 2, 3)
# 40 <-- not the size of the vector, but of its Python wrapper.
node = c4d.PolygonObject(4, 4)
node.SetAllPoints([vec] * 4)
# 69,342,398,996,512 <-- c4dpy thinks this object node takes up 69 TB,
# which is rather unlikely ;)
if __name__ == '__main__':
- So the only way is to do it manually, like @m_magalhaes has shown it in his posting, by multiplying the vertices and polygons by what you know they will take up in space (e.g., 24 bytes for a 64bit three component vector). The problem is that this will only work for editable polygon/spline objects in this manner, not for procedural objects - which make up the bulk of data in Cinema 4D. You need also to take tracks (animations) and tags into account which can make up the vast majority of the data that makes up an "object" (in the sense of Cinema).
I do not want to to disencourage you, but I just wanted point out that this can be a bit steep hill to climb as a first project