CurrentUIDocument ShowElements() not working in Legend View

CurrentUIDocument ShowElements() not working in Legend View

Sean_Page
Collaborator Collaborator
229 Views
1 Reply
Message 1 of 2

CurrentUIDocument ShowElements() not working in Legend View

Sean_Page
Collaborator
Collaborator

I am working on a feature that allows the User to select an item from a list and then Open the OwnerView and zoom to the element using ShowElements. I have done this for many things in the past, but there are items this time that are in legends.  When I attempt to use this on a Curve or Textbox placed in a Legend I get a popup: 'No Good view could be found'

Sean_Page_0-1734124088473.png

 

Short clip showing it working in a FloorPlan, but not Legend view type.

 

This is simplified python from Dynamo to show the issue in the video.

#Sean Page, 2024
import clr

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

clr.AddReference('System')
from System.Collections.Generic import List

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)

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

doc = DocumentManager.Instance.CurrentDBDocument
uiapp=DocumentManager.Instance.CurrentUIApplication
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

element = UnwrapElement(IN[0])

TransactionManager.Instance.EnsureInTransaction(doc)
TransactionManager.Instance.TransactionTaskDone()

OUT = DocumentManager.Instance.CurrentUIDocument.ShowElements(element.Id)

 

Is there something I am missing here? I also attempted to use ZoomAndCenteRectangle() but it would not Zoom, however it did at least center the item.

Sean Page, AIA, NCARB, LEED AP
Partner, Computational Designer, Architect
0 Likes
230 Views
1 Reply
Reply (1)
Message 2 of 2

harilalmnCBXDY
Enthusiast
Enthusiast

Check out;

  • Created Phase of the elements you are trying to show
  • View's Phase filter
  • View's Phase
  • Element category's visibility in the view (VG/VV)
0 Likes