I would like to know how to select a linked room in the floor plan view.
I also want to be able to handle it like Select Model Elements using Dynamo Player.
Any solutions?
Hello
here an alternative with Revit API (Room’s Category must be visible in Visibility Graphics)
import sys
import clr
import System
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Architecture import *
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *
from Autodesk.Revit.UI.Selection import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
uidoc = uiapp.ActiveUIDocument
class CustomLinkRoomSelection(ISelectionFilter):
def AllowElement(self, e):
return True
def AllowReference(self, refer, point):
rvtlnkInstance = doc.GetElement(refer)
docLink = rvtlnkInstance.GetLinkDocument()
elemLink = docLink.GetElement(refer.LinkedElementId)
if elemLink.Category.Id.IntegerValue == BuiltInCategory.OST_Rooms.value__ :
return True
else:
return False
TaskDialog.Show('Selection', ' Select a link Room')
refElemRoom = uidoc.Selection.PickObject(ObjectType.LinkedElement, CustomLinkRoomSelection(), "Select a link Room")
rvtlnkInstance = doc.GetElement(refElemRoom)
docLink = rvtlnkInstance.GetLinkDocument()
elemLink = docLink.GetElement(refElemRoom.LinkedElementId)
OUT = elemLink