Set newly created sheet view active

I have a script that duplicates the current sheet and I’d like to have it opened at the end of the script.

I found this (Changing active view is tempoerarily disabled?) but get this error when I put a sheet view into the python code.

Thoughts?

Interesting. The post you linked uses the UIdoc but I use the UIapp. (See post here.)
image
Can you post your code so we can see exactly what’s going on? I’d also try using the code I provided in the link and see if that makes a difference.

Edit: Just noticed that I do get the current doc for setting the active view. I’m guessing it’s something in your code.

I used the code @Thomas_Mahon provided in that link.

#Copyright 2016. All rights reserved. Bimorph Consultancy LTD, 5 St Johns Lane, London EC1M 4BH www.bimorph.co.uk
#Written by Thomas Mahon @Thomas__Mahon info@bimorph.co.uk Package: bimorphNodes
#GitHub: https://github.com/ThomasMahon/bimorphNodes/
#Follow: facebook.com/bimorphBIM | linkedin.com/company/bimorph-bim | @bimorphBIM

import clr

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

doc = DocumentManager.Instance.CurrentDBDocument
uidoc = DocumentManager.Instance.CurrentUIDocument

TransactionManager.Instance.EnsureInTransaction(doc)
TransactionManager.Instance.ForceCloseTransaction()

#view = UnwrapElement(IN[0])
view = IN[0]
uidoc.RequestViewChange(view)

You haven’t unwrapped your sheet. It’s expecting a Revit view and you’re currently providing a Dynamo sheet.

Oh, I forgot to revert back to the old code before I posted that. It didn’t work with the previous line uncommented either.

The code you provided in your post worked great… just needed to end a transaction first!

Weird. The code from Thomas’s post worked for me. Not sure why it was giving you trouble.

I’m sure it’s user error. LOL

I figured it had something to do with a View vs a Sheet (even though they’re both Views)…