@Arbiorix, Some snippets that work for the top level model entities ONLY:
def viewable?(obj)
view = @mod.active_view
obj.vertices.all? {|v|
coords = view.screen_coords(v.position)
coords.x.round >= 0 && coords.y.round >= 0
}
end
def find_biggest_face(faces)
faces.max_by {|f| f.area }
end
def find_viewable_faces(ents)
allfaces = ents.grep(Sketchup::Face)
allfaces.select {|face| viewable?(face) }
end
def task()
@mod = Sketchup::active_model
ents = @mod.entities
faces = find_viewable_faces(ents)
biggie = find_biggest_face(faces)
end
Sketchup.active_model.selection.add(task)
It is much more complex if you need to test faces nested inside group or components.