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
    • Recent
    • Tags
    • Users
    • Login

    How to delete polygons?

    Scheduled Pinned Locked Moved PYTHON Development
    4 Posts 0 Posters 392 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 18/04/2014 at 14:42, xxxxxxxx wrote:

      I'm selecting random polygons from an object, depending on a percentage with this code:

      random.seed(rand)
      selection=op.GetPolygonS()
      selection.DeselectAll()
      pnum=op.GetPolygonCount()
      for i in range(pnum) :
          rnd1=random.random()
          if rnd1<kill:
              selection.Select(i)

      This part seems to be working fine.
      But when I call the delete command with

      c4d.CallCommand(12109)

      I get a crash!!
      So, how can I delete the selected polygons?
      Oh, the op object in not in the document. It is an object created inside my code.

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

        On 18/04/2014 at 15:04, xxxxxxxx wrote:

        Ok, nevermind... I just used the SendModelingCommand command to delete the polygons instead of the CallCommand and it worked fine.

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

          On 18/04/2014 at 15:08, xxxxxxxx wrote:

          You might have to use a temp doc in memory as a workshop area to construct and delete the polygons in your object.
          Then copy it to the active document and kill the temp doc when you're finished.

          -ScottA

          Oops..I wasn't fast enough. 🙂

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

            On 18/04/2014 at 15:34, xxxxxxxx wrote:

            Thank you, Scott.
            Your solution may come in handy for other types of things, though 🙂

            Rui Batista

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