How to add selection to selection Tag

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 08/11/2010 at 23:28, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   R12 
Platform:      
Language(s) :       PYTHON  ;

---------
Hi,

how can I add data (list of polygons) to SelectionTag that I just created?

thank you very much in advance
Andrzej

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 09/11/2010 at 02:28, xxxxxxxx wrote:

Hi Andrzej,

each PolygonObject has a selection tag from scratch. Just return the selection object via op.GetPolygonS().
For sure, you can also use BaseSelect.CopyTo to transfer the selection information.

Cheers, Sebastian

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 09/11/2010 at 03:14, xxxxxxxx wrote:

Thank you very much, Sebastian! I didn't notice that it is "build-in". (There's question how to create several selection tags and and data to them, but I don't need it right now...)

Thank you one more time
Andrzej

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 09/11/2010 at 04:28, xxxxxxxx wrote:

I'm afraid it doesn't work for me. I don't know how to add some polygons (for example: 5, 10, 25, 30) to selection and write them do selectionTag. May I ask for help?

thanks
Andrzej

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 09/11/2010 at 04:50, xxxxxxxx wrote:

Can you post some lines of code? Then we can figure out whats missing.

Cheers, Sebastian

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 09/11/2010 at 05:03, xxxxxxxx wrote:

I found something that works:

  
tag = polyObj.MakeTag(Tpolygonselection)   
bs = tag.GetBaseSelect()   
# bs.SelectAll(0, polyObj.GetPolygonCount() - 1) # it doesn't work...  
  
bs.SetAll([1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1]) # this one works, and selects polygons 0-3 and 8-11  

Andrzej

PS I'm a begginer for python, so maybe I'm making some terrible mistakes... 🙂

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 09/11/2010 at 05:20, xxxxxxxx wrote:

After you changed the selection, please send an update message to the polygon object.

polyObj.Message(c4d.MSG_UPDATE)

Cheers, Sebastian

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 09/11/2010 at 05:41, xxxxxxxx wrote:

I change lines to:

  
tag = polyObj.MakeTag(Tpolygonselection)   
bs = tag.GetBaseSelect()   
bs.SelectAll(0, 10)  
  
polyObj.Message(MSG_UPDATE)   
print bs.GetCount() # it returns: -9 (???)  

And still nothing. After making editable selectionTag is empty.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 09/11/2010 at 05:56, xxxxxxxx wrote:

tag = polyObj.MakeTag(Tpolygonselection) #wrong, here you create a new tag

  


bs = polyObj.GetPolygonS() #correct, returns the already built-in polygon base selection

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 09/11/2010 at 06:26, xxxxxxxx wrote:

print polyObj.GetPolygonCount()  # returns "84"
bs = polyObj.GetPolygonS()
bs.SelectAll(0,10)
polyObj.Message(MSG_UPDATE)
print bs.GetCount() # still returns "-9"

Now after deleting: "tag = polyObj.MakeTag(Tpolygonselection)" there's no selectionTag after making object editable.

Andrzej

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 09/11/2010 at 06:50, xxxxxxxx wrote:

I can confirm SelectAll seems to work not properly, but here is a code snippet which does
exactly the same and should work fine:

    bs = polyObj.GetPolygonS() 
    for x in xrange(0, 10) :
        bs.Select(x) 
    polyObj.Message(c4d.MSG_UPDATE)
    c4d.EventAdd()

Cheers, Sebastian

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 09/11/2010 at 07:07, xxxxxxxx wrote:

Yes, now it works! It doesn't create selectionTag after making editable, but GetCount return proper value ("10") and GetAll() return correct list. (By the way it seems like GetAll() need some "max" parameter - which (I guess) is max number of elements in returned list)

Thank you very much for your time and patience
Andrzej