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
    • Recent
    • Tags
    • Users
    • Login

    Opolygon

    Scheduled Pinned Locked Moved SDK Help
    3 Posts 0 Posters 291 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 02/10/2008 at 02:32, xxxxxxxx wrote:

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

      ---------
      Hi,

      I am currently trying to construct an object from a plugin, having a list of points and vertices etc. I found the Modeling class in the SDK but I am guessing there must be a much simpler way to create a polygon object (points, vertices, faces) from C++?

      Sorry if this seems trivial...I couldn't find anything on this topic 😉

      Thanks

      Markus

      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 02/10/2008 at 07:37, xxxxxxxx wrote:

        Hi,

        if you want to do it by hand you have to alloc your poly object, then get the points and poly arrays, and fill them by hand.

        somewhat like this:

        > <code>
        > // create poly-object and init with point count and polycount
        > PolygonObject* polygon = PolygonObject::Alloc(ppCount,polyCount);
        > PointObject* point = ToPoint(polygon);                                                                                                                                                                
        >
        > // get points array
        > Vector* padr = point->GetPointW();
        > // get poly array
        > CPolygon* polys = polygon->GetPolygonW();
        >
        > // set points
        > for(int i=0;i<ppCount;i++){
        >      padr->x = polyPoints _.x;
        >      padr->y = polyPoints _.y;
        >      padr->z = polyPoints _.z;
        >         // inc point adress
        >      padr++;
        > }
        >
        > // set polys point indices
        > for(int p=0;p<polyCount;p++){
        >       polys->a = ..
        >       polys->b = ..
        >       polys->c = ..
        >       polys->d = ..     
        >       // inc poly adress               
        >       polys++;
        > }
        >
        > // add it to the document          
        > polygon->SetPhong(TRUE,FALSE,0);
        > polygon->InsertAfter(doc->GetActiveObject());
        > polygon->SetName("Polygon");
        > .
        > .
        > </code>

        maybe there's a better way to do this, but this works for me 😉

        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 02/10/2008 at 09:21, xxxxxxxx wrote:

          Many thanks, this exactly like what I was searching for 😉 Will try asap.

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