Really looking for TPover on this one!
So, I’ve tried modifing TPover’s “Elements in connected network” node from MEPover package to give me the individual connected networks in sub-lists that are connected to a family instance that has multiple connectors. The reason I need to do this is to be able to report primary and secondary conduit lengths for each transformer so that we can order the correct lengths of wire to prefab the transformers with. See examples of scenarios:
Currently, I have a script that essentially uses the Transformer Revit schedule that looks at the XFMR names and finds those elements with that name. From there I can get the the primary and secondary flex from each transformer in a sorted list of sub-lists. From there, I feed each flex element into the modified connected element node that I made to only give me each element or connected network of elements into sublists by transformer. However, I’m getting unexpected/inconsistent results.
The cleanest approach would be to have a python script that would accept the family elements and list all the connected networks in sub-lists from each connector in the family.
I apologize for not having a screen shot of the script. For some reason when I use the Dynamo capture function, you cannot see any text on the nodes. If anyone knows what’s causing this, I’m all ears! Anyway, since I can’t get a good snapshot and new users cannot upload attachments, here are a few screenshots. Just hit me up and I can email you the script if you want to play with it.
Python for modified node:
import clr
import math
import sys
pyt_path = r’C:\Program Files (x86)\IronPython 2.7\Lib’
sys.path.append(pyt_path)
import System
clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
clr.AddReference(“RevitAPI”)
import Autodesk
from Autodesk.Revit.DB import *
clr.AddReference(“RevitNodes”)
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
import collections
#The inputs to this node will be stored as a list in the IN variables.
if isinstance(IN[0],list):
element = UnwrapElement(IN[0])
toggle = 0
else:
element = [UnwrapElement(IN[0])]
toggle = 1
def nextElements(elem):
listout = [elem]
try:
connectors = elem.ConnectorManager.Connectors
except:
connectors = elem.MEPModel.ConnectorManager.Connectors
for conn in connectors:
for c in conn.AllRefs:
if c.Owner.Id.Equals(elem.Id):
continue
#elif c.Owner.GetType() == Mechanical.MechanicalSystem:
elif c.Owner.GetType() == Plumbing.PipingSystem:
continue
elif c.Owner.Id in lookup:
continue
else:
newelem = c.Owner
listout.append(newelem)
return listout
def systemcheck(elem):
if elem.GetType() == Mechanical.MechanicalSystem or elem.GetType() == Electrical.ElectricalEquipment:
return True
params = elem.Parameters
for param in params:
if param.Definition.Name == “Panel Name”:
return True
return False
def collector(elem):
cont = 0
elements = nextElements(elem)
for x in elements:
if x.Id in lookup:
cont += 1
else:
item = doc.GetElement(x.Id)
if systemcheck(item):
return None
else:
lookup[x.Id] = item
collector(x)
if cont == len(elements):
return elem
listout =
lookup = collections.OrderedDict()
for x in element:
collector(x)
listout.append(lookup.Values)
#Assign your output to the OUT variable.
if toggle:
OUT = lookup.Values
else:
OUT = listout