Hello, possibly this will be helpful to others? Or possibly some suggestions could help me improve this? I am not sure if this post is even appropriate for the forum? We shall see…
I have a need to get a listing of all sheets and title blocks into an Excel spreadsheet. By modifying the “List TitleBlocks on Sheets” python script I was able to accomplish this! As I am a newbie to python, this was not too difficult. Here are the details:
The existing output from this tool is formatted like this:
SHEET: A-101 - FLOOR PLAN - BASEMENT TITLEBLOCK: AFC REV PRINT [966501]
Since spaces are used both in the sheet name and the title block name, it’s difficult to copy/paste this to a spreadsheet and have the results fall into the correct columns.
So how about modifying the output so it lists the items separated by commas? Or separated by something else if there are commas used in the Sheet Name? How about separating the items by a caret symbol “^” and then using that as the separator when importing the data into excel? (I have used the caret symbol successfully as a column separator in other programming languages, but I don’t know if it will work in python scripts?)
Here is how I did that. Maybe there is a better way?
I edited the python script file located here with Notepad++:
C:\Users(my username removed)\AppData\Roaming\pyRevit-Master\extensions\pyRevitTools.extension\pyRevit.tab\Drawing Set.panel\Sheets.pulldown\List TitleBlocks on Sheets.pushbutton\script.py
On lines 39 and 79 of the script I found this statement:
“SHEET: {0} - {1}\t\tTITLEBLOCK: {2} {3}”.format(
I was able to modify these statements on lines 39 and 79 to look like this. And now I have the output separated by caret symbol:
“SHEET:^{0}^{1}^TITLEBLOCK:^{2}^{3}”.format(
And here is a sample of the results:
SHEET:^A-101^FLOOR PLAN - BASEMENT^TITLEBLOCK:^AFC REV PRINT^966501
Its all nicely delimited with carets.
Then:
Open the data in Browser
Select all and copy/paste into notepad
Save as txt file type
Import the file to Excel using the caret symbol “^” as your delimiter.
Yay! it works!
I know there is some python scripts for outputting directly to csv listed on this forum. They seem too complex for a newbie like me. And possibly if there is a comma in the Sheet Name, the results may not end up in the correct columns.
Any feedback would be appreciated!