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

    Create Polygon Selection Tag

    Cinema 4D SDK
    python
    2
    5
    952
    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.
    • D
      Djoneeeee
      last edited by

      Hello, guys!
      i have some list of polygons [1, 4, 5] and i need to put these selected values from object in polygon Selection tag (PST), in command lines PST have only commnd GetBaseSelect i need in command like SetBaseSelect

      theObject = doc.GetActiveObjects
      polySelection = theObject.GetPolygonS()
      polySelection.DeselectAll() 
      xmlPolygons = [1, 4, 5]
      for xmlPoly in xmlPolygons:
          thePoly = int(xmlPoly) - 1
          polySelection.Select(thePoly)
      
      ???????????????
      
      
      ferdinandF 1 Reply Last reply Reply Quote 0
      • ferdinandF
        ferdinand @Djoneeeee
        last edited by

        Hello @djoneeeee,

        thank you for reaching out to us. You must instantiate a c4d.SelectionTag and then write that polygon information into it. We have recently provided this example for a point selection tag, your case is almost identical, but you want to create and write to a c4d.Tpolygonselection instead.

        Cheers,
        Ferdinand

        MAXON SDK Specialist
        developers.maxon.net

        D 2 Replies Last reply Reply Quote 0
        • D
          Djoneeeee @ferdinand
          last edited by

          @ferdinand hi, thanks for the answer, but I don't understand how this example can help me write polygons to the tag.

          I need to select the polygons of the object from the list of polygons and write these polygons to the tag

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

            Well,

            The example shows you how to do it. The essential information you are likely missing here is that you do not require a SetBaseSelect. When you modify the selection returned by SelectionTag.GetBaseSelect, this will already be reflected in the tag, as the C++ backend method returns a reference/pointer to the selection, not a copy of it.

            When you run the script in the quoted topic, you will see that it will create and modify a point selection tag. The only translation work you must do is applying the example to polygons and alter the way the elements are selected, as the example selects them randomly, while you want to use a predefined list.

            Cheers,
            Ferdinand

            MAXON SDK Specialist
            developers.maxon.net

            1 Reply Last reply Reply Quote 0
            • D
              Djoneeeee @ferdinand
              last edited by

              @ferdinand aaaa i understood, thanks for help megaman)

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