Thanks for the code it worked just fine. I had finally found the piece I was missing and this is what I had come up with
model = Sketchup.active_model
entities = model.entities
ss= model.selection
entity = ss.first
selection_bb = entity.bounds
max_dir = "blue axis"
if selection_bb.height > selection_bb.depth
max_dir = "green axis"
if selection_bb.width > selection_bb.height then max_dir = "red axis" end
else
if selection_bb.width > selection_bb.depth then max_dir = "red axis" end
end
case max_dir
when "blue axis"
tr = Geom;;Transformation.rotation [0,0,0], [0,1,0], 90.degrees
entities.transform_entities tr, entity
when "green axis"
tr = Geom;;Transformation.rotation [0,0,0], [0,0,1], 90.degrees
entities.transform_entities tr, entity
end
Similar and the results are both ok.