in my list there are 2 of them @vanman ! i set the second one!
both dont work for me unfortunately
did you check regular stuff f.e. @vanman
1.) are you still in a work mode
2.) selected something during running
3.) restart dynamo
…
anyone know how to use GeniousLoci method to input a link doc with the get all callouts code?
#Part of script from Clockwork
inputdoc = UnwrapElement(IN[0])
if inputdoc == None:
doc = DocumentManager.Instance.CurrentDBDocument
elif isinstance (inputdoc, RevitLinkInstance) :
doc = inputdoc.GetLinkDocument()
elif isinstance (inputdoc, Document) :
doc = inputdoc
else: doc = None
holy shit just pasting it in got from links too. Ideally just want to get references from views though…
#Alban de Chasteigner 2018
#twitter : @geniusloci_bim
#geniusloci.bim@gmail.com
import clr
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
# Import ToDSType(bool) extension method
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
#Part of script from Clockwork
inputdoc = UnwrapElement(IN[0])
if inputdoc == None:
doc = DocumentManager.Instance.CurrentDBDocument
elif isinstance (inputdoc, RevitLinkInstance) :
doc = inputdoc.GetLinkDocument()
elif isinstance (inputdoc, Document) :
doc = inputdoc
else: doc = None
collectorViewer = FilteredElementCollector(doc)
OSTviewers = collectorViewer.OfCategory(BuiltInCategory.OST_Viewers).ToElements()
def GetAllCallouts(_doc, _OSTviewers):
CalloutParent = []
for view in _OSTviewers:
paraIndex = BuiltInParameter.SECTION_PARENT_VIEW_NAME
parameter = view.get_Parameter(paraIndex)
if parameter != None:
element = _doc.GetElement(view.get_Parameter
(paraIndex).AsElementId())
if element!= None:
CalloutParent.append(view)
return CalloutParent
OUT = GetAllCallouts(doc,OSTviewers)
How do you want it exactly?
A node that would get selected views callout references in the document/links. Fake and real references. Then I’m going to schedule the data from that and put it next to the view on a sheet to show where all references are for that detail
Like this?
import clr
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
# Import ToDSType(bool) extension method
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
view = UnwrapElement(IN[0])
CalloutParent = []
for v in view:
paraIndex = BuiltInParameter.SECTION_PARENT_VIEW_NAME
parameter = v.get_Parameter(paraIndex)
if parameter != None:
element = doc.GetElement(v.get_Parameter(paraIndex).AsElementId())
if element!= None:
CalloutParent.append(v)
OUT = CalloutParent
seems very promising but there should be 4 callout elements from this view. Sorry if I’m explaining incorrectly
just returns emptys
Hmm strange…
@Konrad_K_Sobon any thoughts?
Hello
I don’t know what kind of list structure you want in the end, but here’s an example
import clr
import System
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB
clr.AddReference("System.Core")
clr.ImportExtensions(System.Linq)
def get_Sheet_Callouts(currDoc, v_callout):
c_filter = ElementClassFilter(clr.GetClrType(DB.Viewport))
lst_vpIds = v_callout.GetDependentElements(c_filter)
for vpid in lst_vpIds:
viewport = currDoc.GetElement(vpid)
sheet = currDoc.GetElement(viewport.SheetId)
if sheet is not None:
return sheet
return "'{}' not placed in a Sheet".format(v_callout.Name)
toList = lambda x : x if hasattr(x, '__iter__') else [x]
out = []
#Preparing input from dynamo to revit
lstviews = toList(UnwrapElement(IN[0]))
for view in lstviews:
if view is not None and not view.IsTemplate:
currDoc = view.Document
filterFunc = System.Func[DB.Element, System.Boolean](lambda x : currDoc.GetElement(x.GetTypeId()).ViewFamily == ViewFamily.Detail)
enumIter_DetailCallout = FilteredElementCollector(currDoc, view.Id).OfCategory(BuiltInCategory.OST_Viewers).WhereElementIsNotElementType().Where(filterFunc)
temp = []
for v_callout in enumIter_DetailCallout:
sheet = get_Sheet_Callouts(currDoc, v_callout)
temp.append([v_callout.Name, sheet])
if len(temp) > 0:
out.append([view, temp])
OUT = out
You know what sorry guys. I haven’t looked at revit correctly. So I want what sheet each callout is on. Even though the callout is on a different sheet it only reports the one referencing sheet! How do I get the sheet of the element? Maybe get the view of the element then the sheet of the view?
this should have had the other referencing sheet in it
@Nick_Boyts if your interested
I might be out of luck getting the callouts sheets… Should be AA4011 in there too. Or I search every view on a sheet for a callout… Very slow collecting callouts from views on sheets