OpeningDesign / OD_Library

This library has moved to: https://gitlab.com/openingdesign/OD_Library
34 stars 6 forks source link

A CSV to Revit Key Schedule that supports linebreaks/newlines [$100 awarded] #1

Closed theoryshaw closed 7 years ago

theoryshaw commented 7 years ago

In a nutshell, basically looking to read the CSV file, in the following link, into Revit (via Dynamo) and have it retain the linebreaks/newlines in the schedule.

https://github.com/OpeningDesign/OD_Library/tree/98defd6104d884d4ae8607bbaeeba8bcda1bab4d/BIM/Dynamo%20Scripts/Finish%20Key/Read

As you can see from these files, I tried to take a stab at the graph using a number of @ksobon's Archi-Lab nodes.


There's another quirky part of this, which I could not figure out, is that when the CSV was updated, and the graph was run, it did not overwrite all the rows--a few old rows remained.


There is a $100 open bounty on this issue. Add to the bounty at Bountysource.

--- The **[$100 bounty](https://www.bountysource.com/issues/40742531-a-csv-to-revit-key-schedule-that-supports-linebreaks-newlines?utm_campaign=plugin&utm_content=tracker%2F12208534&utm_medium=issues&utm_source=github)** on this issue has been claimed at [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F12208534&utm_medium=issues&utm_source=github).
theoryshaw commented 7 years ago

Hi @dimven

I think I spoke too soon. Upon further review, it doesn't look like the newlines/breaklines were brought into the revit schedule correctly

image

Intended them to look like this...

image

dimven commented 7 years ago

Ah! When I first tried manually to add a new line to a field (by pressing enter), the cell just shifted, so I thought that Revit doesn't support new lines. That's why I automatically replaced all new lines with ", ".

But now that I tested it again, it seems that revit doesn't mind the new lines at all. I've revised the script and added aditional options, to better control the string representation.

On 10 January 2017 at 11:54, Ryan Schultz notifications@github.com wrote:

Hi @dimven https://github.com/dimven

I think I spoke too soon. Upon further review, it doesn't look like the newlines/breaklines were brought into the revit schedule correctly

[image: image] https://cloud.githubusercontent.com/assets/507113/21793316/c13c1f82-d6b5-11e6-98ed-e9a69b22d123.png

Intended them to look like this...

[image: image] https://cloud.githubusercontent.com/assets/507113/21793339/00d36b78-d6b6-11e6-8ac6-6b8dd055dd39.png

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/OpeningDesign/OD_Library/issues/1#issuecomment-271480047, or mute the thread https://github.com/notifications/unsubscribe-auth/AG0TajAisf2EVXuVne6LMQ73XFMlBWDuks5rQwD8gaJpZM4LdwLO .

theoryshaw commented 7 years ago

Beautiful. Thanks @dimven!

theoryshaw commented 6 years ago

Hi @dimven Hope all is well.

I might be missing something, but it appears when I use a Quotation Mark (") in the value, it breaks the import.

Does your solution here, escape Quotation Marks (") ?... or do I need to save the CSV with different delimters?

Specific CSV, if curious: https://github.com/OpeningDesign/OD_Library/commit/0ca52cfa2b4e723712f0ab6a27a5548881f8b320

dimven commented 6 years ago

Hi Ryan,

Had a quick look. There's two problems I see - the file is encoded as 'ascii' but contains unicode characters and secondly, even after I changed the encoding to utf-8 and fixed the incorrect characters, Revit's API doesn't seem to accept the unicode strings. I tried the csv module that's included with the archi-lab package, but that didn't fair any better.

The only thing I can offer is a workflow that automatically strips the unknown characters: image

Finish Key_Read.zip

Edit: using a module that ignores the file encoding seems to produce the best results - Finish Key_Read.zip

theoryshaw commented 6 years ago

Thanks @dimven

So using a " is not possible?

dimven commented 6 years ago

Try the second file I posted , that seems to work fine with the file as it is , because the " in the file is a special unicode character and is different from the regular ascii quote character used by the csv format - https://github.com/OpeningDesign/OD_Library/files/1757367/Finish.Key_Read.zip

theoryshaw commented 6 years ago

Hi @dimven

As you can see in the following video, the script gets hung up on 'starting'... https://www.dropbox.com/s/zhfbrzqzv3wha41/2018-03-10_10-10-17.mp4?dl=0

Files used: https://github.com/OpeningDesign/OD_Library/commit/1ffcd83bab6caa1b228714a73f373841995f8dad

dimven commented 6 years ago

Make sure you don't have anything selected or any windows (type properties, etc) open in Revit. That may sometimes block Dynamo. The latest file is properly encoded in utf-8. If you can guarantee that all files going forward are encoded the same way, the below graph should work as expected:

Finish Key_Read_3.zip

2018-03-12_11-06-18

theoryshaw commented 6 years ago

Bingo! thanks @dimven!