textcombined

# Text Combined (Tc) module

class vcs.textcombined.Tc(Tt_name=None, Tt_name_src='default', To_name=None, To_name_src='default')[source]

The (Tc) Text Combined class will combine a text table class and a text orientation class together. From combining the two classess, the user will be able to set attributes for both classes (i.e., define the font, spacing, expansion, color index, height, angle, path, vertical alignment, and horizontal alignment).

This class is used to define and list a combined text table and text orientation entry used in VCS.

Useful Functions:
# Constructor
 a=vcs.init()
 # Show predefined text table objects
 a.show('texttable')
 # Show predefined text orientation objects
 a.show('textorientation')
 # Updates the VCS Canvas at user's request
 a.update()
Make a Canvas object to work with:
a=vcs.init()
Create a new instance of text table:
# Copies content of 'std' to 'new_tt' and '7left' to 'new_to'
tc=a.createtextcombined('new_tt','std','new_to','7left')
Modify an existing texttable:
tc=a.gettextcombined('std','7left')
Overview of textcombined attributes:

Note

Textcombined attributes are a combination of texttable and textorientation attributes

  • Listing the attributes:

    # Will list all the textcombined attribute values
    tc.list()
    
  • Specify the text font type:

    tc.font=1
    
  • Specify the text spacing:

    # The spacing value must be in the range -50 to 50
    tc.spacing=2
    
  • Specify the text expansion:

    # The expansion value ranges from 50 to 150
    tc.expansion=100
    
  • Specify the text color:

    # The text color
    tc.color="black"
    
  • Specify the graphics text priority on the VCS Canvas:

    tt.priority = 1
    
  • Specify the viewport and world coordinate:

    
    

    # FloatType [0,1]x[0,1] tt.viewport=[0, 1.0, 0,1.0] # FloatType [#,#]x[#,#] tt.worldcoordinate=[0,1.0,0,1.0]

  • Specify the location of the text:

    # List of FloatTypes
    tt.x=[[0,.1,.2], [.3,.4,.5]]
    # List of FloatTypes
    tt.y=[[.5,.4,.3], [.2,.1,0]]
    
  • Specify the text height:

    # The height value must be an integer
    tc.height=20
    
  • Specify the text angle:

    # The angle value ranges from 0 to 360
    tc.angle=0
    
  • Specify the text path:

    # Same as tc.path=0
    tc.path='right'
    # Same as tc.path=1
    tc.path='left'
    # Same as tc.path=2
    tc.path='up'
    # Same as tc.path=3
    tc.path='down'
    
  • Specify the text horizontal alignment:

    # Same as tc.halign=0
    tc.halign='right'
    # Same as tc.halign=1
    tc.halign='center'
    # Same as tc.halign=2
    tc.halign='right'
    
  • Specify the text vertical alignment:

    # Same as tcvalign=0
    tc.valign='tcp'
    # Same as tcvalign=1
    tc.valign='cap'
    # Same as tcvalign=2
    tc.valign='half'
    # Same as tcvalign=3
    tc.valign='base'
    # Same as tcvalign=4
    tc.valign='bottom'
    
list()[source]

Lists the current values of object attributes

Example
>>> a=vcs.init()
>>> ctc = vcs.createtextcombined # alias long name
>>> obj=ctc('list_tt', 'qa', 'list_tto', '7left')
>>> obj.list() # print textcombined attributes
---------- ... ----------
...
script(script_filename=None, mode=None)[source]

Saves out a copy of the text table and text orientation 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()
>>> try: # try to create a new textcombined, in case none exist
...     tc = vcs.createtextcombined('EX_tt', 'qa', 'EX_tto', '7left')
... except:
...     pass
>>> ex=a.gettextcombined('EX_tt', 'EX_tto')
>>> 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.