I didn’t want to use Dynamo as I really prefer line code programming to visual programming. But in fact Dynamo :
- has a very active community
- is open source too
- use python as main scripting language
- is great for debugging python script as you don’t need to include every single line in a try/except block
- is much user friendly than as it is now included with Revit 2017.1 and by the way this new Dynamo Player makes it usable by anyone
- scare many people less than line code so they can easily modify to adapt it to their objectives
Here is the Dynamo image. It uses Clockwork package :
File is available here
Here is the python code block :
import clr clr.AddReference("RevitAPI") from Autodesk.Revit.DB import * from Autodesk.Revit.DB.Plumbing import PipeSegment clr.AddReference("RevitServices") from RevitServices.Persistence import DocumentManager from RevitServices.Transactions import TransactionManager doc = DocumentManager.Instance.CurrentDBDocument #Les entrées effectuées dans ce noeud sont stockées sous forme de liste dans les variables IN. dataEnteringNode = IN elem = doc.GetElement(IN[0]) TransactionManager.Instance.EnsureInTransaction(doc) for dn, di, de in zip(IN[1], IN[2], IN[3]): DN = UnitUtils.ConvertToInternalUnits(dn , DisplayUnitType.DUT_MILLIMETERS) Di = UnitUtils.ConvertToInternalUnits(di , DisplayUnitType.DUT_MILLIMETERS) De = UnitUtils.ConvertToInternalUnits(de , DisplayUnitType.DUT_MILLIMETERS) try: elem.AddSize(MEPSize(DN,Di,De,True,True)) except: elem.RemoveSize(DN) elem.AddSize(MEPSize(DN,Di,De,True,True)) #Affectez la sortie à la variable OUT. OUT = IN
Enjoy
Hi,
I’m very interested in getting the code and the Dynamo file for this, but the link is not working
(broken) Would you be able to update or email me the code.
Best,
Charlie
Hi Charlie,
Link has been fixed. You can right click > save target to… to download the file. Thanks for reporting it.
Best,
Cyril
Thank for fixing the link!
We have another question related to Revit/Dynamo/Excel.
We would like to extract the “Nominal”, “OD” and “ID” data from the pipe system family and insert it into an excel spreadsheet to use in the loadable families. Right now Revit only shares the “Nominal” information with the loadable families, which creates havoc when we have different pipe sizes than what the nominal size is called out as, for instance – 24″ ID pipe has a 26″ OD, but the nominal is 24″ We have been searching and have not found a workable solution other than create “hundreds” of loadable families, which we are not interested in doing.
Hi Charles,
Why don’t you use lookup tables ? Even in real life ID and OD are not always exactly the same between pipes and fittings (eg. for welded steel pipes). I personnally use lookup tables and formulas to apply the correct ID/OD to fittings and accessories.
You anyway need to adapt radius lenght etc… with a lookup table. I have for exemple one elbow per material (welded steel, welded stainless steel, PE, PEX etc…).
Hi, I want to ask you a question. I wrote a dynamo, for automatic sprinklers, using excel, but did not work. Can you help me ?
Hi,
Is is it an open source project ? If yes I can give it a try.
Have you already posted your question on stackoverflow (https://stackoverflow.com/ with tags Revit API, Dynamo, IronPython for example) or dynamo forum (https://forum.dynamobim.com/) ? If yes please send me the link I’ll read it.
If it is a Revit/Excel issue you should also read BumbleBee source code (https://github.com/ksobon/Bumblebee).
Hi,can you show me the excel ?
I don’t have it any more but It is just a spreadsheet with nominal diameter in first column, internal diameter in second column and external diameter in third column.
Thanks for your dynamo, but I faced an issue after running code i got an error of ” Expected Reference, got list” Please advise??
This article is pretty old. Some nodes way to work may have changed. Instabilities in nodes/extensions is the main reason why I don’t use Dynamo a lot. Nevertheless it is now really more stable than in 2016.
A reference is a single object, a list is a list of undefined object. The node where the error occur seems to accept only 1 object of type Reference and you provide it a list (use watch etc… to visualize what transit between nodes).
Please, can you show us, what is inside Element.ID? Or where can we get it?
Element.Id is a default node under Revit -> Elements -> Element -> Id.
Thank you for you script.
i have this error: image on link https://ibb.co/WxJYD7S
The warning I have is this one could you please help?
Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 15, in
TypeError: expected Reference, got Int64
Thank you!
Hello Pedro,
Sorry, I apparently missed your message. The node `Element.ID` you use is different from mine. Yours output an integer `int` while mines output was apparently an [ElementId](https://www.revitapidocs.com/2020/b9832e6f-4498-26a5-5392-3a365dec8702.htm). In your script, you probably need to construct an `ElementId` from your `int` using constructor `ElementId(Int32)`.