//Macro script to find the X,Y,Z Block stock for all geometry in model mode. //This macro will find the extents in the top and right side view. //The dimesions are all based from the view coordinates
:Start //Define and clear all variables CLEAR PartX, PartY, PartZ CLEAR dModx, dModY, dModz CLEAR MinCoord, MaxCoord DOUBLE MinCoord[3], MaxCoord[3] DOUBLE dModx, dMody, dModz PartX = 0 PartY = 0 PartZ = 0
:Top // Model Mode extents of the top view GetModelExtents 1, MinCoord, MaxCoord dModX = (MaxCoord[0] - MinCoord[0]) dModY = (MaxCoord[1] - MinCoord[1])
:Right // Model Mode extents of the right side view GetModelExtents 5, MinCoord, MaxCoord dModY = (MaxCoord[0] - MinCoord[0]) dModZ = (MaxCoord[1] - MinCoord[1])
:Calculate // calculate the smallest to the largest size to make a logical note If ((dModX < dModY)&&(dModX < dModZ)) PartX = dModX If ((dModY < dModX)&&(dModY < dModZ)) PartX = dModY If ((dModZ < dModX)&&(dModZ < dModY)) PartX = dModZ If ((dModX > dModY)&&(dModX > dModZ)) PartZ = dModX If ((dModY > dModX)&&(dModY > dModZ)) PartZ = dModY If ((dModZ > dModX)&&(dModZ > dModY)) PartZ = dModZ If ((dModX > PartX)&&(dModX < PartZ)) PartY = dModX If ((dModY > PartX)&&(dModY < PartZ)) PartY = dModY If ((dModZ > PartX)&&(dModZ < PartZ)) PartY = dModZ
:MessageBox string $csText Sprint $csText, "Block Stock size is\n%.4f X %.4f X %.4f",PartX, PartY, PartZ MessageBox $csText, 0
:Done Maskclear Exit