Convert Revit text to uppercase with Python

In response to this post on Revit3d blog here is how you can convert Revit text to uppercase with a few lines of Python code.

Assuming that you have IronPython Shell installed

– Select text boxes that you want the text to be converted to upper case
– Open your IronPython Console
– Paste this code below:

1
2
3
4
5
6
7
8
9
10
11
12
13
import clr
clr.AddReference('RevitAPI')
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.DB import *
 
app = __revit__.Application
doc = __revit__.ActiveUIDocument.Document
 
t = Transaction(doc, 'convert text')
t.Start()
for el in uidoc.Selection.Elements:
	el.Text=el.Text.upper()
t.Commit()

Download the Python Script…

 

Tagged with →  
Share →

Leave a Reply

Your email address will not be published. Required fields are marked *

* Copy This Password *

* Type Or Paste Password Here *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>