The problem is to determine which faces are the narrow face of the board. They are always less than 2" in width and they are always oriented on the X-Y plane.
I’m sure I’ve seen a similar algorithm or Grep expression that can do this sort of thing but again my search came up empty.
You could test the normal vector direction of the faces to see which ones point the way you want. Ones in the XY plane will have their normal parallel to the z axis.
Will these faces be the smallest in terms of area? If so then that’s something you can use to sort them by. I’m assuming this isn’t the case.
If you have the dimensions for the board you can look for faces with an area specific to those faces… could potentially be dangerous depending on the possible sizes for these boards as faces other than what you’re looking for could also have that same area.
You said they are always oriented on the X-Y plane. Ultimately the way I would choose to do it would be to pick the faces based on their normals.
I’m hesitant to provide a code example for fear of leading you astray but figure someone will be here to correct me if so.
I ended up using a different algorithm for the LVL but part of the loop ended up in my CMU module:
if @Matsoption == "ON"
MedeekMethods.check_cmu_materials
@group1.material = @Cmu_mat
group1faces = @entities1.grep(Sketchup::Face)
horzfaces = group1faces.find_all {|face| face.normal.parallel?(Z_AXIS)}
for horzface in horzfaces
horzface.material = @Cmu_facemat_horz
end
end