SketchUcation Plugin Store

 

 

Create Text-object

Create Text-object

Postby tafkab76 » Thu Aug 09, 2012 9:50 am

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?
tafkab76
 
Posts: 18
Joined: Wed Jul 11, 2012 9:16 am
Name: Steffen

Re: Create Text-object

Postby TIG » Thu Aug 09, 2012 10:01 am

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/ ... s#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', then group.entities.add_text(string, point, vector) adds some text inside the group...
TIG
User avatar
TIG
Global Moderator
 
Posts: 13903
Joined: Mon Nov 12, 2007 7:24 pm
Location: Northumbria UK
Name: TIG
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: Create Text-object

Postby tafkab76 » Thu Aug 09, 2012 10:08 am

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!
tafkab76
 
Posts: 18
Joined: Wed Jul 11, 2012 9:16 am
Name: Steffen

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago

Need Authorised SketchUp Training by experts in various disciplines? Check out our Training details.

Ad Machine
Robot
 
Posts: 2012


Return to Developers' Forum

Who is online

Users browsing this forum: Google Bot and 6 guests