Yes, you can do this without user interaction by transforming the vertices of the selected face using the
Sketchup::Entities#transform_entities method. You pass an array of the face’s vertex objects into the method (as the 2nd argument) following the transform (1st) argument.
In this case the transform argument would be based upon a vector pointing along
Y_AXIS (the global model y axis,) or along the parent context’s y axis of the group.
Something like this (note, this is untested.) …
# Where "face" is a reference to the face to be transformed,
# and "offset" is a length to offset the face's vertices in the y direction ...
# Find the y axis vector for the transformation:
if model.active_entities == model.entities || model.active_path.size < 2
y_vector = Y_AXIS.clone
parent = model.active_path[-2]
y_vector = parent.transformation.yaxis
# Set the length of the y_vector for the offset desired:
# Create the translational tranformation using this vector:
y_transform = Geom::Transformation.translation(y_vector)
# Transform face's vertices using the y_transform:
model.active_entities.transform_entities( y_transform, face.vertices )
If you are interested in coding a custom Ruby Stretch tool that will incorporate user interaction, it is quite complex and involves understanding the inference engine. There are examples on GitHub for custom tools.