Orientation of 3D Text with relation to faces

3dtext
transform
transformation

#1

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.


#2

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.


#3

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


#4

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

You might also learn from reading the code of @thomthom’s 3D Text Editor extension:
http://extensions.sketchup.com/en/content/3d-text-editor


#5

Dan

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.

Garry


#6

There’s some sample code discussed in this thread: SketchUp as a hobby

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


#7

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.


#8

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.


#9

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.


#10

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.


#11

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)


#12

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

jimhami42_letter_on_face.rb (1.7 KB)


#13

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