Create New Duct/Pipe System from Elements

Looking to create a new duct system from all air terminals in a view. Given its a read only parameter of the air terminal, I can’t simply set it. Is there a way? Gave a look at the api, but couldn’t find anything pertaining to duct systems.

1 Like

I don’t think you can just create a system. What you can do is select an existing system and add terminals to that system. You’ll probably need to do that through the API.

Do you think it would be possible to create a list of empty systems and then add the terminals to those? Hard to believe its not possible, but at the same time, I guess not.

Maybe pull all ducts, get all system parameter values from them, list the unique values, and then compare that list to the list of all system types in the job?

What would that list allow though? Would we be able to create new systems from it? Or add elements to those systems?

I think it would allow you to know if any weren’t in use. Would have to test it though and I’m not a systems guy.

Do empty systems even exist in Revit? A system always has a component that hosts the system.
Anyway, the API does not provide a way to create a system, so the only thing you could do is add components to an already existing system.

Hmm, alright. I’ll try some things with empty systems. I think you’'re right @T_Pover, its unlikely Revit will allow it but I’ll play around with it.

Guess I didn’t have my glasses on, the API does allow for the creation of empty systems. If you can wait then I’ll code soms nodes soon.

Oh great. What functions/classes did you find to create them? (I’m just getting into coding my own stuff and would love to attempt something)

From the top of my head: Revit.DB.Mechanical.MechanicalSystem.Create()

Cool, I’ll try to run with that. Thanks.

1 Like

Hello @nathaniel.g.macdonal, in case you need some help with the code: I decided to add these nodes to my ‘MEPover’ package:

3 Likes

Wow. @T_Pover, that is impressive. I think I’ll attempt to create those and then reference your code when I fux up. Thanks for all the work you’ve put into your package, it’s super useful.

1 Like

Reigniting an old thread, however whenever I try to use your MEPSystem.CreateSystem @T_Pover, it runs indefinitely. Here is what I’m feeding it.

Could it be something in your If statements? I attempted to adapt your script but got “expected ElementID got list” (on line 25)

Seems to work fine over here:

Your edited code does not work for a couple of reasons. If you want your edited version of the code to work (with the inputs you’re using) you would have to do this:

import clr

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)

systemtypes = UnwrapElement(IN[0])
systemnames = IN[1]

listout = []

TransactionManager.Instance.EnsureInTransaction(doc)

newsys = Mechanical.MechanicalSystem.Create(doc,systemtypes[0].Id,systemnames)
listout.append(newsys.ToDSType(False))
	
TransactionManager.Instance.TransactionTaskDone()

OUT = listout

But this only works in this particular instance. There’s a reason for all that other code in the custom node :slight_smile:

1 Like
  1. you’re right. don’t know what was wrong with my machine but I tried it three times in 2017 and two in 2016 with that problem. but i just tried it and it worked fine. thanks.

  2. thanks for posting that code. wasn’t sure why mine wasn’t working but you’re edits make sense. No longer feeding it a list and giving it the Id not just the string. this was helpful for my python learning so thank you.

1 Like

That’s good to hear. Maybe it kept running because the supplied system name was already in use?

Was dynamo in automatic run mode perhaps?

System name wasn’t a replicate but putting it in automatic did replicate the problem. Any idea why that is?

@T_Pover, is your AddtoSystem node meant to be setup like this? Got it to work once but couldn’t replicate the results and I’m starting to think my issues are from something with my Dynamo packages (currently have the System.IO.FIleLoadException issues).
image