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

    How to Activate Polygon Selection in the Selection Filter

    Cinema 4D SDK
    2024 python
    2
    3
    352
    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.
    • S
      seora
      last edited by

      Hi, I was wondering if there is any code related to the selection filter in the c4d python SDK. Specifically, I would like to create a script that ensures only polygons are active in the selection filter.

      Could you provide any relevant information or examples that could help with this?

      195845c5-a7ea-4b99-9f87-547eaa61e28d-image.png

      ferdinandF 1 Reply Last reply Reply Quote 0
      • ferdinandF
        ferdinand @seora
        last edited by ferdinand

        Hey @seora,

        Thank you for reaching out to us. Selection filter modes are just commands. Since there is no GUI involved with most of them, you can just 'record' your actions with the script log and then 'play' that back. Just to be clear, you can also invoke commands that entail GUI, e.g., the "Selector .." command, but you cannot automate that GUI (as GUIs are generally not exposed in the API).

        e27953f9-0c1c-4dce-a1bb-b4d643aebacf-image.png

        """A simple script that disables all selection filters, and then just enables the polygons filter.
        """
        from typing import Optional
        import c4d
        
        doc: c4d.documents.BaseDocument # The active document
        op: Optional[c4d.BaseObject] # The active object, None if unselected
        
        def main() -> None:
            """Called by Cinema 4D when the script is executed.
            """
            c4d.CallCommand(69000, 902) # Set selection filter to None.
            c4d.CallCommand(69000, 904) # Enable Polygon filter.
        
        if __name__ == '__main__':
            main()
            c4d.EventAdd()
        

        Cheers,
        Ferdinand

        MAXON SDK Specialist
        developers.maxon.net

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

          @ferdinand Your response was helpful. Thank you:)

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