I posted a topic on this …
I did not solve the rotation axis, only the persistent ID problem.
When the user selects a bunch of entities and group it, the origin (transform) of this new group is a transition between the model origin and the lower left corner of the bounding box surrounding those entities.
EDIT: Nevermind this suggestion, just use the initial group's transformation as the base transform.
So you’ll likely need to make a temporary bounding box, add the bounds of all the selected entities, and get a vector from the origin to the BB’s minimum corner.
bb = Geom::BoundingBox.new
entarray.each {|ent| bb.add(ent.bounds) }
vec = ORIGIN.vector_to(bb.min)
t1 = Geom::Transformation.translation(vec)
… then use this to get a difference between it and where the user wants the rotational axis to be.
Also a quirk of the API is that when inside an editing context (of a group or component instance) the many API methods return or expect coordinates in world values instead of local values.