Overview
|
The CimProjectData object provides the ability to search and return specific pieces of a project's configuration. The underlying APIs used by the CimProjectData object are the same as those used to browse point configuration on a remote project. In general, this object provides a convenient way to retrieve a set of attributes based on specified filter criteria. This object provides a read-only capability.
To write configuration, please see the help file for the CIMPLICITY Configuration Object Model.
|
Example (CimBasic)
|
Sub Main()
' This example retrieves all points beginning with A for Device MY_PLC
' in project MY_PROJECT and displays the point id and resource id of
' each matching item.
Dim d as new CimProjectData
d.Project = "MY_PROJECT"
d.Entity = "POINT"
d.Filters = "POINT_ID=A*,DEVICE_ID=MY_PLC"
d.Attributes = "POINT_ID,RESOURCE_ID"
Dim p as string
Dim r as String
top:
if d.GetNext(p,r) = TRUE then
MsgBox "Point Id = " & p & " Resource Id = " & r
goto top
End if
End Sub
|
Example (.NET)
|
using System;
using System.Collections.Generic;
using Proficy.CIMPLICITY;
public class CPD
{
public void Main()
{
try
{
CimProjectData cpd = new CimProjectData();
cpd.Project = "MY_PROJECT";
cpd.Entity = "POINT";
cpd.Attributes = "POINT_ID,RESOURCE_ID";
cpd.Filters = "POINT_ID=PGM*";
String[] vals = new String[2]; // returned attributes matching the filters
Cimplicity.Trace("Get project points with IDs starting with \"PGM\"");
int count = 0;
while (cpd.Next(vals) == Cimplicity.COR_SUCCESS)
{
Cimplicity.Trace("ID: " + vals[0] + ", Resource: " + vals[1]);
count++;
}
Cimplicity.Trace("Finished getting project points.");
}
catch (Exception x)
{
Cimplicity.Trace("Failure: " + x.Message);
}
}
}
|