Vr Mapping

ON-LINE REFERENCE DOCUMENTATION

CARDINAL SYSTEMS, LLC

www.cardinalsystems.net

Text Class Reference (PyVrText)

Holds and manipulates VrOne text data. More…

Members

Init ()
Load (WsNum, TextNum, DispFlag=-1)
LoadLast ()
Rec (WsNum, DispFlag=-1)
ReRec (DispFlag=-1)
Del ()
Id (WsNum=-1)
Copy (TargetText)
GetWsNum ()
GetTextNum()
SetLayer (Layer)
SetPenNum (PenNum)
SetNpoint (Npoint)
SetLink (Link)
SetFc (Fc)
SetConstr (Constr)
SetFontNum (FontNum)
SetJustX (JustX)
SetJustY (JustY)
SetHgt (Hgt)
SetWdt (Wdt)
SetSize (Size)
SetRot (Rot)
SetSlt (Slt)
SetText (TextLabel)
SetCoord (x, y, z)
GetLayer ()
GetPenNum ()
GetNpoint ()
GetLink ()
GetFc ()
GetConstr ()
GetFontNum ()
GetJustX ()
GetJustY ()
GetHgt ()
GetWdt ()
GetSize ()
GetRot ()
GetSlt ()
GetText ()
GetFkeyParams (FkeyName)
GetCoord ()
Plot ()
Erase ()

 


Description

The VrOne/Python Text class is used to define VrOne Text label data. A text consists of a header, an xyz coordinate, and a text label string. An existing Text class may be loaded from disk. Header information may be defined by a Python script or may be inherited from a VrOne Function Key. The user of this class should understand the VrOne Data Structure.

 

Example:

# Loads all the text in the current workspace, changes the text

# label to the elevation of the entity.

# Filename: ChangeText.py

# WARNING: Changes data but is undoable

 

Ws   = PyVrWs()   # VrOne workspace manager object

Text = PyVrText() # VrOne text object

WsNum = Ws.Aws()   # Current workspace

 

Ws.UndoBegin (WsNum, "ChangeText")             # Begin undo

 

for TextNum in range (0, Ws.GetTextCount (WsNum)):

 

    Text.Load (WsNum, TextNum)               # Load text

    Text.Erase()                             # Erase it from graphics

    (x, y, z) = Text.GetCoord()

    Text.SetText ("Elevation=%.3f" % z)

    Text.ReRec()                             # Re-record it

    Text.Plot()                               # Re-plot it

 

Ws.UndoEnd (WsNum)                             # End undo

 


Member Function Documentation

Init ()

Initializes the text to default values. This is useful when reusing the text class.

 

Load (WsNum, TextNum)

Loads a text from disk.

WsNum

Workspace number (0-255)

TextNum

Text number.

returns

(ret)

 

 

ret

Loaded text's number.

-1 = Workspace or text number out of range.

 

LoadLast ()

Loads the last saved text. If a Python script is run as a Function Key’s OnEnd command it is possible for the script to further process the text that was just saved. See the AddPosts.py example.

returns

(ret)

 

 

ret

0 = OK.

-1 = No last text exists.

 

Rec (WsNum, DispFlag=-1)

Records text at the end of a workspace.

WsNum

Number of workspace from which to record text (0-255).

DispFlag

Optional display flag.

-1 = Do not condition.

0 = Do not display.

1 = Display

returns

(ret)

 

 

ret

Text number.

-1 = Workspace number out of range.

 

ReRec (DispFlag=-1)

Re-records a previously loaded text by marking the original location as deleted and placing the text at the end of the workspace.

DispFlag

Optional display flag.

-1 = Do not condition.

0 = Do not display.

1 = Display

returns

(ret)

 

 

ret

0 = OK.

-1 = Could not record text.

 

Del ()

Deletes the text by marking its layer number as a negative number on disk. Pack Vr removes deleted entities from a workspace.

returns

(ret)

 

 

ret

0 = OK.

-1 = Could not delete text. Text was never loaded.

 

Id (WsNum=-1)

Allows interactive text selection. Returns a text number that may be used to load the text from disk.

WsNum

Number of the workspace to search (0-255).

-1 = Search all open workspaces

