The CitectSCADA Graphics Builder now offers support for "automation," an OLE service that allows applications to expose their functionality, or to control the functionality of other applications on the same computer or across a network. As a result, applications can be integrated and automated with programming code.
The two key elements of automation are:
Automation is the umbrella term for the process by which an automation controller sends instructions to an automation server (using the functionality exposed by the automation server), where they are run.
The CitectSCADA Graphics Builder automation interface enables the CitectSCADA Graphics Builder to act as an automation server, as it exposes many Graphics Builder functions as well as some Project Editor and Citect Explorer functions.
The interface supports a simple object model: functions are on the root level. Names are structured and contain a group identifier and a function name; for example, DrawLine, DrawRectangle, PositionAt, PositionRotate, ProjectSelect, ProjectUpgrade. These functions can be called from a Visual Basic (VB) program.
Note: In the VB development environment, the reference GraphicsBuilder Type Library needs to have previously been selected. If it hasn't, choose References from the Project menu in the VB and check the Graphics Builder Type Library.
The following sample VB code allows you to create a new CitectSCADA page, place a Genie at a specific location, set one of its parameter, draw a line, and then save the page with the name "TEST".
Dim GraphicsBuilder As IGraphicsBuilder2
Set GraphicsBuilder = New GraphicsBuilder.GraphicsBuilder
.Visible = True
.PageNew "include", "standard", "normal", 0, True, True
.LibraryObjectPlace "include", "motors", "motor_1_east", 0, True
.PositionAt 300, 500
.LibraryObjectPutProperty "Tag", "Test_Tag"
.DrawLine 100, 100, 300, 300
.AttributeLineColour = 120
.PageSaveAs "Example", "TEST"
.Visible = False
Set GraphicsBuilder = Nothing