Hi ..to 'properly' access geometric values such as 'geometry.area()', we have some operations, but that list could be extended forever.CGA is at the moment, as you state correctly, limited to the top-down order. Thus, if you e.g. split a shape into 2 separate child shapes, they have no more knowledge of the existence of the each other. An other thing, if you split a shape, it may happen that depending on the topology of a shapes, 2, 3 or more children are created (concave shape). How many will be resulting is not possible to query prior to actually splitting.the scope always encompasses the whole shape geometry, thus the edge length is only then correct if it's a planar rectangle you're dealing with. otherwise, you need a different approach, if this is the goal.Here's the code to find the longest edge : Again, this is total overkill and shall not be a sample of proper code !What I do here is do some vector math, calculating the distanced from 1 reported vertex position to the next, comparing the index of the longest edge until the recursion is done.version "2011.2"
@Hidden
attr currentLongestEdgeID = 0
@Hidden
attr currentLongestEdgeLength = 0
@Hidden
attr startPivotPosX = 0
@Hidden
attr startPivotPosY = 0
@Hidden
attr startPivotPosZ = 0
@Hidden
attr endPivotPosX = 0
@Hidden
attr endPivotPosY = 0
@Hidden
attr endPivotPosZ = 0
dist (sX, sY, sZ, eX, eY, eZ) =
# space diagonal
sqrt ( (eX-sX) * (eX-sX) + (eY-sY) * (eY-sY) + (eZ-sZ) * (eZ-sZ) )
FindEdgeIndexOfLongestEdge -->
# align to edge BEFORE first edge
alignScopeToGeometry(yUp, 0, geometry.nVertices)
# set first END point
set (endPivotPosX, convert(x,pivot,world,pos,0,0,0))
set (endPivotPosY, convert(y,pivot,world,pos,0,0,0))
set (endPivotPosZ, convert(z,pivot,world,pos,0,0,0))
EdgeRecursion(0, geometry.nVertices) # check all edges !
EdgeRecursion (current, max) -->
case current <= max :
# main loop over all edge indices
alignScopeToGeometry(yUp, 0, current)
# print (current)
# print (scope.sx)
# new start = old end
set (startPivotPosX, endPivotPosX)
set (startPivotPosY, endPivotPosY)
set (startPivotPosZ, endPivotPosZ)
# new end
set (endPivotPosX, convert(x,pivot,world,pos,0,0,0))
set (endPivotPosY, convert(y,pivot,world,pos,0,0,0))
set (endPivotPosZ, convert(z,pivot,world,pos,0,0,0))
SetAttributes(current, max)
NIL
else :
#bail out
print ("________________________")
print (currentLongestEdgeID)
print (currentLongestEdgeLength)
NIL
SetAttributes (current, max) -->
case dist (startPivotPosX,startPivotPosY,startPivotPosZ,endPivotPosX,endPivotPosY,endPivotPosZ) > currentLongestEdgeLength :
set (currentLongestEdgeLength, dist (startPivotPosX,startPivotPosY,startPivotPosZ,endPivotPosX,endPivotPosY,endPivotPosZ))
set (currentLongestEdgeID, current - 1) # -1 because we calculate a first edge for the correct vector of the first edge !
EdgeRecursion(current + 1, max)
else :
EdgeRecursion(current + 1, max)