returns

(ret)

 

 

ret

Text number selected.

-1 = Text not selected.

Example:

# Select (Id) a text and print some information

Ws     = PyVrWs()             # VrOne workspace manager

Text   = PyVrText()           # VrOne text object

 

if (Text.Id() != -1):           # Did we get a text?

 

    print "Layer     ", Text.GetLayer()

    print "Height   ", Text.GetHgt()

    print "Width     ", Text.GetWdt()

    print "Rotation ", Text.GetRot()

    print "Text label", Text.GetText()

Copy (TargetText)

Copies the current text to the target text passed.

TargetText

Text object to which to copy text.


Example:

# Copy Text

Ws      = PyVrWs()              # VrOne workspace manager

Text    = PyVrText()            # VrOne text object

TarText = PyVrText()            # Text to copy to

 

if (Text.Id() != -1):           # Did we get a text label?

  print TarText.GetLayer()     # Print the current layer of TarText

  Text.Copy (TarText)          # Copy the identified text to TarText

  print TarText.GetLayer()     # Print new layer of TarText

GetWsNum ()

When a text is loaded, the workspace number from which the text was loaded is stored in the object. Gets this number.

returns

(ret)

 

 

ret

Workspace number (0-255).

-1 = Text was never loaded from disk.

Example

# Select (Id) a text and print its workspace and text number

Ws      = PyVrWs()              # VrOne workspace manager

Text    = PyVrText()            # VrOne text object

 

if (Text.Id() != -1):           # Did we get a text?

  print “Workspace  ”, Text.GetWsNum()

  print “Text number”, Text.GetTextNum()

 

GetTextNum ()

When a text is loaded, its text number is stored in the object. Gets this number.

returns

(ret)

 

 

ret

Text number.

-1 = Text was never loaded from disk.

Example

# Select (Id) a text and print its workspace and text number

Ws      = PyVrWs()              # VrOne workspace manager

Text    = PyVrText()            # VrOne text object

 

if (Text.Id() != -1):           # Did we get a text?

  print “Workspace  ”, Text.GetWsNum()

  print “Text number”, Text.GetTextNum()

 

SetLayer (Layer)

Sets the text's layer.

Layer

Layer number (1-10001).


 

SetPenNum (PenNum)

Sets the text's pen number, which determines the color to use when drawing a text label. NOTE: If a Pen Table is active, this command has no effect.

PenNum

Pen number (1-256).


 

SetNpoint (Npoint)

Sets the text's non-graphic pointer.

Npoint

Non-graphic pointer number (-2,147,483,648 to 2,147,483,648).


 

SetLink (Link)

Sets the text's link.

Link

Text link number (-2,147,483,648 to 2,147,483,648).


 

SetFc (Fc)

Sets the text's Feature Code.

Fc

Feature code (up to 48 characters).


 

SetConstr (Constr)

Sets the text's Construction display flag. The display of text labels that have their construction flags set to 1 may be turned off.

Constr

Construction display flag (0-1).


 

SetFontNum (FontNum)

Sets the font for the text label.

FontNum

Text font number (1-12). See below for the corresponding fonts.


 

1

CI

Complex Italic

2

CR

Complex Roman

3

CS

Complex Script

4

DR

Duplex Roman

5

GE

Gothic English

6

GG

Gothic German

7

GI

Gothic Italic

8

HS

Standard

9

SR

Simplex Roman

10

SS

Simplex Script

11

TI

Triplex Italic

12

TR

Triplex Roman

 

SetJustX (JustX)

Sets the text X-axis justification.

JustX

X-axis justification.

1 = Left.

2 = Center.

3 = Right.

4 = Decimal.


 

SetJustY (JustY)

Sets the text Y-axis justification.

JustY

Y-axis justification.

1 = Lower.

2 = Center.

3 = Upper.


 

SetHgt (Hgt)

Sets the text height

Hgt

Text height in ground units (double precision).


 

SetWdt (Wdt)

Sets the single-character text width.

Wdt

Text width in ground units (double precision).


 

SetSize (Size)

Sets the text height and width. This is useful if the text size and width are the same.

Size

Text size in ground units (double precision).


Size                 Text size in ground units (double precision)

