Inserting Sketchup::Text to the model

How determine to what ComponentInstance, arow of the Sketchup::Text is connected?
In my model I have got few ComponentInstances which have unique number.
When I make Sketchup::Text connecting to ComponentInstance I would like to set text as a unique number (from ComponentInstance).

There doesn’t appear to be a direct method. You could try to use the Text’s point and/or vector to try to determine a possible entity to which the Text is attached.