Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Get a simple polygonal version of any object

    General Talk
    2
    4
    1.1k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      rui_mac
      last edited by rui_mac

      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?

      1 Reply Last reply Reply Quote 0
      • S
        s_bach
        last edited by

        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

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        1 Reply Last reply Reply Quote 0
        • R
          rui_mac
          last edited by

          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?

          1 Reply Last reply Reply Quote 1
          • S
            s_bach
            last edited by

            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

            MAXON SDK Specialist

            Development Blog, MAXON Registered Developer

            1 Reply Last reply Reply Quote 0
            • First post
              Last post