Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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

    Selecting an Ngon

    SDK Help
    0
    4
    303
    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
      Helper
      last edited by

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

      On 17/11/2006 at 13:21, xxxxxxxx wrote:

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

      ---------
      Hi,
      Just a simple question, how do I select an ngon?
      I imagined it would be this

          
          
          
          
          LONG ngon_index=0; // the first ngon
          
          
          
          
          LONG polycount = op->GetPolygonCount();
          
          
          
          
          BaseSelect *select = op->GetPolygonS();
          
          
          
          
          select->Select(ngon_index+polycount);
          
          
          
          
          [CODE]
          
          
          
          
          but this doesnt seem to select anything in C4D
          
          
          
          
           
          
          
          
          
          Thanks
      
      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

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

        On 21/11/2006 at 18:52, xxxxxxxx wrote:

        To see the code's effect in workspace ...
        I use

        EventAdd(EVENT_FORCEREDRAW);

        Best regards ...
        Zaw Min Tun

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

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

          On 22/11/2006 at 06:30, xxxxxxxx wrote:

          Here is a code sample for a command plugin that selects all ngons:

            
          Bool MenuTest::Execute(BaseDocument *doc)  
          {  
               BaseObject *op = doc->GetActiveObject();  
               if(!op) return TRUE;  
               if (op->GetType()==Opolygon)  
               {  
                    PolygonObject *polyobj = ToPoly(op);  
                    BaseSelect *sel = polyobj->GetPolygonS();  
            
                    LONG ngoncount, *polymap = NULL;  
                    LONG **ngons = NULL;  
                    if(!polyobj->GetPolygonTranslationMap(ngoncount, polymap))  
                    {  
                         GeFree(polymap);  
                         return FALSE;  
                    }  
            
                    if(!polyobj->GetNGonTranslationMap(ngoncount, polymap, ngons))  
                    {  
                         GeFree(polymap);  
                         GeFree(ngons);  
                         return FALSE;  
                    }  
            
                    LONG ngoncnt = polyobj->GetNgonCount();  
                    LONG x;  
                    for(x=0; x<ngoncnt; i++)  
                    {  
                         LONG y;  
                         for(y=1; j<=ngons[x][0]; j++)  
                         {  
                              GePrint(LongToString(ngons[x][y]));  
                              sel->Select(ngons[x][y]);  
                         }  
                    }  
                    EventAdd();  
            
                    GeFree(ngons);  
                    GeFree(polymap);  
            
               }  
            
               return TRUE;  
          }  
          [CODE]  
            
          Basically you select the polygons within the ngons. You can get the polygon indices through GetPolygonTranslationMap and GetNgonTranslationMap.  
            
          hope this helps  
            
          cheers,  
          Matthias  
          
          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

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

            On 22/11/2006 at 11:58, xxxxxxxx wrote:

            Thank you Matthias,
            A couple of typos 😉 but it works great

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