Get Point Selection?



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

    On 26/12/2008 at 15:12, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   10.1 
    Platform:   Windows  ; Mac  ;  
    Language(s) :     C++  ;

    ---------
    Hi,

    I want to get the selected points from a point selection tag attached to a polygon object. I see there is a SelectionTag, and I can get a BaseSelect from it, but I don't quite understand how to get to the selected points.

    Is there any example code?

    Greetings & Thanks in advance,
    Jack



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

    On 26/12/2008 at 18:04, xxxxxxxx wrote:

    Point and Polygon selections work identically. They contain the same number of elements as the PointCount and PolyCount of the object and the value at the index is 1 if selected, 0 if not (via IsSelected()). Or you just use the segments (which only return groups of selected elements). So, to get the selected points, you will need the point Vector array (GetPoint()) and the Point selection tag's BaseSelect in unison.



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

    On 27/12/2008 at 02:04, xxxxxxxx wrote:

    Ah, OK. That sounds easy :-)
    Thanks Robert!

    Greetings,
    Jack



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

    On 27/12/2008 at 12:33, xxxxxxxx wrote:

    Like so:

        
        
          
            LONG ndx, seg = 0, smin, smax;  
            Vector *pPoints = pPolyObj->GetPointW();  
            BaseSelect *pBaseSelect = pPolyObj->GetPointS();  
            while( pBaseSelect->GetRange(seg++,&smin,&smax) )  
            {  
                for( ndx=smin; ndx<=smax; ndx++ )  
                {  
                    GePrint("Point: "+LongToString(ndx)+" is selected");  
                }  
            }
        
        
        
    

    ... that itterates over the segments.



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

    On 28/12/2008 at 08:41, xxxxxxxx wrote:

    That gets the actively selected points on the object but to get the selection in a selection tag, it is slightly different (thankfully, one doesn't need to use SendModelingCommand() in a circuitous way) :

    > Vector\* pPoints = pPolyObj->GetPointW(); \> if (!pPoints) //... \> BaseSelect\* pSelect = pSTag->GetBaseSelect(); \> if (!pSelect) // ... \> LONG a, b, c; \> for (LONG seg = 0L; pSelect->GetRange(seg,&a;,&b;); ++seg) \> { \>      for (c = a; c <= b; ++c) \>      { \>           GePrint("Point selected: "+LongToString(c)); \>      } \> } \>


Log in to reply