Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Pointcount of TpolySelection?

    Scheduled Pinned Locked Moved SDK Help
    5 Posts 0 Posters 418 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

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

      On 10/02/2012 at 01:55, xxxxxxxx wrote:

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

      ---------
      Hi,
      I am trying to get the pointscount of a polygonselection, which is stored in a polygonselectionTag.
      I tried

      int points = op->GetTagDataCount(Tpoint);
      

      before that i set the selection tag as active. All i get is the full amount of points from the Object. If i use a Cube it gives me 8 Points becuase a Cube got only 8. But the right value would be 4 if i've selected only one face.
      I need the pointcount to set a weightmap. If I am not mistaken i can make weightmap for my joints with the function "setWeightMap(Joint_index,map(float number),Pointcount)
      So the Question is do I have to use this way:

      BaseDocument *doc = GetActiveDocument();
          BaseObject *obj = doc->GetActiveObject();   
          PolygonObject *pobj = ToPoly(obj);        
        
          AutoAlloc<SelectionTag> st(Tpolygonselection); 
        
         
        if(newpolytag->GetType() &Tpolygonselection)
          {
            BaseSelect *select= static_cast<SelectionTag*>(newpolytag)->GetBaseSelect(); 
            sel->CopyTo(select);      
          }
      LONG count = pobj->GetPolygonCount(); 
      

      To work my way through the number of points? Or is there an easier way, to get the points amount of the selection?

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

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

        On 10/02/2012 at 04:32, xxxxxxxx wrote:

        You need to convert your polygon selection into a point selection. Take a look at the SelectionChanger class.

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

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

          On 10/02/2012 at 04:59, xxxxxxxx wrote:

          hm ok since this only converts it into a pointselection. So I've to convert it afterwards into a pointObject. And then get the pointscount();

          The other thing what make me wonder is how to set the weight map on those points in the pointselection area.

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

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

            On 10/02/2012 at 05:52, xxxxxxxx wrote:

            Once you've got the point selection

            I think you can do the rest by

            count = obj.GetPointS().GetCount()

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

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

              On 10/02/2012 at 05:58, xxxxxxxx wrote:

              Originally posted by xxxxxxxx

              hm ok since this only converts it into a pointselection. So I've to convert it afterwards into a pointObject. And then get the pointscount();

              Once you have a BaseSelect returned by the SelectionChanger, just do BaseSelect::GetCount(). To access those points, of course you will need to get the object's points array. You can use:

                
              Vector *padr = ToPoint(yourobject)->GetPointR();   
              

              The SDK docs for BaseSelect shows you how to get the selected points (look for BaseSelect::IsSelected())

              Steve

              1 Reply Last reply Reply Quote 0
              • First post
                Last post