Updating Polygon Selection Tag



  • Hi there, I'm writing a script in python & I wanted to ask how I can update a polygon selection tag (Exactly as if you call the 'Select' -> 'Set Selection' command with the polygon selection tag selected).

    Basically, I am Getting the C4d.BaseSelect from the c4d.SelectionTag & altering the C4d.BaseSelect - afterwards, I want to update the c4d.SelectionTag with the changes.

    Here is a very simplified sample code:

    curr_sel = sel_tag.GetBaseSelect()
    comp_sel = comp_tag.GetBaseSelect()
    curr_sel.DeselectFrom(comp_sel)

    Now I would like to write my modified curr_sel back to the sel_tag Polygon Selection Tag, but I don't know how.

    I am prepared to select it in the interface & use CallCommand as a last resort, but it's not very elegant & I won't be able to add undos.

    Thanks in advance for your help.



  • Hi there,

    since the docs say you get the selection instance by calling GetBaseSelect(), you simply can modify the BaseSelect and update the object accordingly.
    The BaseSelect itself comes with some useful functions, like CopyTo() that may do what you want.

    And may I to point you to: Q/A functionality and How to post questions. It makes life easier for all, if new threads and questions are tagged and organized in a nice way. :)



  • Firstly, thanks for your reply.
    Secondly, for the Q&A, it seems like the way the forum works has updated since I last used it. I will be sure to follow the correct protocol in future.

    Well, I just typed out a big answer & then I saw that you're right - the Polygon Selection Tags are already updated, without me having to do anything more !

    Is there some message I should send to the tags for safety, like a MSG_CHANGE from the c4dAtom ?



  • Hi @Graeme, thanks for reaching out us.

    With regard to your request, aside from the @mp5gosu notes I'd like to point you to this discussion where SelectionTag creation is presented.

    Feel free to come with any further consideration.

    Best, Riccardo


Log in to reply