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 end
which 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.
Advertisement