public AnnAutomationObject FindObjectById(int id)
id
The id of the AnnAutomationObject to find.
The AnnAutomationObject for the specified id, or null if no AnnAutomationObject with that id can be found.
The possible values for id are:
You can also use FindObject if you have an instance of AnnObject and want to find the automation object associated with its type.
This method enumerates all of the AnnAutomationObject items in the Objects collection and compares AnnAutomationObject.Id with id.
This example changes the line color of new line automation objects to blue:
using Leadtools.Annotations.Automation;using Leadtools.Annotations.Engine;using Leadtools.Codecs;using Leadtools.Controls;using Leadtools.Annotations.WinForms;using Leadtools.Annotations.Rendering;using Leadtools.Annotations.Designers;public void AnnAutomationManager_FindObjectById(){// find the line automation objectAnnAutomationObject obj = _automation.Manager.FindObjectById(AnnObject.LineObjectId);if (obj != null){obj.ObjectTemplate.Stroke = AnnStroke.Create(AnnSolidColorBrush.Create("Blue"), LeadLengthD.Create(2));}// Check if it is activeAnnAutomations annAutomations = _automation.Manager.Automations;foreach(AnnAutomation annAutomation in annAutomations)Console.WriteLine($"Is AnnAutomation Active?: {annAutomation.Active}");// Restarting _automation without objectsStartupNoObjects();// There should be no Automation ObjectsConsole.WriteLine($"Number of Annotation Objects Available: {_automation.Manager.Objects.Count}");// Create Default Automation Objects_automation.Manager.CreateDefaultObjects();Console.WriteLine($"Number of Created Annotation Objects: {_automation.Manager.Objects.Count}");foreach (AnnAutomationObject defaultObject in _automation.Manager.Objects){defaultObject.RunDesignerType = typeof(AnnRunDesigner);Console.WriteLine($"ID: {defaultObject.Id} | {defaultObject.Name} | Draw Designer Type: {defaultObject.DrawDesignerType.Name} | Edit Designer Type: {defaultObject.EditDesignerType.Name} | Run Designer Type: {defaultObject.RunDesignerType.Name}");}}public void StartupNoObjects(){_viewer = new AutomationImageViewer();_viewer.Image = RasterImage.CreateGrayscale(500, 500, 8, 100);_manager = new AnnAutomationManager();_automation = new AnnAutomation(_manager, _viewer);_automation.Active = true;_automation.Container.Size = new LeadSizeD(500, 500);_automation.AutomationControl.RenderingEngine = new AnnWinFormsRenderingEngine();}