Fill in ‘Drawn By’ on sheets with Revit Python Shell

, , ,
RPS change drawn by image

Continuing the previous post about Revit Python Shell, we will use RPS to automate a simple task; fill in the Drawn By parameter on sheets.

More often than not, drafters or modelers forget to fill in Drawn By or Checked By on the sheets due to lack of time and fast approaching deadlines. If it is a big project, it may be painful to fill in all of them without overriding the ones that are already completed by a diligent drafter. In this case, programming can help a lot.

In our previous example, we have collected all the sheets in the project. The next step is to check if the sheets have Drawn By filled already and in case it is not, fill it. Easy, here is the code that makes this process simple and smooth:

# Import
import clr
import Autodesk.Revit.DB as DB

# Collect all sheets
sheetsCollector = DB.FilteredElementCollector(doc).OfClass(DB.ViewSheet)

# Open Transaction
t = DB.Transaction(doc, "Change sheets author")
t.Start()

# Loop through all sheets
for s in sheetsCollector:
	# Check sheets is not a placeholder
	if s.IsPlaceholder != True:
		drawn = s.LookupParameter("Drawn By").AsString()
		# Check for sheets that Drawn By is set by default or empty
		if drawn == "Author" or drawn == "":
			# Set the lucky drafter name on all the filtered sheets
			s.LookupParameter("Drawn By").Set("BIMicon")
			
# Commit transaction
t.Commit()

And that is all, this short script allows fill in parameters in hundreds of sheets.

DEVELOPMENT IDEA:

A good idea to enhance this script is to add Designed By and Approved By in the same script. Those are parameters of the sheet and as we already collected the sheets, it makes sense to add those parameters in the loop if we want to change them as well.

Leave a Reply

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