private static void MarkMotorsOnPage(Page page)
{
DMObjectsFinder dMObjectsFinder = new DMObjectsFinder(page.Project);
FunctionsFilter functionsFilter = new FunctionsFilter();
functionsFilter.Page = page;
functionsFilter.FunctionCategory = FunctionCategory.Motor;
Function[] functions = dMObjectsFinder.GetFunctions(functionsFilter);
StringCollection scFuncIds = new StringCollection();
foreach (Function function in functions)
{
String objectId = function.Properties.PROPUSER_DBOBJECTID;
int idxOfSlash = objectId.IndexOf("/", 1, objectId.Length - 1, StringComparison.InvariantCultureIgnoreCase);
String objectIdWithoutProjectId = objectId.Substring(idxOfSlash + 1, (objectId.Length - idxOfSlash - 1));
scFuncIds.Add(objectIdWithoutProjectId);
}
// Connect to server via a remoting client
EplanRemoteClient oClient = new EplanRemoteClient();
try{
oClient.Connect(Environment.MachineName, "60000"); //In this case the Eplan server was started on port 60000
//Connection is successful then select objects
oClient.SelectObjects(page.Project.ProjectLinkFilePath, scFuncIds, true);
}
catch(Exception)
{
// Connection to server failed!
}
}