I have a routine I use for centering an arbitrary number of lines of text within a defined area. I use it mostly to clean up equipment schedules. The routine takes the insertion point of a selected text entity, uses the BOUNDARY command to create a bounding box of the geometry surrounding the text, gets all text entities inside or crossing the boundary, then does the centering. The problem comes when the geometry doesn't produce a closed area. The gaps tend to be small -- usually an interior line in the schedule doesn't quite touch one of the outside lines (at 'T' intersections). It's the same problem as having a hatch leak through a small gap. We run 2004 by choice. I've tried the "new and improved" boundary function in 2007, but it doesn't do any better at the "unclosed T" intersections than the function in 2004.i
So, I'm looking for ideas on how to reliably create a closed boundary based on a point picked within the boundary. Having to manually select the entities that comprise the boundary isn't viable -- the intent of the routine is to be able to align an entire schedule by selecting the text with a crossing window, and it would be faster to redraw the table than to select the bounds for each cell.
For locating gaps I've looked at gap.lsp from McNeel, modified by J. Tippit, but it doesn't check for 'T' intersections, which is where the problem tends to be. I've considered GBPOLY and similar programs, but they seem to be far more than is needed here, plus I'd have to buy a copy for each workstation here and the ROI for that doesn't work for us (we do building electrical and don't do boundaries much except in this routine). In either case there's the issue of determining what entities comprise the boundary.
Any thoughts or suggestions would be appreciated.
Martin