VS:GetTextSize: Difference between revisions

From Vectorworks Developer
Jump to navigation Jump to search
No edit summary
 
m (1 revision)
 
(No difference)

Latest revision as of 14:32, 12 August 2013

.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix

Description

Procedure GetTextSize returns the text point size at a specified position within the referenced text object. 1 point = 1/72".

The position is in a range between 0 and 32767, representing a character position in the text string. An index of 0 refers to the first character in the string.

FUNCTION GetTextSize(
TextHd :HANDLE;
Position :INTEGER) : REAL;
def vs.GetTextSize(TextHd, Position):
    return REAL

Parameters

TextHd HANDLE Handle to text object.
Position INTEGER Position in text string.

Remarks

The result was previously an integer, but is now a floating point value.

Here's a snippet that shows how to get the text size that has been assigned to a PIO from the text menu:

pioTextSize := ((GetObjectVariableReal(pioHandle, 17) / GetLScale(GetLayer(pioHandle))) * 72) / 25.4;


Example:

PROCEDURE Example;
CONST
theSizeToSelect = 10;
VAR
criteria :STRING;

PROCEDURE SelectBySize(h :HANDLE);
BEGIN
IF GetTextSize(h, 0) = theSizeToSelect THEN SetSelect(h);
END;

BEGIN
DSelectAll;
criteria := '(T=10)';
ForEachObject(SelectBySize, criteria);
END;
RUN(Example);

Version

Availability: from MiniCAD6.0