How to select inner faces of square wall



hello i am trying to selected inner faces for wall , i used this code

mod = Sketchup.active_model # Open model
ent = mod.entities # All entities in model
sel = mod.selection # Current selection
faces = (sel[0].entities).grep Sketchup::Face
cf = (faces[0].all_connected).grep Sketchup::Face  

but this selecting all face in group


Yea, you need to filter of the faces you want based on some distinguishable properties.

In this particular case we can use the fact that the inner faces will be connected to the inner loops of the bottom or top face.

module Example

  # Example.get_inner_wall_faces_of_selected_instance
  def self.get_inner_wall_faces_of_selected_instance
    model = Sketchup.active_model
    selection = model.selection
    instance = selection.first
    faces = self.get_inner_wall_faces(instance.entities)
    model.start_operation('Paint Inner Walls', true)
    faces.each { |face| face.material = 'red' }

  def self.get_inner_wall_faces(entities)
    faces = entities.grep(Sketchup::Face)
    # First we find the top face(s).
    top_faces = { |face|
    # Now we just need to iterate its inner loops and find connected faces.
    inner_wall_faces = []
    top_faces.each { |top_face|
      top_face.loops.each { |loop|
        next if loop.outer?
        inner_wall_faces.concat(self.inner_loop_faces(loop, top_face))

  def self.inner_loop_faces(loop, ignore_face)
    faces = []
    loop.edges.each { |edge|
      edge_faces = edge.faces
      edge_faces.delete(ignore_face) # Don't want the top face



thanks for response …
now i am trying to using pushpull tool for inner face it’s work correctly with wall on square shape and dose not with wall on pentagon or hexagon shape , after push inner faces i found intersection line on upper face and bottom face

mod = Sketchup.active_model 
ent = mod.entities
sel = mod.selection 
prom = ["Thikness"]
default = [""]
result = UI.inputbox prom , default , "Edit thikness"
thik = result[0].to_f
UI.messagebox thik
faces = sel[0].entities.grep(Sketchup::Face)
    # First we find the top face(s).
    top_faces = { |face|
    faces = []
    edge_faces = []
   #UI.messagebox top.loops.length
   top.loops.each{|l| next if l.outer? 
   l.edges.each{|e|  edge_faces = e.faces
   u = Sketchup.active_model.options["UnitsOptions"]["LengthUnit"]
   case u 
   when 0
     f.pushpull thik.inch
   when 1 
     f.pushpull thik.feet
   when 2 
   when 3
   when 4 
     f.pushpull thik.m
     UI.messagebox "model doesn't have unit"


How would you draw this manually?


by 1001bit tools


And if no plugins were involved? Try to map your manual steps on your code.


my code selected inner faces for wall and push it according to thickness


How about drawing the bottom face first, as if it were a floorplan, and then just push-pull the face upward?


the drawing dose not matter , my problem is how to modifying the thickness of wall after creation


Learn to transform the inner wall vertices rather than using pushpull.


@Ahmed1 - please format the code blocks you post. Use the </> button in the toolbar of the text editor. image

Makes it a lot easier to read. (Use the Preview to the right to make sure it looks right.)


You could for instance take the bottom face, and locate the points for the “outer” surface. Then offset this path to the new wall width and create a new face to push-pull up.
As Dan mentions, using push-pull on the vertical wall surfaces won’t work. Think of how you’d do this when modelling by hand.