Route Conduit by Circuit Path in Revit

I am still very new to Dynamo. What I was wondering is if there is a way to create conduit routes based on the “Circuit Path” Revit creates each time you circuit two items together? I have found some dynamos that create conduit routes based on lines using MEPover and am looking for a way to have those lines be created along the “Circuit Path”. The screen shot is the starting point for this topic. This would come in very helpful when creating initial conduit routes.

You would have to get the circuit path via the API, convert those points to a curve path, and then draw your conduit along that path.

1 Like

Hello @npetersonKE23D welcome…think you had some name conflict in the mep node…open the node and correct the input names so we dont have warnings…

1 Like

@sovitek, Thanks for the help in fixing the error.

Still looking for some help on my initial question on routing the conduit using the Revit “Circuit Path”.

Nick,
Thanks for the information and thought process, but do to my limitations with programming this is where I fall short.

Hi maybe this will help you.

# Load the Python Standard and DesignScript Libraries
import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

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

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

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

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

# The inputs to this node will be stored as a list in the IN variables.

doc = DocumentManager.Instance.CurrentDBDocument
ElectricalCircuits = DB.FilteredElementCollector(doc).OfCategory(DB.BuiltInCategory.OST_ElectricalCircuit).WhereElementIsNotElementType().ToElements()

searchCircuitLoadName = IN[0]
output = []
	

TransactionManager.Instance.EnsureInTransaction(doc)
for ElectricalCircuit in ElectricalCircuits:
	ElectricalLoadNames = ElectricalCircuit.get_Parameter(DB.BuiltInParameter.RBS_ELEC_CIRCUIT_NAME)
	CircuitLoadName = ElectricalLoadNames.AsValueString()
	if searchCircuitLoadName in CircuitLoadName:
		LoadNameCircuitPath = ElectricalCircuit.GetCircuitPath()
		for points in LoadNameCircuitPath:
			CircuitPointsPath = DB.Point.Create(points)
			output.append(CircuitPointsPath.ToProtoType())

		


TransactionManager.Instance.TransactionTaskDone()

# Assign your output to the OUT variable.
OUT = output

1 Like

@jguevara5PPA8, Thanks for the help in this but I am getting the following error.
image

Wich version of Revit are you running?

Can you explain me what the type of input you connect to the phyton node script that I share you?

@jguevara5PPA8,
I have the Element.ElectricalCircuit node from MEPover.Revit.Systems as my input and am currently testing / working with Revit 2021. I tried creating your code block on the input side but could not figure out how you were selecting where the circuit information was coming from.

@jguevara5PPA8,
In the end this is something similar to what I am going for.

Hi @npetersonKE23D you must use string type as an input in order to get the electrical circuit path for that particular circuit LoadName.

use this node to convert object to string

image

@jguevara5PPA8, even with all this help I am still having issues.


Here is the complete Dynamo I am going for. Note the warning shown above is from the code listed above.

Thanks in advance.

Hello

try to replace this line

LoadNameCircuitPath = ElectricalCircuit.GetCircuitPath()

by

LoadNameCircuitPath = ElectricalCircuit.GetCircuitPath() if ElectricalCircuit.GetCircuitPath() is not None else []

1 Like

I am still coming up with the same error.

Hi I checked your graph from the last image, for some reason I did not get the circuit from the custom Electrical circuit node instead of that, please use this image for your graph, let me know if this works for you.

1 Like

Can you share a simple file to reproduce the error?

@c.poupin,
Below you will see the dynamo I have been working on. This is in it’s simplest form. I currently am just trying to use it to rout form a single outlet back to a 120v panel using the Revit generated “Circuit Path” point locations to create a line and then route the conduit along that line. Any help would be appreciated.

VE Draw Conduits Circuit Path R21 V4.dyn (40.5 KB)

Thanks,

@npetersonKE23D
the error seems to be related to the fact that one or more parameters have no value

try this version

import sys
import clr
import System
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

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

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

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

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

# The inputs to this node will be stored as a list in the IN variables.

doc = DocumentManager.Instance.CurrentDBDocument
ElectricalCircuits = DB.FilteredElementCollector(doc).OfCategory(DB.BuiltInCategory.OST_ElectricalCircuit).WhereElementIsNotElementType().ToElements()

searchCircuitLoadName = IN[0]
output = []
	

TransactionManager.Instance.EnsureInTransaction(doc)
for ElectricalCircuit in ElectricalCircuits:
	ElectricalLoadNames = ElectricalCircuit.get_Parameter(DB.BuiltInParameter.RBS_ELEC_CIRCUIT_NAME)
	CircuitLoadName = ElectricalLoadNames.AsValueString()
	if not System.String.IsNullOrEmpty(CircuitLoadName) and searchCircuitLoadName in CircuitLoadName:
		LoadNameCircuitPath = ElectricalCircuit.GetCircuitPath () if ElectricalCircuit.GetCircuitPath() is not None else[]
		for points in LoadNameCircuitPath:
			CircuitPointsPath = DB.Point.Create(points)
			output.append(CircuitPointsPath.ToProtoType())

TransactionManager.Instance.TransactionTaskDone()

# Assign your output to the OUT variable.
OUT = output
1 Like

That took care of the error but now I get an empty list.


No points for the line to follow there for no conduit.

Did you do something different with the Dynamo?