class Text

Parent: Drawingelement | Class Index
Methods:arrow_type, arrow_type=, display_leader=, display_leader?, has_leader?, leader_type, leader_type=, line_weight, line_weight=, set_text, text, text= |
Sample Code: texttests.rb |

The Text class contains method to manipulate a Text entity object.

Instance Methods

arrow_type
The arrow_type method retrieves the current arrow type used for the leader text.
Syntax:
arrow = text.arrow_type
Arguments:
Return Value:
arrow – a numerical representation for the type of arrow.
Comments:
Valid arrow types are 0 for none, 2 for dot, 3 for closed arrow, 4 for open arrow.
Example:
type = text.arrow_type=0

arrow_type=
The arrow_type= method sets the arrow type used for leader text.
Syntax:
arrow = text.arrow_type=type
Arguments:
type – a numerical representation of the type of arrow to be set
Return Value:
arrow – a numerical representation for the type of arrow.
Comments:
Valid arrow types are 0 for none, 2 for dot, 3 for closed arrow, 4 for open arrow.
Example:

display_leader=
The display_leader= method accepts true or false for whether to display the leader.
Syntax:
status = text.display_leader=status
Arguments:
status – true if you want to display the leader text, false if you do not want to display the leader text.
Return Value:
status – the status that you set.
Comments:
Leader text that is not displayed is set to Hidden type.
Example:
leader = text.display_leader=true

display_leader?
The display_leader? method returns the status of the leader.
Syntax:
status = text.display_leader?
Arguments:
Return Value:
status – true if the leader is being displayed, false if it is not displayed.
Comments:
Example:
status = text.display_leader?

has_leader?
The has_leader method is used to determine if the Text object has a leader.
Syntax:
status = text.has_leader?
Arguments:
Return Value:
status - true if the Text object has a leader. False if the Text object does not have a leader.
Comments:
Example:
coordinates = [10, 10, 10] model = Sketchup.active_model entities = model.entities point = Geom::Point3d.new coordinates text = entities.add_text "This is a Test", point status = text.has_leader? if (status) UI.messagebox status else UI.messagebox status end

leader_type
The leader_type method retrieves the currently set leader type.
Syntax:
leader = text.leader_type
Arguments:
leader – a numerical value representing the currently set leader type.
Return Value:
leader – a numerical value representing the currently set leader type.
Comments:
Example:
leader = text.leader_type

leader_type=
The leader_type = method sets the leader type.
Syntax:
leader = text.leader.type=type
Arguments:
type – a numerical value representing the leader type to be set.
Return Value:
leader – a numerical value representing the leader type you just set.
Comments:
Valid leader types are 0 for none, 1 for View based, and 2 for Pushpin
Example:
leader = text.leader_type=1

line_weight
The line_weight method returns a line weight in number of pixels.
Syntax:
lineweight = text.line_weight
Arguments:
Return Value:
lineweight – the line weight in pixels
Comments:
Defalt line weight is 1.
Example:
weight = text.line_weight

line_weight=
The line_weight= method sets the line weight in pixels.
Syntax:
lineweight = text.line_weight=weight
Arguments:
weight – the line weight to be set (in pixels).
Return Value:
The line weight that has been set.
Comments:
Default line weight is 1.
Example:
newweight = text.line_weight=4

set_text
The set_text method is used to set the text within a Text object without recording an Undo operation.
Syntax:
text = text.text “textstring”
Arguments:
“textstring” – the string to be set within the Text object
Return Value:
text – the Text object
Comments:
Example:
text = text.set_text "This is another text"

text
The text method is used to retrieve the string version of a Text object
Syntax:
textstring = text.text
Arguments:
Return Value:
textstring – the string representation of the Text object
Comments:
Example:
textstring = text.text

text=
The text= method is used to set the string version of a Text object
Syntax:
textstring = text.text= "text"
Arguments:
Return Value:
textstring - the newly set text
Comments:
Example:
textstring = text.text="This is another text"