I can’t appear to search out any threads on this subject however it might have been answered earlier than.
I’m attempting to determine if there’s solution to generate multi-line 3D textual content with the API.
Can I insert a newline character or another particular character that may trigger the API to create a number of strains of textual content?
n
def test_text(textual content)
entities = Sketchup.active_model.entities
entities.add_3d_text(textual content, TextAlignLeft, "Arial")
finish
test_text( "myntest")
3 Likes
BTW
You will need to use "
double quotes to outline the string, in any other case :
3 Likes
Thank-you, that is very thrilling, I didn’t understand I might do multi-lines with the 3D textual content.
3 Likes
This may be fastened inside the strategy …
def test_text(textual content)
entities = Sketchup.active_model.active_entities
textual content.gsub!('n',"n")
entities.add_3d_text(textual content, TextAlignLeft, "Arial")
finish
3 Likes
On a associated be aware does anybody know what the precise integer values are for the constants:
TextAlignLeft
TextAlignRight
TextAlignCenter
I can’t appear to search out this wherever within the documentation.
Sketchup defines these constants on the prime degree NameSpace
You possibly can merely kind the identify into the Ruby Console to retrieve the worth.
TextAlignLeft = 0
TextAlignCenter = 1
TextAlignRight = 2
Or , in any Module you possibly can search for the worth of a single fixed with the const_get() technique utilizing identify of the fixed as a Image.
Object.const_get(:TextAlignCenter)
or dump the gamut
Object.constants.kind.every { | const |
places "#{const} = #{ Object.const_get(const) }"
}
nil
Object being the default root of all Ruby objects.