Looking for a way to open a view before running the rest of the definition. This way i can view what is going on in that view.
I’ve gotten around this in the past by using stuff on the active view only, or putting in a "is active view 3D (or whatever) and popping a message asking them to set the view to the correct type if not.
I think I actually just figured this out…
import clr clr.AddReference("RevitNodes") import Revit clr.ImportExtensions(Revit.GeometryConversion) from Revit.Elements import * clr.AddReference('System') from System.Collections.Generic import * clr.AddReference('RevitAPI') from Autodesk.Revit.DB import * clr.AddReference('RevitServices') import RevitServices from RevitServices.Persistence import DocumentManager from RevitServices.Transactions import TransactionManager doc = DocumentManager.Instance.CurrentDBDocument uiapp = DocumentManager.Instance.CurrentUIApplication app = uiapp.Application #The inputs to this node will be stored as a list in the IN variables. dataEnteringNode = IN myView = UnwrapElement(IN) uiapp.ActiveUIDocument.RequestViewChange(myView) #Assign your output to the OUT variable. OUT = "ActiveView set to: " + myView.Name
Can you show an example of yours working? I cant get it to work on a newly created Drafting view that was just created by Dynamo. I can get it to work with the get current view node.
If you’re creating the view in the same graph you’ll have to put a Transaction.End node between your newly created view and the python node.
OK,Set Active View.dyn (15.1 KB)
I had bake with a Passthrough instead of Transaction end. Still not working, here is my definition.
Can you show a preview of your whole graph? I don’t have a few of those nodes so I’m not sure what they’re doing.
Edit: I think you’re taking an extra step. DraftingView.ByName outputs the view you just created. There’s no need to create the view then get the view with its name. Just take the Transaction.End output directly to the Python node.
Either way, the issue is because you’re sending a list to the Python node when it expects a singleton.