Select all faces facing a road
-
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...

-
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 endwhich produced this result where only the front faces are selected.

-
Thats awesome. Thank you. I am going to test this.
Thanks again.
-
Did you run this from the Ruby Console? I haven't run scripts within SU before, so this may be a really dumb question.
-
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.
-
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.
-
Good job, Sam:

I think you might be dangerous. -
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.
-
Thank you Mitch, I really can't thank you enough.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register LoginAdvertisement