VrOne/Python Programming
|
ON-LINE REFERENCE DOCUMENTATION CARDINAL SYSTEMS, LLC 386-439-2525 |
The VrOne/Python Symbol class holds and manipulates VrOne symbol data. More…
The VrOne/Python Symbol class is used to define VrOne Symbol data. A Symbol consists of a header and a xyz coordinate. An existing Symbol 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 symbols in the current workspace, change the layers
# and graphic pointers and re-record them.
# Filename: ChangeSymbols.py
# WARNING: Changes data but is undoable
Ws = PyVrWs() # VrOne workspace manager object
Sym = PyVrSym() # VrOne symbol object
WsNum = Ws.Aws() # Current workspace
Ws.UndoBegin (WsNum, "ChangeSymbols") # Begin undo
for SymNum in range (0, Ws.GetSymCount (WsNum)):
Sym.Load (WsNum, SymNum) # Load symbol
Sym.Erase() # Erase it from graphics
Sym.SetLayer (23) # Change the layer
Sym.SetGpoint (15) # Change the graphic pointer
Sym.ReRec() # Re-record it
Sym.Plot() # Re-plot it
Ws.UndoEnd (WsNum) # End undo
Initializes the symbol to default values. This is useful when reusing the symbol class.
Example Sym.Init()
Loads a symbol from disk
WsNum Workspace number (0-255)
SymNum Symbol number (0-?)
Returns Symbol number loaded. -1 = Ws number or symbol number is out of range.
Example Sym.Load (WsNum, SymNum)
Loads the last saved symbol. If a Python script is run as a Function Key’s OnEnd command it is possible for the script to further process the symbol that was just saved. See the AddCircle.py example.
Returns 0=Ok -1=There is no last symbol
Example Sym.LoadLast ()
Records a symbol at the end of a workspace.
WsNum Workspace number to record to (0-255)
DispFlag Optional display flag (-1=Don’t condition 0=Do not display 1=Display)
Returns Symbol number -1=Workspace number is out of range
Example Sym.Rec (WsNum)
Re-records a previously loaded symbol by marking the original location as deleted and placing the symbol at the end of the workspace.
DispFlag Optional display flag (-1=Don’t condition 0=Do not display 1=Display)
Returns 0=Ok -1=Could not record symbol
Example Sym.ReRec ()
Deletes a symbol by marking its layer number as a negative number on disk. Pack Vr removes deleted entities from a workspace.
Returns 0=Ok -1=Could not delete symbol. Symbol was never loaded
Example Sym.Del ()
Allows the interactive selection of a symbol. Returns a symbol number that may be used to load the symbol from disk.
WsNum Workspace number to search (0-255 -1=Search all open workspaces)
Returns Symbol number selected (-1=Symbol not selected)
Example:
# Select (Id) a symbol and print it
Ws = PyVrWs() # VrOne workspace manager
Sym = PyVrSym() # VrOne symbol object
if (Sym.Id() != -1): # Did we get a symbol?
# Print some information about the symbol
print "Layer ", Sym.GetLayer()
print "Gpoint", Sym.GetGpoint()
print
"Coord ", Sym.GetCoord()
When a symbol is loaded, the workspace number in which the symbol was loaded from is stored in the object.
Returns Workspace number (0-255 -1=Symbol was never loaded from disk)
Example:
# Select (Id) a symbol and print it's Workspace and
Symbol Number
Ws =
PyVrWs() # VrOne workspace
manager
Sym = PyVrSym() # VrOne symbol object
if (Sym.Id() != -1): # Did we get a symbol?
print
"Workspace ",
Sym.GetWsNum()
print "Symbol number", Sym.GetSymNum()
When a symbol is loaded, its symbol number is stored in the object
Returns Symbol number (0-? -1=Symbol was never loaded from disk)
Example
# Select (Id) a symbol and print it's Workspace and
Symbol Number
Ws =
PyVrWs() # VrOne workspace
manager
Sym =
PyVrSym() # VrOne symbol object
if (Sym.Id() != -1): # Did we get a symbol?
print
"Workspace ",
Sym.GetWsNum()
print "Symbol number", Sym.GetSymNum()
Sets the layer of the symbol.
Layer Layer number (1-10,001)
Example Sym.SetLayer (23)
Sets the graphic pointer of the symbol. The graphic pointer determines the graphic representation of a Symbol such as a fence or a tree symbol.
Gpoint Symbol graphic pointer (1-1,000)
Example Sym.SetGpoint (123)
Sets the pen number of a symbol, which determines the color to use when drawing a Sym. NOTE: If a Pen Table is active this command has no effect.
PenNum Pen number (1-256)
Example Sym.SetPenNum (2)
Sets the Non-graphic pointer of the symbol.
Npoint Non-graphic pointer (-2,147,483,648 to 2,147,483,648)
Example Sym.SetNpoint (1278)
Sets the Link of the symbol
Link Symbol link (-2,147,483,648 to 2,147,483,648)
Example Sym.SetLink (4512)
Sets the Feature Code of the symbol
Fc Feature code (Up to 48 characters)
Example Sym.SetFc (“Material=Wood”)
Sets the Construction display Symbol of the Sym. The display of Symbols that have their construction flags set to 1 may be turned off.
Constr Construction flag (0-1)
Example Sym.SetConstr (0)
Sets the symbol radius.
Rad Symbol radius in ground units (double precision)
Example Sym.SetRad (1.34)
Sets the symbol rotation. The rotation is counterclockwise with zero being along the X-axis.
Rot Symbol rotation in degrees (double precision)
Example Sym.SetRot (24.0)
Sets the symbol coordinate value.
X, y, z Symbol coordinate value (double precision)
Example Sym.SetCoord (x, y, z)
Returns the layer of the symbol.
Returns Layer number (1-10,001). A return layer number that is 0 or less than 0 represents a deleted entity.
Example Layer = Sym.GetLayer()
Returns the graphic pointer of the symbol. The graphic pointer determines the graphic representation of a Symbol such as a fence or a tree symbol
Returns Symbol graphic pointer (1-1,000)
Example Gpoint = Sym.GetGpoint()
Returns the pen number of the symbol. The pen number determines the color to use when drawing a symbol.
Returns Symbol pen number (1-256)
Example PenNum = Sym.GetPenNum()
Returns the non-graphic pointer of the symbol.
Returns Symbol non-graphic pointer (-2,147,483,648 to 2,147,483,648)
Example Npoint = Sym.GetNpoint()
Returns the link of the symbol.
Returns Symbol link (-2,147,483,648 to 2,147,483,648)
Example Link = Sym.GetLink()
Returns the feature code of the symbol
Returns Symbol feature code (up to 48 characters)
Example Fc = Sym.GetFc()
Returns the construction flag of the symbol. The display of symbols that have their construction flags set to 1 may be turned off.
Returns Symbol construction flag (0-1)
Example Constr = Sym.GetConstr()
Returns the radius of the symbol
Returns Radius in ground units
Example Rad = Sym.GetRad()
Returns the rotation of the symbol. The rotation is counterclockwise with zero being along the X-axis.
Returns Symbol rotation in degrees
Example Rot = Sym.GetRot()
Fills the Symbol header data from a previously defined VrOne function key. If the function key requested does not exist, the Symbol header is filled with default parameters.
FkeyName Function key name
Returns 0=OK -1=Function key does not exist
Example RetVal = Sym.GetFkeyParams (“Pole”)
Returns a coordinate value from the symbol
Returns x, y, z (double precision)
Example (x, y, z) = Sym.GetCoord()
Re-records the symbol on disk.
Example Sym.ReRec()
Plots the symbol to all open graphics devices. The current header parameters are used.
Example Sym.Plot()
Erases the symbol from all open graphics devices.
Example Sym.Erase()