Example


Example 1

!
! Draw some simple objects
!
main()
   string name;

   verify(1);


   ! Draw a rectangle
   set fill
   set shadow
   set linewidth 1
   set bordercolor Black
   set fillcolor BlueHigh8
   create rect /x1=10 /y1=1 /width=20 /height=12
   set current attr shadow_width 2
   set current attr gradient Globe

   ! Draw a circle
   set fill
   set shadow
   set fillcolor MagentaHigh4
   set linewidth 2
   create arc /x1=1/y1=1/x2=6/y2=6
   set current attr shadow_width 12
   set current attr gradient DiagonalLowerLeft

   ! Draw a polyline
   set fill
   set shadow
   set fillcolor YellowGreenHigh5
   set linewidth 1
   create polyline /x1=5 /y1=5 /x2=10 /y2=10
   add polyline /x1=10 /y1=20
   add polyline /x1=5 /y1=20
   add polyline /x1=5 /y1=5
   set current attr gradient DiagonalLowerLeft

   ! Print a text
   set bold
   set textsize 24
   set textfont LucidaSans
   set textcolor RedHigh8
   create text/text="Example" /x1=3 /y1=5

   ! Create a subgraph
   set fillcolor YellowGreenMedium3
   create object/sub=pwr_valve/x1=1/y1=1/x2=3/y2=2
   set current attr DigLowColor.Attribute "Rt-Dv1.ActualValue##Boolean"
   set current attr DigLowColor.Color GrayHigh9

   ! Create a pushbutton
   create object /sub=pwr_buttonsetcenter /x1=5 /y1=1
   set current annotation "Start"
   set current attr SetDig.Attribute "rt-dv1.actualvalue##Boolean"
   set current attr Access System|Operator1

   ! Set graph attributes
   set graphattr x0 -3
   set graphattr y0 -3
   set graphattr x1 40
   set graphattr y1 25

   save
endmain

Example 2

!
! This example finds all dv objects in an hierarchy,
! prints the name and displayes the value in an indicator.
! A frame is drawn around the objects.
!
main()

   string name;
   string segname;
   string attr;
   float x;
   float y;
   float x_ind;
   float y_ind;
   float x1;
   float x2;
   float y1;
   float y2;
   float width;
   float height;
   float t_width;
   string class;

   verify(1);

   x_ind = 2;
   x = 4;
   y_ind = 1.5;
   y = 2;
   name = GetChild( p1);

   if ( p1 == "")
     printf("usage : test3 'parent'\n");
     exit();
   endif

   set bold
   set textsize 12
   while ( name != "")
     class = GetObjectClass( name);
     if ( class == "Dv")
       create object/sub=pwr_indsquare/x1='x_ind'/y1='y_ind'
       attr = name + ".ActualValue##Boolean";
       set current attr DigLowColor.Attribute "'attr'"
       segname = CutObjectName( name, 1);
       create text/text="'segname'"/x1='x'/y1='y'
       GetTextExtent( segname, 12, 1, t_width);
       if ( t_width > width)
         width = t_width;
       endif
       y += 1;
       y_ind += 1;
     endif
     name = GetNextSibling( name);
   endwhile

   x1 = x_ind - 1;
   x2 = x + width + 1;
   y1 = 0;
   y1 = y;
   width = x2 - x1;
   height = y2 - y1;

   set fillcolor GrayLow3
   set shadow
   set noborder
   set nofill
   create rectangle/x1='x1'/y1='y1'/width='width'/height='height'
   set current attr shadow_width 2
   set current attr relief Down

   x1--;
   x2++;
   y1--;
   y2++;
   set background GrayLow3
   set graph x0 'x1'
   set graph y0 'y1'
   set graph x1 'x2'
   set graph y1 'x2'
endmain