My company has a number of “dumb” schedules - schedules where all of the info is entered as a text line below the title but above the headers. They contain entirely non-schedulable information, like inspection requirements. Leadership is wanting to change everything to capitals, but I cannot figure out a way to use dynamo to read this info, let alone write back.
Is there a node or plug in that would let me bulk capitalize this information? I know that I could take the info out and create symbol families or a legend or something like that, but I’d much rather dynamo it and get it done faster.
Do you mean capitalize the name of the Schedule?
Nope, unfortunately
All of the info here is just text entered above the header line.
This one has already been capitalized. Here is a better example.
Every sentence case of uncapitalized word should be converted to all caps.
Sorry, but I still can’t understand what you want to do,you have an example in Revit itself?
1 Like
I would but I’m a “new user” so I can’t upload attachments…
Here’s one last screenshot
Any information that might be schedulable in Revit would normally pop up below the gray line marked “A”
All of the current text was added by inserting a line below the title, above the header.
Just bumped your trust level, which may get past that limitation if you clean the other data from the file first. If not please use another hosting service such as BIM360, ACC, Onedrive, Dropbox, Google, Wetransfer, etc…
Thanks!
This file has just one schedule in it.
Schedule.rvt (380 KB)
1 Like
BiMorph has some good nodes for getting schedule data. From there, you just need to filter out the headers or cells that need capitalizing. Then use String.ToUpper
to convert everything to upper case and write back to the schedule.
I’m going to look into this now, but as it’s a 2019 project I have no clue if what I build will work, and I don’t even have access to that Revit version anymore. Note that very soon that version will have been unsupported for over a year, and so any corruption to the file will not be something our support team can resolve. I recommend you upgrade to a modern build, but at a minimum a supported one.
Oh, I can update it. I just included it in the lowest version we still have available, just in case.
Schedule.rvt (456 KB)
1 Like
This worked for me in both CPython and IronPython, so likely scales back to 2019 if you have Dynamo 2.0.4 on there (the latest you can install)
import clr, traceback
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import SectionType
# Standard areas for Current Document, Active UI and application
doc = DocumentManager.Instance.CurrentDBDocument
# unwrap the view
schedule = UnwrapElement(IN[0])
caseType = IN[1]
# Start Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
#get the table data (what holds the data in a schedule view)
tableData = schedule.GetTableData()
#get the section header
sectionData = tableData.GetSectionData(SectionType.Header)
#get the number of columns in the section
colCount = sectionData.LastColumnNumber+1
#get the number of rows in the section
rowCount = sectionData.LastRowNumber+1
#an empty list to hold results
results = []
#for every row
for i in range(rowCount):
if not (caseType in [0,1,2]):
results = "IN[1] must be a value of 0, 1, or 2; for 'lower', 'UPPER', or 'Title' case"
break
#for every column
for j in range(colCount):
#try
try:
#get the initial text
initText = sectionData.GetCellText(i,j)
#convert case
#if the case type is 0, convert to lower
if caseType == 0:
newText = initText.lower()
#if the case type is 1, convert to upper
elif caseType == 1:
newText = initText.upper()
#if the case type is 2, convert to title
else:
newText = initText.title()
#set the cell text to the new case value
sectionData.SetCellText(i,j,newText)
#append the outcome to the results variable
results.append(["Cell [{0},{1}] successfully had it's text updated to all caps.".format(i,j),"\tOld Value: {0}".format(initText),"\tNewValue: {0}".format(newText)])
#if any indext fails, append the failure to the results list
except:
results.append(["Failed to capitolize cell [{0},{1}].".format(i,j), traceback.format_exc()])
# End Transaction
TransactionManager.Instance.TransactionTaskDone()
#return the results to the Dynamo environment
OUT = results
1 Like