The TDVPanel can be used to display additional information in Scorpion's plug-in panel.
Below an example of TDVPanel usage is shown. The example is taken from the Valve demo:
Sample Profile
Example profile: TDVPanelX - T1 - UsageExample_001.zip
Example 1: Set Caption using values in tagdatabase
radius = GetValue('Radius.Value')
x = GetValue('Center.Value_x')
y = GetValue('Center.Value_y')
str0 = 'Position (%(x)d,%(y)d) Radius %(radius).1f [mm]' %vars()
PluginPanel2.SetCaption('Value='+str0)
Example 2: Access Functions
# set color of font
def SetFontColor(plugin,color):
plugin.SetFontColor('Value='+color)
plugin.SetHorisontalPosition('Value=0') # 0 = center
# set caption
def SetCaption(plugin,text):
plugin.SetCaption('Value='+text)
# set color of panel
def SetColor(plugin,color):
plugin.SetColorOfPanel('Value='+color)
Example 3: Using Access Functions
SetCaption(PluginPanel1,'Access Function Demo')
Example 4: Python Wrapper Class
def CreateTDVPanel(name):
class TDVPanel:
def __init__(self,name):
self.object = name
self.hPosition=0
def SetFontColor(self,color):
self.object.SetFontColor('Value=%d' % color)
self.SetHorisontalPosition(self.hPosition)
def SetHorisontalPosition(self,position):
self.hPosition=position
self.object.SetHorisontalPosition('Value=%d' % self.hPosition) # 0 = center
def SetCaption(self,text):
self.object.SetCaption('Value='+text)
def SetColorOfPanel(self,color):
self.object.SetColorOfPanel('Value=%d' % color)
def SetFontName(self,name):
self.object.SetFontName('Value='+name)
def SetFontSize(self,size):
self.object.SetFontSize('Value=%d' % size)
def SetDefault(self,caption):
self.SetCaption(caption)
self.SetFontColor(40000)
self.SetColorOfPanel(65555)
self.SetFontName('Arial')
self.SetFontSize(12)
self.SetHorisontalPosition(0)
return TDVPanel(name)
Example 5: Using Python Wrapper in Central Start script
tdvPanel = CreateTDVPanel(PluginPanel1)
tdvPanel.SetDefault('-')
zAv = (z+z2+z3+z4)/4
if zAv < 0 :
zAv = 1
width = d12
depth = d13
height = zAv
volume = zAv*width*depth / 1000
tdvPanel.SetCaption(' Volume=%.0f cm3 - w=%.0f mm d=%.0f mm h=%.0f mm' % (volume,width,depth,height))
|