Ruby script compatibility issue..IN vs. Metric
-
SketchUp version: 7.1.6860
Operating system: XP SP3Hey guys, first post here, looks like a great forum

So I have a bit of a problem..I've created this fairly complicated drawing using components created for google sketchup by the company that provides the actual materials and machines them for you.
Well, along with the components they provide a ruby script to create a bill of materials after you've finished your drawing...the problem is that you apparently You must being drawing with your Sketchup Preferences Template set to:"Inches (Woodworking) - 2D"
I've drawn the whole thing up in the metric woodworking template since I was using their metric products.
Below is the script they provide free of charge on their website, if anyone could give some insight on what needs to be done in order for it to work with the metric template, or if it could work at all, I would really, REALLY appreciate it. Thanks!

#v1.1.0 def get_instance(ent, def_name) output = "" ent.instances.each do |e| orig = e.transformation.origin # output << "#{def_name},#{e.bounds.width},#{e.bounds.depth},#{e.bounds.height},#{orig.x},#{orig.y},#{orig.z}\n" output << "#{def_name},#{e.bounds.width},#{e.bounds.depth},#{e.bounds.height}\n" end output end def get_all_items out = "" Sketchup.active_model.definitions.each do |e| out << get_instance(e, e.name) end out end def get_instance_login(ent, def_name) output = "" ent.instances.each do |e| orig = e.transformation.origin # output << "#{def_name},#{e.bounds.width},#{e.bounds.depth},#{e.bounds.height},#{orig.x},#{orig.y},#{orig.z};" output << "#{def_name},#{e.bounds.width},#{e.bounds.depth},#{e.bounds.height};" end output end def get_all_items_login out = "" Sketchup.active_model.definitions.each do |e| out << get_instance_login(e, e.name) end out end def export_items flomoco_login = "demo@flomoco.com" if(flomoco_login != "") model_data = "FloMoCo Component Reporter v1.1.0\n" model_data = model_data + get_all_items_login #model_data.gsub!('"','%22') #model_data.gsub!('~','%7E') web_data = "remail=" + flomoco_login + "&data=" + model_data; dialog = UI;;WebDialog.new("FloMoCo 80/20 Instant Quoter", true, "FloMoCo_Quoter_Page", 50,50, 20, 20, true) dialog.show dialog.post_url("http://www.flomoco.com/c/8020_IQ_Login.pl",web_data) UI.openURL "http://www.flomoco.com/c/8020_IQ_Login.pl?temail=#{flomoco_login}" else file_name = File.dirname(__FILE__)+"/FloMoCo_8020_BoM.txt" f = File.new(file_name,"w") model_data = "FloMoCo Component Reporter v1.1.0\n" model_data = model_data + get_all_items f.write model_data f.close UI.openURL "file;//#{file_name}" end end if( not file_loaded?("FloMoCo_8020_quoter.rb") ) add_separator_to_menu("Plugins") UI.menu("Plugins").add_item("Generate FloMoCo 8020 BoM...") { export_items} end#if file_loaded("FloMoCo_8020_quoter.rb") -
If they need the dimensions in inches set your model units to Inches in Model Info > Units.
Open the Woodwork Inch template and note these settings and mimic then in tour model - you can swap units at any time. Sketchup uses Inches as its internal units, no matter what you model in. Indeed you can model in mm, you type 1000 OR 1000mm to get a line that length, BUT with your units still set to mm type 1m in the VCB and you'll get a 1m [1000mm] long line or even 40" to get one 40" long etc ! -
I don't see anything in that code the relates to any units. Appear to be only a small part of the code. Something that has to be adjusted on their side. Have you approached them about metric support?
-
@conradcliff said:
I've drawn the whole thing up in the metric woodworking template since I was using their metric products.
If the unit of your model is centimeter, then just add
.cmat the end of thewidth,depthandheightproperties. This will convert them into inches to the output.output << "#{def_name},#{e.bounds.width.cm},#{e.bounds.depth.cm},#{e.bounds.height.cm}\n"If your model unit is meter, then use
.minstead.Fredo
-
After scanning the FloMoCo plugin, it don't see how it can be reporting the correct dimensions.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement