Bounding Edge Correction

Hello guys

def window_move(grp)
x_axis = (@pt[0].vector_to(@pt[1])).normalize
y_axis = @vec_face.normalize.reverse
z_axis = x_axis * y_axis
if z_axis.z < 0
y_axis.reverse!
z_axis.reverse!
offset = Geom::Transformation.translation([0, -@nww.abs, 0])
grp.transform!(offset)
end
z_axis.normalize!
y_axis = z_axis * x_axis
y_axis.normalize!
tr_axes = Geom::Transformation.axes(@pt[0], x_axis, y_axis, z_axis)
grp.transform!(tr_axes)
end

This code moves and rotates grp correctly,
but grp and its subgroup bounding edges do not match them when
the rotation angle does not match the origin axis.
Can you help me?