Search
  • Paul

Conduit Runs and sizing conduit in Revit

Updated: Jun 22

In order to size conduits to NEC or IEC codes its important to get the number of bends in a conduit run. This defines how easy it'll be to pull those cables down the length of the conduit run.... the more bends the tougher the job.


I've worked on sites where the conduits would be packed due to not sizing the run correctly and electricians would have to use soap from the toilets to install the cables. Please never do this! Soap can react to break down cable insulation. There's specific cable pulling lubricant which is used to make the job of installing cables easier. Or better yet just use AutoCT and make sure the route is sized correctly! (shameless plug!).


But back to Revits conduit runs. Each conduit in Revit is assigned to a run, the run is used to calculate the overall length of the run (but not count the number of bends). If you query the model using Revit Lookup you will see Conduit Fittings (bends) fall under the 'family instance' type and aren't assigned a conduit run number.


Therefore, to get the quantity of bends we have use the conduit connectors to count up the number of fittings that are in the run. There's a great post on the Building Coder Blog on getting element connectors and also in relation to climbing along element connectors. Essentially, we need to go to the conduits connections, if the connection is empty - ignore it, if it has a connection and it's a family instance increment a list. Now look at the family instance's connection and continue recursively.


What i found easiest was to use a dictionary in C#, use the ElementId for the conduit run as the Key and the quantity of bends as the value. This also means I only had to calculate the number of bends in a run once then just save the dictionary for a later query.


Here's the code snippet below.



Conduit c = e as Conduit; //e is an element from the model
ConduitRun conduitRun = doc.GetElement(c.RunId) as ConduitRun;
int numberBends = 0;

if(!conduitRunBends.ContainsKey(conduitRun.Id)) //conduitRunBends is the dict<elementid,int>
{
	IList<ElementId> ownerIDList = new List<ElementId>();
	ConnectorSet conn = c.ConnectorManager.Connectors;
	ConnectorSetIterator connSI = conn.ForwardIterator();
	while (connSI.MoveNext())
	{
		Connector connector = connSI.Current as Connector;
		ConnectorSet allRefs = connector.AllRefs;
		foreach (Connector con in allRefs)
		{
			if (ownerIDList.Any(x => x.IntegerValue == 
			Con.Owner.Id.IntegerValue))
			{
				continue;
			}

			ownerIDList.Add(con.Owner.Id);

			FamilyInstance familyInstance = con.Owner as 
			FamilyInstance;

			if (familyInstance != null &&
				familyInstance.Category.Id == 
				Category.GetCategory(doc, 
				BuiltInCategory.OST_ConduitFitting).Id)
			{
				numberBends++;
			}
		}
	}
	conduitRunBends.Add(conduitRun.Id, numberBends);
}
else
{conduitRunBends.TryGetValue(conduitRun.Id, out numberBends);}


Hope you found this post useful, any comments below or suggestions for other topics please keep me posted!




22 views
 

©2019 by AutoM8