Example           Text.SetSize (1.234)

SetRot (Rot)

Sets the text rotation. The rotation is counterclockwise with zero along the X-axis.

Rot

Text rotation in degrees, (0 - 360, double precision).


 

SetSlt (Slt)

Sets the text slant. A text slant of zero means no text slant.

Slt

Text slant in degrees (-180 - 180, double precision).


 

SetText (Text)

Sets the text label.

Text

Text label (up to 512 characters).


 

SetCoord (x, y, z)

Sets the text coordinate value.

x,y,z

Text coordinate value (double precision).


 

GetLayer ()

Gets the layer of the text.

returns

(ret)

 

 

ret

Layer number (1-10001). Any number 0 or lower represents a deleted entity.

 

GetPenNum ()

Gets the pen number of the text. The pen number determines the color to use when drawing text.

returns

(ret)

 

 

ret

Text pen number (1-256).

 

GetNpoint ()

Returns the non-graphic pointer number of the text.

returns

(ret)

 

 

ret

Text non-graphic pointer (-2,147,483,648 to 2,147,483,648)

 

GetLink ()

Returns the link of the text.

returns

(ret)

 

 

ret

Text link number (-2,147,483,648 to 2,147,483,648).

 

GetFc ()

Returns the feature code of the text.

returns

(ret)

 

 

ret

Text feature code (up to 48 characters).

 

GetConstr ()

Returns the construction flag of the text. The display of text labels that have their construction flags set to 1 may be turned off.

returns

(ret)

 

 

ret

Text construction flag (0-1).

Returns             Text construction flag (0-1)

Example           Constr = Text.GetConstr()

GetFontNum ()

Returns the font number of the text

returns

(ret)

 

 

ret

Font number (1-12). See below for corresponding fonts.

1

CI

Complex Italic

2

CR

Complex Roman

3

CS

Complex Script

4

DR

Duplex Roman

5

GE

Gothic English

6

GG

Gothic German

7

GI

Gothic Italic

8

HS

Standard

9

SR

Simplex Roman

10

SS

Simplex Script

11

TI

Triplex Italic

12

TR

Triplex Roman

 

GetJustX ()

Returns the text X-axis justification.

returns

(ret)

 

 

ret

Text X-axis justification.

1= Left.

2 = Center.

3 = Right.

4 = Decimal.

 

GetJustY ()

Returns the text Y-axis justification.

returns

(ret)

 

 

ret

Text Y-axis justification.

1= Left.

2 = Center.

3 = Upper.

 

GetHgt ()

Returns the text height.

returns

(ret)

 

 

ret

Text height in ground units (double precision).

 

GetWdt ()

Returns the text width.

returns

(ret)

 

 

ret

Text width in ground units (double precision).

GetSize ()

Returns the text size, a combination of the text height and width. The text height and width are averaged to form the text size.

returns

(ret)

 

 

ret

Text size in ground units (double precision).

 

GetRot ()

Returns the rotation of the text. The rotation is counterclockwise with zero along the X-axis.

returns

(ret)

 

 

ret

Text rotation in degrees.

 

GetSlt ()

Returns the slant of the text. A text slant of zero is no text slant.

returns

(ret)

 

 

ret

Text slant in degrees (-180 - 180, double precision).

 

GetText ()

Returns the text label.

returns

(ret)

 

 

ret

Text label (up to 512 characters).

 

GetFkeyParams (FkeyName)

Fills the text header data from a previously defined VrOne function key. If the function key requested does not exist, the text header is filled with default parameters.

FkeyName

Function key name.

returns

(ret)

 

 

ret

0 = OK.

-1 = Function key does not exist.

FkeyName       Function key name

Returns             0=OK -1=Function key does not exist

Example           RetVal = Text.GetFkeyParams (“Pole”)

GetCoord ()

Returns the text's coordinate values.

returns

(x,y,z)

 

 

x

X coordinate of text.

 

y

Y coordinate of text.

 

z

Z coordinate of text.

Returns             x, y, z (double precision)

Example           (x, y, z) = Text.GetCoord()

Plot ()

Plots the text label to all open graphics devices. The current header parameters are used.

 

Erase ()

Erases the text label from all open graphics devices.