sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Select by area +/-"X"%?

    Scheduled Pinned Locked Moved Plugins
    7 Posts 5 Posters 1.0k Views 5 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • EscapeArtistE Offline
      EscapeArtist
      last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • pilouP Offline
        pilou
        last edited by

        There is a plug by Chris Fullmer who select something with the same size
        Select lines by length
        Maybe that can help 😄

        Frenchy Pilou
        Is beautiful that please without concept!
        My Little site :)

        1 Reply Last reply Reply Quote 0
        • mitcorbM Offline
          mitcorb
          last edited by

          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 assist 😄

          Edit: I see that you may already be aware of the above approach. Please excuse.

          I take the slow, deliberate approach in my aimless wandering.

          1 Reply Last reply Reply Quote 0
          • A Offline
            autarchos
            last edited by

            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.

            1 Reply Last reply Reply Quote 0
            • EscapeArtistE Offline
              EscapeArtist
              last edited by

              Unfortunately everything is the default material.

              1 Reply Last reply Reply Quote 0
              • TIGT Offline
                TIG Moderator
                last edited by

                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 for min and max 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

                1 Reply Last reply Reply Quote 0
                • EscapeArtistE Offline
                  EscapeArtist
                  last edited by

                  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.

                  1 Reply Last reply Reply Quote 0
                  • 1 / 1
                  • First post
                    Last post
                  Buy SketchPlus
                  Buy SUbD
                  Buy WrapR
                  Buy eBook
                  Buy Modelur
                  Buy Vertex Tools
                  Buy SketchCuisine
                  Buy FormFonts

                  Advertisement