Ruby Script question re soften certain lines only
- 
 How hard would it be to write a Ruby Script that made all vertical lines in a model soft and smooth please? 
- 
 Easy. model = Sketchup.active_model model.entities.each { |e| if e.is_a?(Sketchup;;Edge) && e.line[1].parallel?(Z_AXIS) e.soft = true e.smooth = true end } model.definitions.each { |d| if e.is_a?(Sketchup;;Edge) && e.line[1].parallel?(Z_AXIS) e.soft = true e.smooth = true end }(Sorry - don't have time to wrap it up in menu system atm) 
- 
 Hey, thanks a lot for that quick response. Actually what I should really have asked is how do I select all vertical lines. Then I can do whatever I want with them. 
- 
 Tried to finish it off but getting syntax error on the last line. Never created one before. Any ideas please? File is called softenv.rb and is in the plugins folder: Soften all vertical lines in a modelrequire 'sketchup.rb' def soften_vert model = Sketchup.active_model model.entities.each { |e| 
 if e.is_a?(Sketchup::Edge) && e.line[1].parallel?(Z_AXIS)
 e.soft = true
 e.smooth = true
 end
 }
 model.definitions.each { |d|
 if e.is_a?(Sketchup::Edge) && e.line[1].parallel?(Z_AXIS)
 e.soft = true
 e.smooth = true
 end
 }if( not file_loaded?("softenv.rb") ) 
 add_separator_to_menu("Plugins")
 UI.menu("Plugins").add_item("Soften vertical lines") { soften_vert }end file_loaded("softenv.rb") 
- 
 Ok, I think I was missing an "end" on the last if statement. Fixed that and now get no syntax errors but the option does not appear on the Plugins menu when I restart SU... 
- 
 Shuffled things around a bit by copying other scripts and got the menu item to appear. Not sure how. But when I select the option nothing happens: Soften all vertical lines in a modelrequire 'sketchup.rb' def abc 
 model = Sketchup.active_modelmodel.entities.each { |e| 
 if e.is_a?(Sketchup::Edge) && e.line[1].parallel?(Z_AXIS)
 e.soft = true
 e.smooth = true
 end
 }
 model.definitions.each { |d|
 if e.is_a?(Sketchup::Edge) && e.line[1].parallel?(Z_AXIS)
 e.soft = true
 e.smooth = true
 end
 }end name = "softenv.rb" 
 unless file_loaded?(name)
 UI.menu("Plugins").add_item("Soften verticals") { abc }
 file_loaded name
 end
Advertisement

 
                             
                             
                             
                             
                             
                             
                            