Add Rows data to Key Schedule

Hello,
I’m trying to insert datas into key schedules with dynamo 2.13.1.
My script creates key schedules, add key labels (columns), but i can’t found any way to add datas.
Do you have an idea with packages / nodes or with a python code ?

Thanks a lot

Thanks for your reply but I don’t speak about filtering. My use case is to add some row datas by dynamo. My datas come from a database and I want to add thoses datas into my key schedules like this :


In english it meanings “insert row datas”.
Thanks

Sorry I misunderstood. Maybe this will help you…

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

schedule = UnwrapElement(IN[0])

TransactionManager.Instance.EnsureInTransaction(doc)

sched = ViewSchedule.GetTableData(schedule)
sched = TableData.GetSectionData(sched, 1)
TableSectionData.InsertRow(sched, 1)
	
TransactionManager.Instance.TransactionTaskDone()
1 Like

Hi, I tried but here for me I couldn’t
because my table does not allow it, I must be in the exceptions


as the saying goes, if you can’t do it in revit, you probably can’t do it in dynamo

doc = DocumentManager.Instance.CurrentDBDocument

schedule = UnwrapElement(IN[0])

TransactionManager.Instance.EnsureInTransaction(doc)

sched = schedule.GetTableData()
tsd = sched.GetSectionData(SectionType.Header)
tsd_1 = sched.GetSectionData(SectionType.Body)

tsd.InsertRow(tsd.FirstRowNumber)

a= tsd.CanInsertRow(1)
b= tsd_1.CanInsertRow(1)

TransactionManager.Instance.TransactionTaskDone()
OUT = a,b

cordially
christian.stan

Not sure about that. I am just getting into python and the API, so my code looks rudimentary. I utilized some of your approach and revamped my code. It works the same, but does look neater.

sched = schedule.GetTableData()
sched = sched.GetSectionData(SectionType.Body)
sched.InsertRow(1)
1 Like

You are right, your code is cleaner :wink:.
with your code: :+1:
image

I’m trying my hand at the API too, I hope you didn’t take my message the wrong way (that wasn’t the goal) I was trying on a legend whose body wasn’t changeable (so it doesn’t help)

cordially
christian.stan

Not at all. I welcome any and all guidance. I was just happy that I could figure it out in the first place. Glad you figured out why it wasn’t working for you. It’s good to know that sort of stuff, so thanks for sharing.

I went ahead and threw in a schedule checker and counter loop to add multiple rows. I haven’t messed with Key schedules in Revit, so not sure if this will help or not.

1 Like

Thanks a lot ! I will check as soon as possible. But I ve just a question : where is the datas inserted. I can see you’re using a method to “insertrow” but I can’t see where the value is inserted too.

1 Like

Look at Key Schedule node from archilab. That should let you populate your schedule with the data. Also take a look at the posts below. They provide some additional information. There may be other posts about this subject in the forum also.

1 Like