Get a simple polygonal version of any object



  • I can easily get a polygonal version of any simple object with SendModelingCommand and getting the CSTO of it. Or even using the GetDeformCache of the object.
    But, if I start with a complex object, like the Figure, or a Extrude, or a Array, or an Atom Array, or a Cloner, etc... I get a hierarchy.
    Is there any way to start with any type of primitive and get a simple polygonal object with ALL the parts, connected into a single mesh?
    Also, the same for a spline, so that, for example, a set of spline placed inside a Array would result in a single, multi-segment, spline?



  • Hello,

    there is no simple function that returns the merged result of all objects from a generator's cache.

    You simply have to get the meshes from the cache and merge them into a single mesh yourself. And, of course, also merge normals, UVs etc. as needed.

    best wishes,
    Sebastian



  • The "solution" I came up with was this:

    	doc=op.GetDocument()
    	doc2=c4d.documents.IsolateObjects(doc,[op])
    	doc3=doc2.Polygonize(False)
    

    and then go through all the objects of doc2, recursively.
    Is this a correct way of doing things?



  • Hello,

    Polygonize() is just using SendModelingCommand() with MCOMMAND_CURRENTSTATETOOBJECT. You can actually see the C++ source in c4d_basedocument.cpp in the cinema.framework. But I don't think that this commands merges all objects into one polygon object.

    best wishes,
    Sebastian