I am currently working on a script to draw some perpendicular ducts to an existing main line, and when using the MEPover node “DuctRound.ByLines” I get an error in the python code. I pulled the python node out and have shown the error below.
I checked with a separate node and I believe that the duct type, mechanical system type, and level all have the correct notation to get the Revit Id, but for some reason its still throwing an error. Is there something I am missing here? Looking at the Revit API it looks like the following is the method for creating a duct.
duct =Autodesk.Revit.DB.Mechanical.Duct.Create (doc,systemtype.Id,ducttype.Id,level.Id,FirstPoint.ToXyz(),SecondPoint.ToXyz())
Any help would be greatly appreciated.
@J_Nyp I haven’t opened the code but what the error means it’s that it doesn’t want a list but an item. So if you need to feed a LIST use List@level. Can you share your dyn and rvt?
@salvatoredragotta that was the trick! Once I extracted and fed in the duct type and system type as a single item not a list it worked perfectly. Based on the error I never thought it was a list vs object issue. Thanks so much for the help!
Hello @J_Nyp and @salvatoredragotta. I know this topic is about 2 years old but I encountered a very similar problem as the above and wanted to know if either of you had any ideas as to why it is occurring and if you saw any solutions I could implement… I am using the MEPover package to create/draw duct and am having trouble with the “DuctRound.ByLines” node. I am using Revit 2021 and Dynamo 2.6.1… I will attach an image of the Python warning and the line (69) in question…
Please let me know if you have any thoughts or need any more information from me.
Thanks, and have a great day,
It looks like you are supplying a string representation of the system name, instead of the mechanical system type:
Try isolating the system type by the name, and supply this instead.
Duct.dyn (65.2 KB)
Thank you for your response and suggestion. So, if I am understanding you correctly, you are stating that the “S/A_Supply air” in the image is actually a string representation of the system name? Instead of the mechanical system type? I am having trouble trying to understand this.
Do you have an idea of how I could isloate the system type by the name and supply it? I have uploaded the dyn. file for anyone’s use if it helps.
Compare the input for the DuctType in the screenshot versus the MechanicalSystemType.
In DuctType, X.Name is only being used for visual reference, what is being fed into the Python Script is Element Type [ID:52545].
In MechanicalSystemType, X.Name is being fed into the Python Script, which is causing the issue. Instead it should be taking Element Type [ID:53391]. Re-wire the x input in red to All Elements of Type output.
If you are worried that the list will change and the index will change, you can do a string comparison:
Thanks @Robert_Younger for that explanation. This was much more simpler then what I was making it be. Silly mistake on my part. Thank you for helping… Re-writing the “All Elements of Type output” sends Element type (ID: 53391) just fine.
The python script gives another error message that I’m not too sure about. Do you know what it means? Does it have anything to do with the list for the diameters?
To any who may come across the problems I did in the above script, I shall humbly admit that more careful consideration should have been taken on my part…Case in point is the “duct type” that I was feeding into the IN part of the python node (which is also the DuctRound.Bylines node from the MEpover package)… I did not know that the x function was pulling a rectangular duct type (Tees / Mitered elbows)… Once I changed this to pull a round duct type, the DuctRound.Bylines node worked just fine…Simple mistake on my part. The node works fine if you just give it the right information