Harness proD API Help
EPLAN.Harness.API.Projects.Documents Namespace / Project Class / ElectricalOptions Property
Example
In This Topic
    ElectricalOptions Property (Project)
    In This Topic
    List of Electrical options of this project.
    Syntax
    public IList<ElectricalOptionSetting> ElectricalOptions {get; set;}
    Exceptions
    ExceptionDescription
    The object is in invalid state. Obtain a new one.
    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.
    The exception that is thrown when no project is open.
    You can not perform this action on a document opened as read only.
    Argument is null.
    Remarks
    Use this list for setting electrical options for the whole project.
    Example
    The following example shows how to edit electrical options for the whole project.
    // Get electrical options of the project.
    IList<ElectricalOptionSetting> elOptions = project.ElectricalOptions;
    
    // Edit list of electrical options:
    // Remove option:
    elOptions.Remove(elOptions.Last());
    // Add new option:
    elOptions.Add(new ElectricalOptionSetting("Name of the option", "Description of the option"));
    // Edit option's name:
    elOptions.First(p => p.Name == "Option's name").Name = "New name";
    
    // Save the project.
    project.Save();
    The following example shows how to set a new list of electrical options for the whole project.
    // Create a new list of electrical option settings.
    IList<ElectricalOptionSetting> elOptions = new List<ElectricalOptionSetting>()
    {
    	new ElectricalOptionSetting("First option", "Description 1"),
    	new ElectricalOptionSetting("Second option", "Description 2")
    };
    
    // Set the whole list to this project. (Old values are lost!)
    project.ElectricalOptions = elOptions;
    
    // Save the project.
    project.Save();
    See Also