How to delete polygons?

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.

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.

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. :slightly_smiling_face:

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