Tying to create a new piping system with Dynamo from excel.
I have list of piping system and i want to create new piping system from each item in the list and set “system abbreviation” and set a materiel".
any idea? any help? any API ?
no google solution was found
I think you can create system once you have elements in your model.
I couldn’t fully understand what you are trying to achieve?
Piping/Mechanical system will be assigned to Elements. Without elements you can’t create a system (As far as I know)
i will try to make it clear .
i have a very big list of systems and i want to create for all of thoes items new “Piping system” and then when i will model a new pipe I will chose one of thoes systems.
i dont want to do it one by one by clicking duplicate-> rename the piping system etc.
ill start with @jalshu becasue its seems to be much easy.
do you have any idea why the material doesnt change to “steel” ? maybe steel is not on your material list?
It worked perfectly for me. Can you share a snip of your system type property? and is the material you are trying to set is already in your material library?
@Tom_James Thanks for the tip Tom,I haven’t done set material via API before. I thought it would similar to setting other parameters. but it seems like it takes only MaterialId as a input not a material name as a string. To set material by its name we need to search for materialId first and then assign it here. Right?
As per my understanding, It has to be Element not Integer, when you get “Element.Id” you get Integer value not element. That’s why my next suggestion would be, Search material name by string and get matching material by Boolean mask and then assign it to your pipe system.
All we need to do then is get the material, filtered element collector would be the easiest way programmatically, get the Id of the material, then set the parameter using:
pipeMat = the id of the material you want to set
Mtr.Set(pipeMat)
As you can see, me screen shows diiferent value and Im confuse .
when I chose one of my "pipe system " i got a different paramter of material and im not relly shure what code line i have to change.
Lets say that until the material lines everything works fine
Enable Python support and load DesignScript library
import clr
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *
The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN
Place your code below this line
Assign your output to the OUT variable.
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
TransactionManager.Instance.EnsureInTransaction(doc)
pipe=Plumbing.PipingSystemType.Create(doc,MEPSystemClassification.OtherPipe,"My Test Pipe")
Abr=pipe.LookupParameter("Abbreviation")
Abr.Set("Jalshu")
Mtr=pipe.LookupParameter("Material")
Mtr.Set(Material Tid - Test 914840)
OUT= 0
Read my post above, you need to replace LookupParameter with get_Parameter(BIP).
Also, the elementid is 914840 in your case, the left image is showing a description and the Id, don’t use this. I think you need to do some background reading, have a look at the dynamo primer.
import clr
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
TransactionManager.Instance.EnsureInTransaction(doc)
pipe = Plumbing.PipingSystemType.Create(doc,MEPSystemClassification.OtherPipe,"My Test Pipe")
BIP = BuiltInParameter.MATERIAL_ID_PARAM
Mtr = pipe.get_Parameter(BIP)
matFilter = FilteredElementCollector(doc).OfClass(Material).ToElements()
pipeMat = [m.Id for m in matFilter if m.Name == "Copper"][0]
Mtr.Set(pipeMat)
TransactionManager.Instance.TransactionTaskDone()
OUT= pipe