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

    Size of Polygonselektion

    Scheduled Pinned Locked Moved SDK Help
    3 Posts 0 Posters 268 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 14/06/2011 at 08:18, xxxxxxxx wrote:

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

      ---------
      Hello Folks,
      I wrote a script to get the Size of a Pointselection. Now I want to do the Same thing for a Polyselection. I am stucked here. I hope someone can help me.

      Here is my approach to get x,y,z-dimensions of a Pointselection.

      var doc = GetActiveDocument();
      var obj = doc -> GetActiveObject();
        
      doc->StartUndo();
      doc->AddUndo(UNDO_OBJECT_BASEDATA, obj);
        
      var select = obj -> GetPointSelection();
      var i;
      var found = 0;
      var sum = 0;
      var minX=100000000, minY=100000000, minZ=1000000000;
      var maxX=0, maxY=0, maxZ=0;
        
        
      for (i = 0; i < obj -> GetPointCount(); i++){
       if (found >= select -> GetCount()) break;
       if (select -> IsSelected(i)){
       var temp = obj->GetPoint(i);
      if (temp.x>maxX)  maxX=temp.x;
      if (temp.x<=minX)  minX=temp.x;
        
      if (temp.y>maxY)  maxY=temp.y;
      if (temp.y<=minY)  minY=temp.y;
        
      if (temp.z>maxZ)  maxZ=temp.z;
      if (temp.z<=minZ)  minZ=temp.z;
        
      	found++;
       }
      }
        
      var sizeX=maxX-minX;
      var sizeY=maxY-minY;
      var sizeZ=maxZ-minZ;
        
        
      println("Size x:", sizeX);
      println("Size y:", sizeY);
      println("Size Z:", sizeZ);
        
      found = 0;
      
      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 16/06/2011 at 06:32, xxxxxxxx wrote:

        Basically you do the same as for point selections. You iterate through the selected polygons and use the point indices to obtain the point positions. Then you check for minima/maxima the same as for point selections.

        cheers,
        Matthias

        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 17/06/2011 at 01:03, xxxxxxxx wrote:

          Thanks for the respond. I got it work now.
          cheers, Holger

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