I was trying to create a new duct with the help of this forum. I found that there are two methods in API to create the duct. may i know what are the differences between those two methods. I found some examples of NewDuctmethod but i didn’t find an example of create method.
Apart from different inputs, the main difference is that Document New Duct is valid only until 2017.1 and Duct Create is valid from 2017. So I would use the second one
how to use create method. i tried but failed. can you help me.
You can use the information provided by the API doc.
In this case you need several input, like level, type etc… that you can select in Dynamo:
Then the python script is simple:
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Mechanical import *
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *
clr.AddReference('System')
from System.Collections.Generic import List
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
system = UnwrapElement(IN[0]).Id
duct = UnwrapElement(IN[1]).Id
level = UnwrapElement(IN[2]).Id
start = UnwrapElement(IN[3]).ToXyz()
end = UnwrapElement(IN[4]).ToXyz()
TransactionManager.Instance.EnsureInTransaction(doc)
duct = Duct.Create(doc,system,duct,level,start,end)
TransactionManager.Instance.TransactionTaskDone()
OUT = duct
Show us here what you have and we will help you pickup.