line

# Line (Tl) module

class vcs.line.Tl(Tl_name, Tl_name_src='default')[source]

The Line object allows the manipulation of line type, width, color index, view port, world coordinates, and (x,y) points.

This class is used to define an line table entry used in VCS, or it can be used to change some or all of the line attributes in an existing line table entry.

Useful Functions:
>>> a=vcs.init() # VCS Canvas Constructor
>>> a.show('line') # Show predefined line objects
*******************Line Names List**********************
...
*******************End Line Names List**********************
>>> a.getline('red').list() # show properties of 'red' line
 ---------- ... ----------
...
>>> a.update() # manually update canvas
Create a new instance of line:
>>> ln=a.createline('new','red') # Copies 'red' to 'new'
>>> ln=a.createline('new2') # Copies 'default' to 'new2'
Modify an existing line:
  • Get a line object ‘ln’ to manipulate:

    >>> ln=a.getline('red')
    
  • Set line color:

    >>> ln.color=100 # Range from 1 to 256
    
  • Set line width:

    >>> ln.width=100 # Range from 1 to 300
    
  • Specify the line type:

    >>> ln.type='solid' # Same as ln.type=0
    >>> ln.type='dash' # Same as ln.type=1
    >>> ln.type='dot' # Same as ln.type=2
    >>> ln.type='dash-dot' # Same as ln.type=3
    >>> ln.type='long-dash' # Same as ln.type=4
    
  • Set the graphics priority on the canvas:

    >>> ln.priority=1
    >>> ln.viewport=[0, 1.0, 0,1.0] # float [0,1]x[0,1]
    >>> ln.worldcoordinate=[0,1.0,0,1.0] # float [#,#]x[#,#]
    
  • Set line x and y values:

    >>> ln.x=[[0,.1,.2], [.3,.4,.5]] # List of floats
    >>> ln.y=[[.5,.4,.3], [.2,.1,0]] # List of floats
    
list()[source]

Lists the current values of object attributes

Example
>>> a=vcs.init()
>>> obj=a.getline() # default
>>> obj.list() # print line attributes
---------- ... ----------
...
script(script_filename=None, mode=None)[source]

Saves out a copy of the line secondary method, in JSON or Python format to a designated file.

Note

If the the filename has a ‘.py’ at the end, it will produce a Python script. If no extension is given, then by default a .json file containing a JSON serialization of the object’s data will be produced.

Warning

VCS Scripts Deprecated. SCR script files are no longer generated by this function.

Example
>>> a=vcs.init()
>>> ex=a.getline()
>>> ex.script('filename.py') # append to 'filename.py'
>>> ex.script('filename','w') # make/overwrite 'filename.json'
Parameters
  • script_filename (str) – Output name of the script file. If no extension is specified, a .json object is created.

  • mode (str) – Either ‘w’ for replace, or ‘a’ for append. Defaults to ‘a’, if not specified.