I have used the “export schedule” Dynamo script shared in this website to export my Revit schedules to text files. However, I would like expand the script to further convert the text files format from Unicode to ANSI with Python script.
Is it possible? Can anyone help me on this?
Please sum up first some infos out of your preliminary researches that make clear that Dynamo is the best tool for this task:
Thanks for the reply. My current solution is batch file too, similar to the one that you shared with me.
However, I still hope that I can combine the procedure in a Dynamo script to ease the work.
Thank you again for the prompt reply.
Please send also related researches links, you will easily find online resources and will need to make a first proposal:
Thanks for the reply. I have try the Python script with “import io”. Unfortunately I get warning message as below:
Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 1, in
ImportError: No module named io
I am not sure what caused this.
You can paste your code here this way:
By doing so, you make it easier for everyone to grasp where the problem lies and what could be the appropriate answer
Screenshot of my dynamo script:
Here is the code:
src_path = (IN)
with io.open(src_path, mode="r", encoding="Unicode") as fd:
content = fd.read()
with io.open(dst_path, mode="w", encoding="ANSI") as fd:
Hope you can help me on this.
Thanks & regards,
I readed your problems about change enconding in dynamo and would I like to know if you solved this problems if you can help me with it? because I have the same question
I am export my schedules in unicode and I want change to ANSI with python script.
Unfortunately i am still looking for solution to this problem until today. However, i have just requested for help from Autodesk technical support team. Hopefully they will get back to me with a solution soon. If they do, i will update here.
Thank you so much for reply!
I am waiting for reply with you. But how did you send the question to them? Existy some email or anything like this? Because I can send to them the same question, some times we can get the answer fastest
Just stumbled upon your issue.
In order to import libraries form the IronPython lib you need to add a reference to the location in your python script, so in order to use “io” you should add this line above “import io”:
sys.path.append("C:\Program Files (x86)\IronPython 2.7\Lib")
I met one of the Autodesk technical specialists during an event recently. I just verbally told him my issue and passed him my name card. Looking forward to his reply shortly.
Thanks & regards,
Thanks for your reply. Yes, i noticed about that and added that in my Python script. Unfortunately it’s still not working.
I would like to give it a go, it should very well be possible to do the convertion from unicode to ANSI within python. If you would like me to try please upload a .dyn file, and a sample .rvt file that I can perform the test on. (.rvt file should contain relevant schedules, and .dyn file should contain working graph for “standard” export of schedues incl python script).
Can you Share Your Unicode file?
That would be great! Thank you very much.
I will upload the files on next Monday, when i back to office.
Thank & regards,
I do not have the files with me now. I will upload a sample on the next Monday when i back to office.
FYI, any Revit schedule exported from Revit will be saved in Unicode encoding by default.
Thanks & regards,
The script below works :
sys.path.append(r'C:\Program Files (x86)\IronPython 2.7\Lib')
src_path = IN
dst_path = IN
with codecs.open(src_path, 'r', encoding = 'UTF-16') as file:
lines = file.read()
#write output file
with codecs.open(dst_path, 'w', encoding = 'latin-1') as file:
OUT = 0
You can modify it to handle a list of text files or make a custom node with lacing on longest.
Hi and happy Friday.
First I found out that Python doesn’t have an ANSI encoding which made me look up what is ANSI.
And it turns out it can be different on different systems.
Other than that what @Alban_de_Chasteigner posted should work
or even something as simple as that:
Have a great weekend!
Hi, guys, Thanks for reply!
Your tips worked to my documents, but one document for time. However, I have diferents documents and I would like change enconding in the same time of every documents and I tried to do like this:
But It didn’t work