Hello everybody,
I’m at my first post here (hence you can guess about my experience in Dynamo).
I haven’t any picture to share for the while since my board is still pretty messy, but
what I am trying to do is to import dozens (well, actually around 900…) Autocad .pat files stored in a directory on my pc and to generate filled regions.
Imagine what I want to achieve is to have a revit template file with just an abacus of filled regions that I can copy-paste into other projects.
I won’t give too many details (feel free to ask in case you need) but the issue I am dealing with is that I can’t succeed in “cleaning” the unnecessary strings from some files.
Now I reached the point of having every .csv line organized into a list of strings like this:
*001
value, value, value, value, value, value
value, value, value, value, value, value
value, value, value, value, value, value
value, value, value, value, value, value
*002
value, value, value, value, value, value
value, value, value, value, value, value
value, value, value, value, value, value
*003
value, value, value, value, value, value
value, value, value, value, value, value
and I find out how to separate the lines starting with * (representing the .pat file name) - That’s a real hype if you’re new to the task
Problems are:
1- (Even) using the same method I can’t drop out from the list the comment strings inside the .csv files (starting with ;; or ;), which are not containing values to use for creating the patterns and shall be skipped
2-When I bool filter the strings starting with “*” everythings works perfectly fine except for one single line (the first line of the second file actually), so that I get an OUT list with all the string of values (plus this single string, plus the comment string) and an IN list with all others strings starting by “*” (every first line of each file).
I was also able to cross these lists and split the unique giant list in several lists (being the content of each single file, organized in rows containing 6 values each) and it seemed to work, except for those non-homogeneous behaviours I described. Moreover, obviously not every .csv file has the same number of strings, and only some have comments lines, so it is impossible on such a large amount of data to work by index or range (or am I missing something?)
Maybe there is a smarter way to do this but I am new to Dynamo and Python, and trying to use this as an opportunity to approach these tools for data-related tasks (for Revit), so any help will be truly appreciated.
So, my very specific question is: Why can’t I get rid of those strings? And how do I accomplish that? Not only the characters, but the whole string starting with/containing ;; so that I can automate the cleaning of files.
Of course, I’d like to automate the task, so when I add new files to my directory they can be automatically processed by dynamo, but how?
Thank you very much, feel free to suggest me also tutorials and guides on this topic (I am checking some but still searching)
M