hi guys I am trying to compare some data so I create one file name
called “Price_lookup” in notepad then saved in plugin folder
“Price_lookup.csv”.
Price_lookup.csv contain like below
then I wrote small ruby script for testing. when I start the sketchup
It’s gives an error as follows “Error Loading File CSV_Test.rb no such
file to load – csv”. any idea what I am doing wrong here??? thank you
here is my code.
require 'sketchup.rb'
require 'csv'
def csv_Test
model = Sketchup.active_model
ent = model.active_entities
csv_text = File.read('Price_lookup.csv')
csv = CSV.parse(csv_text, :headers => true)
csv.each do |row|
result = csv.find {|row| row['PARTNO'] == '600181'}
UI.messagebox "Your Output #{result}"
end
end
if (not $csv_Test_menu_loaded)
UI.menu("Tools").add_item("CSV_TEST") { csv_Test }
$csv_Test_menu_loaded = true
end
– Richard Wilson
Proteous Trading Group
ph. - (604) 842 5318
Skype - r.crawfordwilson
email - [email protected]
This email may contain confidential and/or privileged information. If
you
are not the intended recipient or have received this email in error,
please
notify the sender immediately and destroy this email. Any unauthorized
copying, disclosure or distribution of the information contained on this
email is prohibited.
then I wrote small ruby script for testing. when I start the sketchup
It’s gives an error as follows “Error Loading File CSV_Test.rb no such
file to load – csv”. any idea what I am doing wrong here??? thank you
then I wrote small ruby script for testing. when I start the sketchup
It’s gives an error as follows “Error Loading File CSV_Test.rb no such
file to load – csv”. any idea what I am doing wrong here??? thank you
CSV.open("/home/user1/sample.csv", “r”, :headers => true) do |csv|
puts “got all contents from file #{csv}”
not iterate each row
csv.each do |row|
puts “Each row #{row}”
end
end
try this…if not let me know your ruby version and OS details…
doesnot work
I am using sketchup pro 8 and os is windows xp not ruby or rubygems.
what I am trying to do here I have sunroom model it has doors and
windows
I set it up attribute like part number and price. but the price is will
change every year. that’s why I create simple csv file called
“price_lookup.csv” It will take part number and compare the price. this
way for me to easy to update just price in the csv file. I think you
will get the Idea now.let me know what I missing here
thanks for the reply