Unhide/unsoften edges?
-
I'm looking for a script that can iterate through nested groups and unhide/unsoften all edges.
I've found two scripts but none of them worked for me. "unhide_all.rb" by TBD and Fredos "HideAllEdges.rb" (that also does unhide).
Is there another script? -
Try this one-liner, copy+paste in the Ruby Console + <enter> - it goes through all edges in groups and undoes hidden/soft/smooth.
m=Sketchup.active_model;m.start_operation('UN...');m.definitions.each{|d|next unless d.group?;d.entities.grep(Sketchup;;Edge).each{|e|e.hidden=false;e.smooth=false;e.soft=false}};m.commit_operation
It's one step undo-able.
It doesn't process geometry in the model or inside components...
This version processes groups & model geometry...m=Sketchup.active_model;m.start_operation('UN...');m.definitions.each{|d|next unless d.group?;d.entities.grep(Sketchup;;Edge).each{|e|e.hidden=false;e.smooth=false;e.soft=false}};m.entities.grep(Sketchup;;Edge).each{|e|e.hidden=false;e.smooth=false;e.soft=false};m.commit_operation
This one also does the same for all components [groups & model-geometry are ignored]...
m=Sketchup.active_model;m.start_operation('UN...');m.definitions.each{|d|next if d.group? || d.image?;d.entities.grep(Sketchup;;Edge).each{|e|e.hidden=false;e.smooth=false;e.soft=false}};m.commit_operation
I think you know how to make these into proper Plugins...
-
-
Thanks TIG. I will try them.
3dsmax9, i found that one too but it ran for an hour and then I force quit SU. -
The third one worked. Took some time to run though. Big thanks for the help.
-
Just found this solution, and it works really great! I'm trying to turn it into a plugin but I don't know how. Is it possible to point me on a direction to make it work please?
Thanks in advance.@tig said:
Try this one-liner, copy+paste in the Ruby Console + <enter> - it goes through all edges in groups and undoes hidden/soft/smooth.
m=Sketchup.active_model;m.start_operation('UN...');m.definitions.each{|d|next unless d.group?;d.entities.grep(Sketchup;;Edge).each{|e|e.hidden=false;e.smooth=false;e.soft=false}};m.commit_operation
It's one step undo-able.
It doesn't process geometry in the model or inside components...
This version processes groups & model geometry...m=Sketchup.active_model;m.start_operation('UN...');m.definitions.each{|d|next unless d.group?;d.entities.grep(Sketchup;;Edge).each{|e|e.hidden=false;e.smooth=false;e.soft=false}};m.entities.grep(Sketchup;;Edge).each{|e|e.hidden=false;e.smooth=false;e.soft=false};m.commit_operation
This one also does the same for all components [groups & model-geometry are ignored]...
m=Sketchup.active_model;m.start_operation('UN...');m.definitions.each{|d|next if d.group? || d.image?;d.entities.grep(Sketchup;;Edge).each{|e|e.hidden=false;e.smooth=false;e.soft=false}};m.commit_operation
I think you know how to make these into proper Plugins...
-
To make a short script to do this...
Use Notepad++ [or TextWrangler on MAC] to make a plain-text file that must be UFT8 encoded.
Name it saymyUN.rb
It goes in your user's Plugins folder.
Find that using this snippet in the Ruby Console:UI.openURL("file;///#{Sketchup.find_support_file('Plugins')}")
Then add one line of text as follows + return, substituting the desired code you wish to run, where I have put
CODE
[copy paste from the previous examples as desired]; you can also name the menu item as you wish - I've named it"myUN..."
UI.menu("Plugins").add_item("myUN..."){CODE}
After SketchUp restarts the new menu item should be seen in the Plugins menu - which is now called the 'Extensions' menu in newer SketchUp versions...
Select that menu item to run the code...Also remember that you will need the Extension Manager Loading Policy set to Unrestricted to run your own 'unsigned' scripts...
Advertisement