data from Polygon Selection tag



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

    On 13/02/2011 at 12:42, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   12 
    Platform:      Mac OSX  ; 
    Language(s) :   C.O.F.F.E.E  ;

    ---------
    language : c.o.f.f.e.e
    Hi,
    I would need to get the content (index list) from a Polygon Selection tag.
    Then, i must send it to an second tag.
    Also, this second tag should add all selections sent by the first tag to get the total of it all.
    Any help would be really appreciated.
    Thanks a lot.
    Jean



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

    On 13/02/2011 at 14:30, xxxxxxxx wrote:

    There is Function called "GetSelection();" for Selectiontags. It returns a BaseSelect Object. You can add a polygon to the selection with "Select(i);".
    Also you can get the active selection with "op->GetActiveSelection();" or simething like this. It is documented in the sdk. ;-)

    cheers, nux



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

    On 13/02/2011 at 18:51, xxxxxxxx wrote:

    Thanks for the reply nux,

    Once you've got the selection, what is the way to send it to the other tag?

    Jean



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

    On 13/02/2011 at 21:51, xxxxxxxx wrote:

    If you want just a cop of it, you can use "GetClone();" . It's a function in the BaseList2D Class ehich contains all Objects in c4d. Very useful. It *MUST* be used if you want to copy a tag for example. If you Insert an existing tag like this, c4d will crash.

    var tag = op->GetFirstTag();   
    op = op->GetNext();   
    op->InsertTag(tag,null);   
    

    But you want to extend the selection, ao do it something like this:

    var ps = op->GetActiveTag();   
    var bs = ps->GetSelection();   
    bs->Select(5); //Selects the element with Index 5   
      
    var ps2 = AllocTag(Tpolygonselection);   
    ps2->SetSelection(bs);   
    op->InsertTag(ps2,null);   
    

    I am sorry if there is an syntax error for example, im writing on a mobile deviceo right now. But you should get how it works.



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

    On 14/02/2011 at 11:15, xxxxxxxx wrote:

    Thanks nux,
    I'm getting on the way of doing what i want.
    One thing still missing.
    First, let's say that my second tag already exist, so there's no need to create one.
    Now, the only thing missing is to find a way to add new selection to the ones that already exist.
    I'm not sure that Select(i) is helping me  doing it, or may be i just don't know how to use it.
    What i understand about it is that it gives you the opportunity to select polygon or polygons (using i.e. SelectAll(0,4)).
    I always need any new polygons selection to de added to precedent selections.
    So, at this point i'm able to get the polygon(s) selection and "pass" it to the second tag, but unable  to add new selection and keeping what is already selected.
    I hope i'm clear enough.
    Really thanks again for helping.
    Jean



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

    On 14/02/2011 at 14:32, xxxxxxxx wrote:

    Mhm, not sure i I understand you right.
    You want to add an existing Selection to the Selectiontag, and already selected polygona should not be deselected ?
    That would be no problem. With "Select(i);" or "SelectAll(min,max);" the Polygons will only be selected, never deselected. For theese cases there are functions like "Deselect(i);" and "Toggle(i);".

    I'm still on a mobile device, Sorry for any Syntax error and mistake  again.
    An example of how to merge an selectiontag to another:

      
    var doc = GetActiveDocument();   
    var op = doc->GetActiveObject();  //an Object with only 2 Polygonselectiontags   
    var ps1 = op->GetFirstTag();   
    var ps2 = ps1->GetNext();   
    var sel1 = ps1->GetSelection();   
    var sel2 = ps2->GetSelection();   
    var polycnt = op->GetPolygonCount();   
    var i;   
      
    for(i=0; i<polycnt; i++) {   
      if(sel1->IsSelected(i) == true) {   
        sel2->Select(i);   
      }   
    }   
    ps2->SetSelection(sel2);   
    

    I hope this is kind of what you want to do. If you have any questions, just ask.
    Cheerio, nux



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

    On 14/02/2011 at 18:11, xxxxxxxx wrote:

    Hi nux,
    It just worked.
    Seriously, thanks a lot!!!!
    Jean


Log in to reply