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
    • Unread
    • Recent
    • Tags
    • Users
    • Login
    1. Maxon Developers Forum
    2. filsdegraphiste
    3. Posts
    F
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 3
    • Best 0
    • Controversial 0
    • Groups 0

    Posts made by filsdegraphiste

    • RE: Create dynamic selection tag for voronoi fracture polygon index

      Hello @i_mazlov!

      Thank you so much for your fast and thoughtful answer, I'm sorry if I didn't post to the right place or in the right form. I'm going to read the rules of the forum more.
      I'm more a designer than a developer but I understand the solution path you provided to me and I truly appreciate it! Do you know anything about the CV-parametric selection tag from Cineversity?

      posted in General Talk
      F
      filsdegraphiste
    • RE: Create dynamic selection tag for voronoi fracture polygon index

      I actually found something that would help me A LOT but I can't find it anywhere online! what I described is what is possible with this python script:
      CV-Parametric Selection Tag for Cinema 4D from Cineversity! I tried to find it but it's impossible to get my hand on it! can someone help please!

      posted in General Talk
      F
      filsdegraphiste
    • Create dynamic selection tag for voronoi fracture polygon index

      So... I have a little problem, I have made a grid of objects made with Voronoi Fracture, and I'm trying to assign a material to each individual polygon from the fracture object. I can't see a way to assign a material based on the number index of a cloner/fracture object/voronoi object or create a list of selection tag on the voronoi fracture...
      I wish that the index number could be a variable that we could use as a selection or tag! If anyone has an idea of how to tackle this issue, I would love to hear you out, this is what I have so far:

      import c4d
      def main():
          # Get the active object, which should be a Voronoi Fracture object
          fracture_obj = doc.GetActiveObject()
          # Check if the object is a Voronoi Fracture object
          if fracture_obj is None or not fracture_obj.CheckType(c4d.Ofracture):
              raise RuntimeError("Please select a Voronoi Fracture object.")
          # Access the children of the Voronoi Fracture object (these are the fractured pieces)
          fracture_pieces = fracture_obj.GetChildren()
          # Ensure there are fracture pieces
          if not fracture_pieces:
              raise RuntimeError("No fracture pieces found. Please ensure the Voronoi Fracture is applied to an object.")
          # Loop through each fracture piece
          for i, piece in enumerate(fracture_pieces):
              # Create a unique polygon selection tag for each piece
              selection_tag = piece.MakeTag(c4d.Tpolygonselection)
              selection_tag.SetName(f"Piece_{i}_Selection")
              # Select all polygons of this fracture piece
              poly_selection = c4d.BaseSelect()
              poly_count = piece.GetPolygonCount()
              for poly_index in range(poly_count):
                  poly_selection.Select(poly_index)
              # Assign the selection to the tag
              selection_tag.SetBaseSelect(poly_selection)
          # Refresh the scene to apply the changes
          c4d.EventAdd()
      # Execute the script
      if __name__ == '__main__':```
      posted in General Talk programming
      F
      filsdegraphiste