sketchucation logo sketchucation
    • Login
    1. Home
    2. conradcliff
    πŸ›£οΈ Road Profile Builder | Generate roads, curbs and pavements easily Download
    C
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 1
    • Groups 1

    conradcliff

    @conradcliff

    0
    Reputation
    1
    Profile views
    1
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    conradcliff Unfollow Follow
    registered-users

    Latest posts made by conradcliff

    • Ruby script compatibility issue..IN vs. Metric

      SketchUp version: 7.1.6860
      Operating system: XP SP3

      Hey 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")
      
      posted in Plugins
      C
      conradcliff