sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Select all faces facing a road

    Scheduled Pinned Locked Moved SketchUp Discussions
    sketchup
    9 Posts 3 Posters 178 Views 3 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.
    • R Offline
      ryangarnett
      last edited by

      Hello All,

      I was wondering if there is a way, or a plugin, that will select all faces that face a road. For example, if I have a series of rowhouses that face a road, is there a way to just select the road facing faces? I would be ok with drawing a temporary line that would represent the road, if that is needed for the selection process. I have attached an image of the sample rowhouses and the road orientation.

      Thanks...


      RowHouses.jpg

      1 Reply Last reply Reply Quote 0
      • sdmitchS Offline
        sdmitch
        last edited by

        I imported your image and drew the outline of the row houses, pushpulled the up, drew a single generally down the road, selected it and ran the following script

        
        mod = Sketchup.active_model
        ent = mod.active_entities
        sel = mod.selection
        edg = sel.first;sel.clear
        faces = ent.select{|f| f.class==Sketchup;;Face}
        for f in faces
         fp = f.bounds.min
         pp = fp.project_to_line edg.line
         norm=f.normal;vec=fp.vector_to pp
         sel.add f if norm.angle_between(vec) < 45.degrees
        end
        
        

        which produced this result where only the front faces are selected.

        Row Houses.png

        Nothing is worthless, it can always be used as a bad example.

        http://sdmitch.blogspot.com/

        1 Reply Last reply Reply Quote 0
        • R Offline
          ryangarnett
          last edited by

          Thats awesome. Thank you. I am going to test this.

          Thanks again.

          1 Reply Last reply Reply Quote 0
          • R Offline
            ryangarnett
            last edited by

            Did you run this from the Ruby Console? I haven't run scripts within SU before, so this may be a really dumb question.

            1 Reply Last reply Reply Quote 0
            • sdmitchS Offline
              sdmitch
              last edited by

              No not the Ruby Console but from Ruby Web Console which is a plugin that opens a window that allows you enter and execute code.

              Nothing is worthless, it can always be used as a bad example.

              http://sdmitch.blogspot.com/

              1 Reply Last reply Reply Quote 0
              • R Offline
                ryangarnett
                last edited by

                Thank you. I was doing that with no results, but it was because my buildings are Groups. I suppose I will have to ungroup them in order to select the face?

                Thanks again.

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

                  Good job, Sam: 👍 👍
                  I think you might be dangerous.

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

                  1 Reply Last reply Reply Quote 0
                  • sdmitchS Offline
                    sdmitch
                    last edited by

                    Dangereous? You have no idea.

                    Ryan, I can add code so groups and/or components can be checked. The code previously posted was just a quick and dirty effort to show how it might be done.

                    Nothing is worthless, it can always be used as a bad example.

                    http://sdmitch.blogspot.com/

                    1 Reply Last reply Reply Quote 0
                    • R Offline
                      ryangarnett
                      last edited by

                      Thank you Mitch, I really can't thank you enough.

                      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