Select by area +/-"X"%?
-
Is there a script that does this?
Why I need it: I created a tree with lots of faces in another program and imported it into SU. Unfortunately all of the faces that are leaves are not components. so that means a lot of geometry. Same goes for the branches and trunk. I'd like to select just the leaves and replace them with a component, but there's obviously hundreds of leaves. Scores of branches make selecting them a PITB too.
Thing is, the leaves are all the same surface area +/- a few %, so if there's a way to select faces by area +/- "X"%, that'd be a huge timesaver.
-
There is a plug by Chris Fullmer who select something with the same size
Select lines by length
Maybe that can help -
You would still be having to exclude faces in the tree and branch structure that happen to fall within this %range.
If it is possible, perhaps, select only tree and branch geometry, or portions thereof, and either group them or componentize them.
Then either hide the tree components/groups, or move them aside a known distance along a specific axis.
Or Select All, Unselect the group/comp, and then group the leaf selection set in the same way.Or did I misunderstand the scenario?
Only meant to assistEdit: I see that you may already be aware of the above approach. Please excuse.
-
i use a plugin that should work - i believe it is thomthom's selection toys - http://forums.sketchucation.com/viewtopic.php?f=180&t=14975 . i can't remember exactly though, it may be another selection script.
if your leaves have a separate material applied, you can right click > select > same material. you will select all the leaf faces, and then if necessary, you should also be able to use the script again to select all lines forming the leaf faces.
-
Unfortunately everything is the default material.
-
Set your Model Info > Units temporarily to 'inches' - that's just to make my calculations easier .
Find a typical leaf face and get Entity Info and note its area.
Decide what +/- % would be OK.
Select stuff that includes the leaves - other stuff will be ignored or skipped over.
Run this line in the Ruby Console - substituting numerical values formin
andmax
equivalent to the leaf ares -% and leaf area +% - NOTE: IN SQUARE INCHES - e.g. 3.0 and 4.0 ...m=Sketchup.active_model;s=m.selection;fs=[];s.to_a.each{|e|fs<<e if e.class==Sketchup;;Face and (e.area>= min or e.area<= max};s.clear;s.add(fa)
You should now have all faces selected that have areas within those limits - paint them with a unique material so you can access them by material later...
PS: If the leaves are inside groups then we need to add something to iterate through all selected groups and paint any matching faces with a certain color ['green' for example]... If so ask for more code...
-
TIG,
Thanks for the code! I haven't had a chance to implement it yet, just had a new addition to the family and have been busy since 24th Jul. No time for SU, and this is the first chance I've had to view the forums in weeks.
Advertisement