Orientation of 3D Text with relation to faces

I’m trying to figure out how to properly orient 3DText in a script to position the text on plane and pointing upwards. Obviously Sketchup can do it when you use the 3DText tool as in this case

I can determine the centroid and I can get the plane - but the positioning of the text via a script appears to point rotated randomly.

The docs say:

It will be added as edges and faces drawn at the origin.

Because the GUI automatically creates the text inside a new group within the current editing context.

So you will need to do the same.
Create a new group, add the text to the group’s entities, then transform the group.

OK - let’s see the scrip that can do this

Please do not be rude.

We are not going to do your work for you, but we can help you understand how to do it yourself.

A quick search of the Ruby API category brings up this prior thread with code samples:
3d text appears to ignore z parameter - #8 by DanRathbun

You might also learn from reading the code of @thomthom’s 3D Text Editor extension:

1 Like


RUDE In my opinion - absolutely not !!!

How about totally frustrated since I have spent the better part of the week trying to figure this out.

Regardless - I still thank you for a bit of direction.


There’s some sample code discussed in this thread: SketchUp as a hobby - #150 by jimhami42

Basically you need to create the letters at the origin and them move them into place with a transformation. You cannot place them directly.

Thanks - much appreciated.

And yes - I pretty much always create everything at the Origin and then move and rotate it into position. I’ll use the centroid of the face as the point. It is the rotation that I’m having trouble nailing down.

I’m back at it today.

Download and look at the code in Angular Dimension 2 from SketchUcation.com.

It does exactly what you want. The key is in the Transformation Matrix.

If you are still having trouble, you could ask the author, Steve Baumgartner, @slbaumgartner, for help.

The only trouble I’m having is waking up this morning. Having my first cup of coffee. Most of the west coast of Canada are just stirring.

I think Dan has the best suggestion that I’m digging into. TT’s 3D text editor looks like it should provide the answers.

Here’s some sample code that might help … jimhami42_letter_on_face.rb (1.8 KB)

Select a face and the text will be positioned on (in) the face.

Your code is essentially what I’ve been doing.
Mine is the one on the left, yours is the middle and 3D text tool is the one on the right.

Test.skp (322.7 KB)

I’ve got it working reasonably well. Here is the modified code.

jimhami42_letter_on_face.rb (1.7 KB)

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.