Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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

    Execute Cinema4D commands through script

    Scheduled Pinned Locked Moved PYTHON Development
    5 Posts 0 Posters 786 Views
    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.
    • H Offline
      Helper
      last edited by

      On 07/08/2017 at 13:27, xxxxxxxx wrote:

      I created an importer which imports a whole bunch of objects (~20'000) into a scene. I already avoided creating any duplicate objects (by automatically replacing them with instances), but since some geometrically different objects still share a common material, I end up with a few (~30%) duplicate materials (can't avoid that since it's an OBJ import with MTLs).

      After the import, I want my script to automatically do the two steps I currently do "by hand", namely execute the two commands "Remove Duplicate Materials" and "Remove Unused Materials".

      Is there an easy way to do that or do I have to "recreate" those two functions in my script?

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 07/08/2017 at 13:55, xxxxxxxx wrote:

        Nevermind, figured it out through a convoluted search:

        c4d.CallCommand(12211) # Remove Duplicate Materials
        c4d.CallCommand(12168) # Remove Unused Materials

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 07/08/2017 at 16:33, xxxxxxxx wrote:

          You don't really need a convoluted search. Simply open the Customize Commands dialog and select the command you need the ID for. Then this ID will be shown in the lower right corner with the other buttons.

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            On 08/08/2017 at 01:48, xxxxxxxx wrote:

            Another option would be to open the "Script Log" from "Script" menu. Then simply execute the needed commands and get the code lines from the log.

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              On 08/08/2017 at 02:07, xxxxxxxx wrote:

              The convoluted search was finding those two answers :).

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