sketchucation logo sketchucation
    • Login
    1. Home
    2. blue_orchid
    3. Topics
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    B
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 8
    • Posts 25
    • Groups 1

    Topics

    • B

      Display image using Ruby API

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      9
      0 Votes
      9 Posts
      341 Views
      B
      Ya, WebDialog is also fine.
    • B

      Remove color using ruby

      Watching Ignoring Scheduled Pinned Locked Moved SketchUp Components, Materials & Styles sketchup
      2
      0 Votes
      2 Posts
      528 Views
      A
      [%(#BF0000)[Drawingelement.material]](http://code.google.com/apis/sketchup/docs/ourdoc/drawingelement.html#material) = nil For example: face = Sketchup.active_model.selection[0] face.material = nil face.back_material = nil ( Side note: If you wanted to remove only the color from a texture (when a texture is colorized), it seems not to work with material.color = nil, but turns it black )
    • B

      Color the DC conditioning on its attributes & values (MYSQL

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      23
      0 Votes
      23 Posts
      645 Views
      B
      This code finally worked UI.menu("Plugins").add_item('Assesment') { Inspection.color } require 'mysql' module Inspection def self.color dbh = Mysql.real_connect("localhost", "root", "***", "test",3306) dbh.query("drop table if exists inspection") dbh.query("create table inspection(component varchar(20), ID int(4), rating int(1))") dbh.query("insert into inspection values('deck',2345,2),('Substructure',2349,1),('Superstructure',2353,3)") res = dbh.query("SELECT rating FROM inspection where id = '2345'") while row = res.fetch_row do xx = row[0] printf "%s\n", xx end res1 = dbh.query("SELECT rating FROM inspection where id = '2349'") while row = res1.fetch_row do xy = row[0] printf "%s\n", xy end res2 = dbh.query("SELECT rating FROM inspection where id = '2353'") while row = res2.fetch_row do yy = row[0] printf "%s\n", yy end Sketchup.active_model.entities.to_a.each{|e| if e.get_attribute('dynamic_attributes','id','')=='2345'&& xx=='1' e.set_attribute('dynamic_attributes','rating','1') elsif e.get_attribute('dynamic_attributes','id','')=='2345'&& xx=='2' e.set_attribute('dynamic_attributes','rating','2') elsif e.get_attribute('dynamic_attributes','id','')=='2345'&& xx=='3' e.set_attribute('dynamic_attributes','rating','3') end } Sketchup.active_model.entities.to_a.each{|e| if e.get_attribute('dynamic_attributes','id','')=='2349'&& xy=='1' e.set_attribute('dynamic_attributes','rating','1') elsif e.get_attribute('dynamic_attributes','id','')=='2349'&& xy=='2' e.set_attribute('dynamic_attributes','rating','2') elsif e.get_attribute('dynamic_attributes','id','')=='2349'&& xy=='3' e.set_attribute('dynamic_attributes','rating','3') end } Sketchup.active_model.entities.to_a.each{|e| if e.get_attribute('dynamic_attributes','id','')=='2353'&& yy=='1' e.set_attribute('dynamic_attributes','rating','1') elsif e.get_attribute('dynamic_attributes','id','')=='2353'&& yy=='2' e.set_attribute('dynamic_attributes','rating','2') elsif e.get_attribute('dynamic_attributes','id','')=='2353'&& yy=='3' e.set_attribute('dynamic_attributes','rating','3') end } Sketchup.active_model.entities.to_a.each{|e| if e.get_attribute('dynamic_attributes','rating','')=='1' e.set_attribute( 'dynamic_attributes', 'material', 'black') e.set_attribute( 'dynamic_attributes', '_material_formula', '"black"') $dc_observers.get_latest_class.redraw_with_undo(e) elsif e.get_attribute('dynamic_attributes','rating','')=='2' e.set_attribute( 'dynamic_attributes', 'material', 'blue') e.set_attribute( 'dynamic_attributes', '_material_formula', '"blue"') $dc_observers.get_latest_class.redraw_with_undo(e) elsif e.get_attribute('dynamic_attributes','rating','')=='3' e.set_attribute( 'dynamic_attributes', 'material', 'red') e.set_attribute( 'dynamic_attributes', '_material_formula', '"red"') $dc_observers.get_latest_class.redraw_with_undo(e) end } end end Thanks to all.
    • B

      Color components

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      10
      0 Votes
      10 Posts
      251 Views
      TIGT
      IDs do not subsist across sessions as they are re set every time the SKP opens. You must give entities attributes which will be carried across sessions to find them successfully...
    • B

      Selection of Dynamic component using ruby

      Watching Ignoring Scheduled Pinned Locked Moved Dynamic Components sketchup
      5
      0 Votes
      5 Posts
      722 Views
      Chris FullmerC
      If you are trying to figure out how to determine if a component is dynamic or not, then like Thom suggested - it is just a regular component with special libraries attached to it. So you would iterate through all the component definitions in the model and find the ones that have the dynamic component attribute library. Then you would select all of their instances, or you would need some other criteria to determine which single instance you want. Do you know how you are planning on singling out the specific instance you want to select?
    • B

      Dynamic component, Ruby and MySQL

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      2
      0 Votes
      2 Posts
      445 Views
      TIGT
      This is only going to be accessible to those user who have require 'mysql' accessible... Can you be a little more generic in your question ? OR perhaps more specific... and change the post's title to say ' MySQL, Ruby and Dynamic-Components - HELP!'
    • B

      Google Sketchup and MySQL

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      2
      0 Votes
      2 Posts
      478 Views
      Dan RathbunD
      The forum search should have brought up this topic, that's only a few days old: How to Connect Ruby to MySQL
    • B

      Color the component according to dynamic component attribute

      Watching Ignoring Scheduled Pinned Locked Moved Newbie Forum sketchup
      5
      0 Votes
      5 Posts
      1k Views
      B
      thanks a lot. it worked. You saved my day... How do u guys learn ruby for sketchup? What are the basic requirements (computer knowledge) to start ruby? I wish i could learn efficiently and quickly. Thanks again.
    • 1 / 1