function getSupportedBricks(%brick)
{
   %ss = new simSet();
   for(%i=0; %i<%brick.getNumUpBricks();%i++)
      %ss.add(%brick.getUpBrick(%i));
   %brick.setName(oldBrick);
   %newbrick = new fxDTSBrick(newBrick:oldBrick);
   %newbrick.setName();
   %brick.getGroup().add(%newbrick);
   %brick.delete();
   %supportBricksSet = new simSet();
   for(%i=0; %i<%ss.getCount(); %i++)
   {
      if(!%ss.getObject(%i).hasPathToGround())
         %supportBricksSet.add(%ss.getObject(%i));
   }
   %ss.delete();
   %newbrick.plant();
   %newbrick.setTrusted(1);
   return %supportBricksSet;
}
This should return a group containing bricks that are supported by provided brick. This will, however, clear the events on the brick. There are ways around that, I was just too lazy to put it in.