oh! i also forgot to mention that the 1900 colors is broken up by color family in 9 separate csv files totaling 1900 colors. none of the csvs are over 400 colors.
n = h['Name'].rstrip.split(' ').map {|word| word.capitalize}.join(' ')
… I came across this example in the ol’ Pick Axe book …
text.gsub(/\b\w/) { $&.upcase }
I just used it yesterday and wrapped it a method named titlecase(text).
Whether 4000 or 1900, I’d not actually create any more than one internal material and color.
Add it, name it, set it’s color, save as it to disk …
Rename it, set the material’s color’s RGB components to new values, save as …
repeat …
No GC needed.
Would there be an issue with using one material (that I didn’t see ?)
@DanRathbun@john_drivenupthewall - I tried a few of the csv files and made sure that each one had the header set to Name and still got the same error when using the latest version (v6 I believe) of the Ruby code.
Could it have something to do with the fact that the csv files I’m using have only Name, R, G, B as the headers? I concatenated color number and color name from the original Excel spreadsheets when I created the csv’s so they’re different than the sample file.
swapping in this chunk will work with your ‘new’ headers, but won’t for standard headers…
# for modified .csv files and concatenated names
# create array of name and hex value
require 'csv.rb'
csv_data = CSV.foreach(file, headers: true).map do |row|
n = row[0].rstrip.split(' ').map(&:capitalize).join(' ')
c = row[1..3].map(&:to_i)
[n,c]
end
I may find time to create a ‘catch all’ version, but it would be easier to use the original format and and concatenated names using ruby…
@john_drivenupthewall - Thanks for the swap. I tried it and it sort of worked. There were no error messages and all of the color names and values are showing in the Ruby console but only the last color in the csv pulled into the materials panel In Model. I’m sorry this has been such a colossal pain!
@john_drivenupthewall - they’re in there now! I guess I jumped the gun and didn’t let them process all the way. Woohoo! One quick thing though - the color names (ie. PPU25-08 HEIRLOOM SILVER) are supposed to be all uppercase. Is there a way for the script to not change the names and numbers? I realize all uppercase looks like yelling but that’s how they want it.