Hi James,
I think your air-tightness and performance issues can all be mitigated.
Do it all within one transaction, make the strings unique, and make your string longer...you need to allow for wordwrap too. (Adding spaces to the test string will help wordwrap; best to avoid them.)
Quasi-code in VB.NET:
dim currOutlineDict as new Dictionary(of Viewport, Double)
Using trans as new Transaction(doc,"Temp Trans")
trans.start
For each viewport as ViewPort in Viewports
dim failViewports as new list (of viewport)
Dim curOutline =...
currOutlineDict.Add(Viewport, curOutline)
'Set viewport text here.
dim str100 as string= "WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW" ' The letter W is wide. 😉
vp.Set(str100 +viewport.Id.tostring() + str100)
next
doc.regenerate
For each viewport as ViewPort in Viewports
Dim newOutline =...
Dim currOutline= currOutlineDict.item(viewport)
If currOutline = newOutline then 'Introduce FUZZ check here
failViewports.add(viewport)
end if
next
trans.rollback
end using
return failViewports
Cheers,
-Matt
_______________________________________________________________________________
Marking a post as a 'solution' helps the community. Giving a post 'Kudos' is as good as saying thanks. Why not do both?