Small script that will flatten everything selected
model = Sketchup.active_model
entities = model.entities
selection = model.selection
count = 0
selection.grep(Sketchup::Edge).each { |edge|
count += 1
edge.vertices[0].position.z = 0
edge.vertices[1].position.z = 0
}
puts count