Create Text-object
-
Searching this Forum and the Sketchup-API I couldn´t find a way to create a text-object, but only found methods to manipulate existing text-objects.
What I´m trying to do ist creating labels for faces and edges to identitfy them, like "Edge_01". I´m aware of the fact, that there is no easy way to attach these labels to the corresponding entity by ruby, but that wouldn´t be to bad, since the labels will just disappear when the model or the camera-view changes.But is there really no way to create a text-object using ruby?
-
I've moved this to the Developers' Forum as it's more appropriate.
The various Text methods you have found relate to manipulating existing text...
https://developers.google.com/sketchup/docs/ourdoc/text
To add text you need to use an Entities method.
https://developers.google.com/sketchup/docs/ourdoc/entities#add_text
You will see that is where you add many kinds of object into the model.
The 'entities' can be model.entities, model.active_entities, group.entities or definition.entities - so where you add objects is very flexible...
For example:group=model.active_entities.add_group()
adds a new group into the 'current context', thengroup.entities.add_text(string, point, vector)
adds some text inside the group... -
Of course you´re right, I only browsed the Entity-Classes, not the Collection-classes, although I already created some faces using add_face...shame on me.
thx for your quick response!
Advertisement