Size of Polygonselektion
-
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;
-
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 -
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