Get copper busbar side face


获取红色的面
但是旋转后就获取不到这些面了.
现将代码奉上,希望能得到帮助
Get red faces
But you can’t get these faces after rotating
Now the code is provided. I hope you can get help

mod = Sketchup.active_model # 打开模型
ent = mod.entities # 模型中的所有实体
sel = mod.selection # 当前选择

sel.grep(Sketchup::Group) do | grp |
faces = grp.entities.grep(Sketchup::Face)
    
    sj=[]
    ptmax=grp.bounds.max
    ptmin=grp.bounds.min
    sj << grp.bounds.width
    sj << grp.bounds.height
    sj << grp.bounds.depth
    fx=sj
    temp0=sj.max
    #最大数 temp0
    temp2=sj.min
    #最小数
    #sj.delete_if{|e| e==sj.min }
    temp1=sj.min
    #temp1 中间数

puts faces.count
if temp2 == grp.bounds.width
old_faces = faces.find_all {|f| f.normal == X_AXIS }
end
if temp2 == grp.bounds.height
old_faces = faces.find_all {|f| f.normal == Z_AXIS }
end
if temp2 == grp.bounds.depth
 
   old_faces = faces.find_all {|f| f.normal == X_AXIS }
 puts "linshucai"
end
#old_face.material='red'
old_faces.each{|e|
  e.material='red'
  el=e.edges
  el.each {|ed|
  puts ed.length
  }
  }
end

Please read to post correctly lexed code:

经过几两天的努力,大体上可以了.算法还是比较合理的
After several or two days of efforts, it is generally OK. The algorithm is still relatively reasonable

# 这段是默认代码,您可以选择使用或删除。。。
mod = Sketchup.active_model # 打开模型
ent = mod.entities # 模型中的所有实体
sel = mod.selection # 当前选择
#- 0 = [0, 0, 0] (left front bottom)
#- 1 = [1, 0, 0] (right front bottom)
#- 2 = [0, 1, 0] (left back bottom)
#- 3 = [1, 1, 0] (right back bottom)
#- 4 = [0, 0, 1] (left front top)
#- 5 = [1, 0, 1] (right front top)
#- 6 = [0, 1, 1] (left back top)
#- 7 = [1, 1, 1] (right back top)
sel.grep(Sketchup::Group) do | grp |
    faces = grp.entities.grep(Sketchup::Face)
   #top
    topl=grp.bounds.corner(4)
    topy=grp.bounds.corner(7)
    #side
    sidl=grp.bounds.corner(5)
    sidy=grp.bounds.corner(3)
    #front
    fonl=grp.bounds.corner(0)
    fony=grp.bounds.corner(5)
    #get distance
     tdis = topl.distance(topy) 
     sdis = sidl.distance(sidy)
     fdis = fonl.distance(fony)
     sj=[]
      #顶面
      if tdis > sdis and tdis > fdis
        side_faces = faces.find_all {|f| f.normal == X_AXIS }
      end
      #侧面 
      if sdis > tdis and sdis > fdis
         side_faces = faces.find_all {|f| f.normal == Z_AXIS }
      end
      #正面 
      if fdis > sdis and fdis > tdis
         side_faces = faces.find_all {|f| f.normal == Z_AXIS }
      end

       side_faces.each{|e|
          e.material='red'
          el=e.edges
          el.each {|ed|
          sj << (ed.length.to_mm.round(0))
            }    
         }
         p sj
         # get thinkess
         
         sj.delete_if{|e| e==sj.min }
         zwn = sj.count / 2 - 1
         
         puts zwn
         
end



那么问题来了,想将图形中118mm的面从side_face中删除
不知有哪位可以帮助解决一下.
So the problem comes. I want to remove the 118mm face from the side_faces
I wonder who can help solve it