I'm trying to activate a viewport using Jeremy's Keys on a sheet and I am able to do it while doing Debug Step-Through but for some reason, it doesn't work when live.
I've tried the following:
1) using a while loop to wait for the active view to be the viewport's view but it doesn't seem to fire.
2) putting it in a separate transaction
3) tried using System.Threading.Thread.Sleep(2000);
4) started looking into Async, await however I'm not that skilled with it yet.
Has anyone else come across this issue and found a solution?
My current Sudo code is similar to the title of the question.
draw a temporary line across viewport
doc.showElements(temporaryline)
delete temporary line
Select viewport
Press.Keys("AV")
(AV is my shortcut for activating a view when the viewport is selected)
I can upload actual code if needed
////////////////UPDATE///////////////// here is the culprit
//change views to sheet
uidoc.ShowElements(viewportElement);
//select viewport
uidoc.Selection.SetElementIds(elementIdsViewPort);
//activate viewport
Press.Keys("AV");