Text Class Reference (PyVrText) Holds and manipulates VrOne text data. More… Members
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 Initializes the text to default values. This is useful when reusing the text class.
Loads a text from disk.
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.
Records text at the end of a workspace.
Re-records a previously loaded text by marking the original location as deleted and placing the text at the end of the workspace.
Deletes the text by marking its layer number as a negative number on disk. Pack Vr removes deleted entities from a workspace.
Allows interactive text selection. Returns a text number that may be used to load the text from disk.
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() Copies the current text to the target text passed.
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 When a text is loaded, the workspace number from which the text was loaded is stored in the object. Gets this number.
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()
When a text is loaded, its text number is stored in the object. Gets this number.
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()
Sets the text's layer.
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.
Sets the text's non-graphic pointer.
Sets the text's link.
Sets the text's Feature Code.
Sets the text's Construction display flag. The display of text labels that have their construction flags set to 1 may be turned off.
Sets the font for the text label.
Sets the text X-axis justification.
Sets the text Y-axis justification.
Sets the text height
Sets the single-character text width.
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) Example Text.SetSize (1.234) Sets the text rotation. The rotation is counterclockwise with zero along the X-axis.
Sets the text slant. A text slant of zero means no text slant.
Sets the text label.
Sets the text coordinate value.
Gets the layer of the text.
Gets the pen number of the text. The pen number determines the color to use when drawing text.
Returns the non-graphic pointer number of the text.
Returns the link of the text.
Returns the feature code of the text.
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 Text construction flag (0-1) Example Constr = Text.GetConstr() Returns the font number of the text
Returns the text X-axis justification.
Returns the text Y-axis justification.
Returns the text height.
Returns the text width.
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 the rotation of the text. The rotation is counterclockwise with zero along the X-axis.
Returns the slant of the text. A text slant of zero is no text slant.
Returns the text label.
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 0=OK -1=Function key does not exist Example RetVal = Text.GetFkeyParams (“Pole”) Returns the text's coordinate values.
Returns x, y, z (double precision) Example (x, y, z) = Text.GetCoord() Plots the text label to all open graphics devices. The current header parameters are used.
Erases the text label from all open graphics devices.
|