public override IEnumerable<BaseOccurrence> GetEnvironmentOccurrences()
Return Value
Returns list of all environment occurrences in this document.
public override IEnumerable<BaseOccurrence> GetEnvironmentOccurrences()
Exception | Description |
---|---|
EPLAN.Harness.API.Exceptions.HpdApiNotInitializedException | Api is not in an initialized state. You can get current state from EPLAN.Harness.API.HpdApi.Status property. If API is uninitialized, you can initialize it by calling EPLAN.Harness.API.HpdApi.Init method. If API is in failed state, you can not resurrect it. |
EPLAN.Harness.API.Exceptions.ObjectInvalidException | The object is in invalid state. Obtain a new one. |
EPLAN.Harness.API.Exceptions.LicensingErrorException | This operation was denied because of your license. |
EPLAN.Harness.API.Exceptions.FileClosedException | This file is not opened. |
// API is a singleton. HpdApi api = HpdApi.GetInstance(); // Initialize API and load HpD. api.Init(); // Open a Harness proD project. Project project = api.OpenProject(@"Path to the project"); // Select the desired variant. Variant variant = project.GetVariants().FirstOrDefault(v => v.Name == "variant name"); // Select and open the desired document (for example workdesk). Workdesk workdesk = variant.GetWorkdesks().FirstOrDefault(w => w.Name == "workdesk name"); workdesk.Open(false, false); // List of environment occurrences in this document. List<BaseOccurrence> occs = workdesk.GetEnvironmentOccurrences().ToList(); // Close the document. workdesk.Close(); // Close the project. project.Close(); // Close the API. api.Close();