Revit Architecture Forum
Welcome to Autodesk’s Revit Architecture Forums. Share your knowledge, ask questions, and explore popular Revit Architecture topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using text files exported from REVIT

5 REPLIES 5
Reply
Message 1 of 6
Anonymous
977 Views, 5 Replies

Using text files exported from REVIT

Nutshell: revit text files have some hidden characters that prevent normal processing by scripting tools. Using excel to open them up and save them back out somehow cleans them up.  Does any one have any idea about why this is?

 

Longer version:

I have exported a sheet index schedule from Revit as a delimited text file, and have been writing a script using it as input to rename exported dwgs and pdfs.  I'm not sure how many people out there in Revit land do this kind of thing but I had a strange problem with the text file as written by Revit: when reading the file line by line with Windows scripting (Wscript) I would get a bunch of strange characters leading to errors.  The text file looks perfectly normal in notepad and excel.  By some miracle of coincidence I decided that the tab delimeter was causing the issues, so I opened the file in excel and wrote it back out as a comma delimeted file, and the script began to work.  Unfortunately we use commas in our sheet names though so some of the file name changes got messed up.  I decided to go back to tab delimeted, and started encountering the same problem.  It finally occurred to me that opening the file in excel and writing it back out as text still (either tab or comma delimeted) fixed the problem.

 

The genesis of this was that we have some complicated file naming requirements by our contract, and we have been renaming the files (dwg and pdf) by hand which is prone to error and somewhat time consuming.  I have done a lot of software development so I decided to automate the process with a simple script and a text file with the fields required to do the renaming exported from the revit model.

5 REPLIES 5
Message 2 of 6
BIMologist_
in reply to: Anonymous

can you upload the problem text file to take a look at?


BIMologist / Dr. Revit
Approved Autodesk Services Marketplace provider - BIM Consulting

EESignature


If you find this reply helpful, please use the Accept Solution or Like button below
Message 3 of 6
Anonymous
in reply to: Anonymous

I will check with my boss to make sure nothing is considered confidential.  As near as I can tell I think it is the end of line marker that revit may use that messes up the Wscript text processing.  When I run a script to simply read the file line by line, and write a log file line by line, the resulting log file is all on a single line ( but wrapped at 1024 characters) and every other line is written in some kind of asian unicode character set.  I think the process of opening the file in excel and outputting to tab delimited strips out this character because the same script operates as expected with the excel written but otherwise equivalent file.

Message 4 of 6
BIMologist_
in reply to: Anonymous

I would recommend that you download Notepad ++ (Free) http://notepad-plus-plus.org/ . It has a button similar to Word to show all (hidden) Characters. This will help you diagnose better View->Show Symbol->Show All Characters or View->Show Symbol->Show White Space and Tab


BIMologist / Dr. Revit
Approved Autodesk Services Marketplace provider - BIM Consulting

EESignature


If you find this reply helpful, please use the Accept Solution or Like button below
Message 5 of 6
Anonymous
in reply to: Anonymous

Thank you for the suggestion, I will look into that.  I did open the file with Word which asked me to chose an encoding . . . defaulting to unicode, which made the file read normally.  I chose windows encoding which shows me some kind of escape character before each character when I show symbols, and an escape character before the first character in the file regardless.  So it must be some difficulty of the unicode encoding that revit writes versus how windows writes it, or getting the scripts to properly read unicode.  I will do further testing.

Message 6 of 6
Anonymous
in reply to: Anonymous

Ahhhh yes it is unicode, and the vbscript file handling default to ascii . . so I end up with 8 bits of nonsense that messes up the string handling methods.  so the "problem" is operator error rather than revit, which seems to be operating as designed.  I must have been writing out the file as tab delimited ascii from excel, and not realizing that the original file was unicode.  the diff tools provided by powershell also did not indicate this as a difference between the files.  Thanks for the notepad++ tip which started me down the right path!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report


Autodesk Design & Make Report