Two of these electrical elements called, “Student” are hidden in view…
but it says they’re not.
Can I do this or is it not exposed in the API?
Two of these electrical elements called, “Student” are hidden in view…
but it says they’re not.
Can I do this or is it not exposed in the API?
Dataset to reproduce?
I just linked in a blank model to another blank model with 3 families identical families I set to be “Electrical equipment”
Then I hid 2 of those in view.
And how did you gather ‘linked elements visible in the view’? As far as I know linked elements are going to say ‘I can be seen’ if the link instance they are in can be seen.
What do you mean how did I gather them?
Sorry - asking the wrong question.
Using ‘select model element’, what element ID would you get if you were to select one of the linked elements if you were to unhide it?
Not quite sure what you mean but…
The element Id in Dynamo wasn’t in the current Revit model (so it must have come from the link?)
I am about to head into a meeting so i skimmed through this with no audio.
It might help, or i might be wasting your time…
Exactly. The element IS visible in the view and the element you see in the link instance (not the family instance in the link instance). Well I believe that is what the API thinks anyway.
But it’s not visible… Some muppet has tabbed to it (there are loads in the real scenario) and right clicked and selected, “hide element” …
Is it possible to undo with Dynamo?
Otherwise one of my poor colleagues has to spend a few hours/ days manually undoing this mess.
A thought: Duplicate the link instance, and see if they are visible in the duplicate. Then see what happens if you delete the old link instance.
Or just select them all and ‘unhide in view’ even the ones that aren’t hidden. If you can’t make it work then you won’t make it work in the other cases.
If that doesn’t work, let the boss know that the budget will be blown as there wasn’t any indication that it would be an episode of the muppet show, and as a result the of Bunsen and Beaker’s experiment we now have a mess to clean up. Then stick the same muppet who ‘broke it’ on ‘fix it’ duty for the day.
We tried all the traditional ways
Also deleting links isn’t an option as it’s a huge project.
We have no idea who did it, the finger pointing button isn’t gunna work for this.
Duplicating the family instance in the link might work…
Unfortunately, we can’t unhide link elements with View.UnhideElements()
method
but with Revit API 2024, here’s a workaround to get hidden link elements from a 2D view (host model)
with the new FilteredElementCollector() constructor
import clr
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
lnkInstance = UnwrapElement(IN[0])
transf =lnkInstance.GetTotalTransform()
actView = doc.ActiveView
doclnk = lnkInstance.GetLinkDocument()
#get bootom and top Elevation of active viewrange
viewRange = actView.GetViewRange()
topClipPlaneId = viewRange.GetLevelId(PlanViewPlane.TopClipPlane)
topClipPlane = doc.GetElement(topClipPlaneId)
topOffset = viewRange.GetOffset(PlanViewPlane.TopClipPlane)
bttmClipPlaneId = viewRange.GetLevelId(PlanViewPlane.BottomClipPlane)
bttmClipPlane = doc.GetElement(bttmClipPlaneId)
bttmOffset = viewRange.GetOffset(PlanViewPlane.BottomClipPlane)
bbxActView = actView.CropBox
#set min and max from active ViewRange
bbxActView.Min = XYZ(bbxActView.Min.X, bbxActView.Min.Y, bttmClipPlane.ProjectElevation + bttmOffset)
bbxActView.Max = XYZ(bbxActView.Max.X, bbxActView.Max.Y, topClipPlane.ProjectElevation + topOffset)
bbxActView.Transform = transf
myOutLn = Outline(bbxActView.Min, bbxActView.Max)
#create LogicalOrFilter with BoundingBox
filterBbxInside = BoundingBoxIsInsideFilter(myOutLn)
filterBbxInters = BoundingBoxIntersectsFilter(myOutLn)
filterBbx = LogicalOrFilter(filterBbxInside, filterBbxInters)
#make collector
link_walls_ids_current_box = FilteredElementCollector(doclnk).OfClass(Wall).WherePasses(filterBbx).ToElementIds()
link_walls_ids_current_view = FilteredElementCollector(doc, doc.ActiveView.Id, lnkInstance.Id).OfClass(Wall).ToElementIds()
wall_ids_not_in_view = set(link_walls_ids_current_box) - set(link_walls_ids_current_view)
OUT = wall_ids_not_in_view
Sadly we’re in Revit 2023.
The second I saw Cyril’s post I said "the project is going to be in 2022 or 2023, and that will prevent this from helping…
Wonder if selecting by linked element ID could help… or perhaps building a selection set?