Hello,
How can i separete my list? so that each parameter get filled correctly
so for Code and discription.
KR
Andreas
Hello,
How can i separete my list? so that each parameter get filled correctly
so for Code and discription.
KR
Andreas
The trick here is that you need to have at least one value to start with, and then you just duplicate that value and change the parameter value of that item.
You could also programatticaly add that row as well.
https://www.revitapidocs.com/2022/e14a7a0f-0a5c-c010-7cc2-a83cb1a9da8c.htm
CreateScheduleViaCSV.dyn (13.7 KB)
do i realy call parameters here or the “first” value
i have 2 “key ProjectParameters”
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure 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
#Preparing input from dynamo to revit
view = UnwrapElement(IN[0])
out = []
#Do some action in a Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
elems = FilteredElementCollector(doc,sched.Id).ToElements()
for i in IN[1]:
new = ElementTransformUnils.CopyElement(doc,elems[0].Id,XYZ(0,0,0))
elem = doc.GetItem(new[0])
elem.LookupParameter("Key Name").Set(i[0][0])
elem.LookupParameter("Raumnutzungscode").Set(i[0])
elem.LookupParameter("Nutzungsartbezeichnung").Set(i[1])
out.append(elem)
TransactionManager.Instance.TransactionTaskDone()
OUT = out
or is this the way:
RK
Andreas
I don’t think this is the correct index.
thats the startpoint in the csv
Then just use [0], I was using nested lists in my example that is why the double [0][0].
it says it should not have a negativ value, the collection is out of range
In your schedule, which one is the “Key Name” or the default Revit column?
SInce you are only using 2 columns, I think you need to remove the Key Name line and just use the other two columns.
for i in IN[1]:
new = ElementTransformUnils.CopyElement(doc,elems[0].Id,XYZ(0,0,0))
elem = doc.GetElement(new[0])
elem.LookupParameter("Raumnutzungscode").Set(i[0])
elem.LookupParameter("Nutzungsartbezeichnung").Set(i[1])
out.append(elem)
Raumnutzungscode in Revit
I think it is still the index is not correct
Is that at least 1 row in the schedule already? If not, the above code will not work.
i already updated it as you discriped before
Raumnutzungscode and Nutzungsartbezeichnung are my project Parameters
the start with the first line “050100” and “Bildungsraum” (my first values)
is my imput correct
there is no first raw just the parameternames
error remains out of range
Thank you!
i think the problem is i dived the values by “semicolon”
How can i deal with that
because “,” is already in use
Use a Split node and break them into two values which should help.
Again, you will need to make sure there is at least one, even if empty, row that is in the key schedule to begin with or this code will not work.
so it something but it did not take the values from the list
it seems to be it took just the numbers an filled it
You need to split the values like I showed. Right now it is geting the “0” and the “5” or “7” from the first [0] and second [1] characters of your overall string.