Replace random text from Revit sheet name

HI… Can someone point me in the right direction of the node/nodes I should use to remove random text placed at the end of a filename as follows…

eg…files named
"223_45_GROUND FLOOR PLAN" to be renamed "223_45"
“789_67_1st FLOOR PLAN” to be renamed “789_67”

The original filenames are generated by Revit using the sheet number and sheet name which both need to remain in the model but I need the sheet name removing from the pdf but the end text/sheet name differs every time.

I should add that I know how to get the sheet name values using the Sheet.Sheetname node but then not sure what to do to take that list and use it to rename files minus each sheet name via plugging into the String.Replace node. It’s the bit inbetween I can’t figure out.


To answer your first question: Assuming your sheet numbers are all 6 characters long, you can get those first 6 characters with the Substring node.

As for your second question, you have a few options: You can use the Rename Files node from Archi-lab to rename files within a directory. Or you can try using the OOTB nodes to make your own workaround - something like… Copy original PDFs to a new (or same) location with the new name then delete the original PDFs.

See if that gets you started.


Thanks Nick, I think your first comment is the answer I’m looking for.

I recommend using String.Split and a List.GetItemAtIndex instead.

I’m wrapping up my efforts on a set with sheet numbers between 2 and 8 characters (A0, A200, T1 A220, T1 A220.1, T1 FP306), but they all have " - " between sheet number and sheet name thanks to Bluebeam and/or Revit depending on firm producing the sheet.

Hi, Try this but I can’t combine in a list