VrOne/Python Programming

ON-LINE REFERENCE DOCUMENTATION

CARDINAL SYSTEMS, LLC

386-439-2525   

www.cardinalsystems.net    mike@cardinalsystems.net
 

Symbol Class Reference (PyVrSym)

 

The VrOne/Python Symbol class holds and manipulates VrOne symbol data.  More…

 

Members

 

 


Detailed Description

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


Member Function Documentation

Init ()

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

Example           Sym.Init()

Load (WsNum, SymNum)

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)

LoadLast ()

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 ()

Rec (WsNum, DispFlag=-1)

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)

ReRec (DispFlag=-1)

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 ()

Del ()

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 ()

Id (WsNum=-1)

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()

GetWsNum ()

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()

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()

SetLayer (Layer)

Sets the layer of the symbol.

Layer               Layer number (1-10,001)

Example           Sym.SetLayer (23)

SetGpoint (Gpoint)

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)

SetPenNum (PenNum)

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)

SetNpoint (Npoint)

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)

SetLink (Link)

Sets the Link of the symbol

Link                 Symbol link (-2,147,483,648 to 2,147,483,648)

Example           Sym.SetLink (4512)

SetFc (Fc)

Sets the Feature Code of the symbol

Fc                    Feature code (Up to 48 characters)

Example           Sym.SetFc (“Material=Wood”)

SetConstr (Constr)

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)

SetRad (Rad)

Sets the symbol radius.

Rad                  Symbol radius in ground units (double precision)

Example           Sym.SetRad (1.34)

SetRot (Rot)

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)

SetCoord (x, y, z)

Sets the symbol coordinate value.

X, y, z              Symbol coordinate value (double precision)

Example           Sym.SetCoord (x, y, z)

GetLayer ()

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()

GetGpoint ()

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()

GetPenNum ()

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()

GetNpoint ()

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()

GetLink ()

Returns the link of the symbol.

Returns             Symbol link (-2,147,483,648 to 2,147,483,648)

Example           Link = Sym.GetLink()

GetFc ()

Returns the feature code of the symbol

Returns             Symbol feature code (up to 48 characters)

Example           Fc = Sym.GetFc()

GetConstr ()

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()

GetRad ()

Returns the radius of the symbol

Returns             Radius in ground units

Example           Rad = Sym.GetRad()

GetRot ()

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()

GetFkeyParams (FkeyName)

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”)

GetCoord ()

Returns a coordinate value from the symbol

Returns             x, y, z (double precision)

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

ReRec ()

Re-records the symbol on disk.

Example           Sym.ReRec()

Plot ()

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

Example           Sym.Plot()

Erase ()

Erases the symbol from all open graphics devices.

Example           Sym.Erase()