Rename Schedule Header

Dear Experts,
I was looking for to rename schedule header. Is it possible by Dynamo?

A quick search in the forum:

Yes sir. But Python script not mentioned at post.

You asked if it was possible. The post proves that it is possible and links to the API method for doing so. Now it’s up to you to try and make it work.

This will get you started:

# Load the Python Standard and DesignScript Libraries
import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

clr.AddReference('RevitAPI')
import Autodesk.Revit.DB as DB
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument

# The inputs to this node will be stored as a list in the IN variables.
sched = UnwrapElement(IN[0])
names = IN[1]
newNames = IN[2]

# Retrieve data from the schedule
fields = sched.Definition

#Do some action in a Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
# Check for head title match and set new name
for number in range(fields.GetFieldCount()):
	colHead = fields.GetField(number).ColumnHeading
	for n, newName in zip(names, newNames):
		if colHead == n:
			sched.Definition.GetField(number).ColumnHeading = newName
TransactionManager.Instance.TransactionTaskDone()

# Assign your output to the OUT variable.
OUT = 0

Off-topic
I really appreciate the help people get on these forum, but people keep asking the same question over and over on these forums because of this (this = solution or code not posted).

Why reinvent the wheel?

Also, not everyone knows Python.

Because these forums are for discussing and learning, not handing people answers. I’m not talking about anybody specifically, but many of these questions that are asked “over and over” are not because they haven’t been answered, but because people are looking for finished solutions without doing any work (or at least not showing it).

Many threads end up being a back and forth discussion between the people of this forum - offering up partial solutions or insight on how to go about solving a problem - eventually leading to the OP finding their own solution. But it’s up to them to share that solution. There’s nothing that says anybody on these forums is required to provide or share any solution. Most people here are spending their own time trying to help other people, to further educate a growing community. That can’t happen if those trying to learn aren’t doing anything for themselves.

3 Likes

I should have also clarified in my original post.

“Now it’s up to you to try and make it work” does not mean you’re now on your own. It means it’s up to you to put in the effort and try to find a solution. Work through what you can and when you get stuck, come back with specific questions. That’s what we’re here for.

2 Likes

Last off-topic (b/c i don’t wanna hijack this topic or pollute it)

I partial agree with you. But i have seen numerous topics (searching for an answer for a problem i have) with hardly any discussion or just someone saying solved (and not telling how).
Forum is getting cluttered with topics / posts which are of no help to anyone.

This does happen and I agree it’s frustrating. But like I said before, there’s nothing that says anybody has to share their solution with the forum. You would hope that people coming to a forum for help would be willing to reciprocate the favor, but that isn’t always the case. All you can do is ask and hope that they are willing to share or at least help someone else in a similar situation.

2 Likes

Dears,
Thanks for your time and messages. I am Designer and no any capability to write such kind of python programs. My programming skills is 0. That is why addressed this question to the Python experts consideration.
Anyways, many thanks for your time and effort.