Stumped
-
I'm struggling to understand Ruby scripting in Sketchup, and I'm frustrated by the lack of introductory tutorial material. As a practical matter, I can create a bunch of 3D text objects and orient them as I wish, but I can't figure out how to group them; topics like grouping just don't seem to be covered well anywhere that I've found.
I guess I'm looking for a decent overview that includes terminology - grouping, components, etcetera - along with how to accomplish simple tasks like this. A discussion of local versus global coordinate systems might also be helpful; I'm not sure yet whether objects have their own coordinate frame or if everything must be done in global coordinates.
I'd prefer written documentation with example code to videos, but at this point I'll settle for just about anything.
Thanks.
-
I moved your post to a more appropriate place.
There are several good threads here - e.g.
http://forums.sketchucation.com/viewtopic.php?f=180&t=10142
Also 'Automatic Sketchup' is a good general primer.
http://www.autosketchup.com/On your particular subject...
You have already go something like
mytext=Sketchup.active_model.active_entities.add_3d_text(xxxxxxxxxxxxxx)
where 'xxxxxxxxxxxxxx
' represents the various arguments that you need to pass to the method...
This then adds the 3d-text as 'raw geometry' into the current context [usually the model's entities].
If you look at the API section on 'entities'
https://developers.google.com/sketchup/docs/ourdoc/entities
there are lots of ways to add things to ANY 'entities' collection...
So to add a group to themodel.entities
use
group=Sketchup.active_model.entities.add_group()
Now you have a group in the model and can add things to that group's entities, instead of the model, thus...
group.entities.add_3d_text(xxxxxxxxxxxxxx)
Now the 3d-text's geometry is inside 'group'...
You can add more things into it, or change its name, material, layer etc as you now have a reference to it 'group
'... You can even add groups inside such new groups etc, as you desire...
Advertisement