Harness proD API Help
EPLAN.Harness.API.DataStructures Namespace / ViewsController Class / SaveView Method
Name of the saved view.
Camera position for the view.
Visibility settings of occurrences. Key is ID of the occurrence and Value is a boolean which determines if this occurrence should be visible or not.
Example
In This Topic
    SaveView Method
    In This Topic
    Save view with defined camera and visibility state.
    Syntax

    Parameters

    name
    Name of the saved view.
    cameraPosition
    Camera position for the view.
    visibility
    Visibility settings of occurrences. Key is ID of the occurrence and Value is a boolean which determines if this occurrence should be visible or not.

    Return Value

    Saved view.
    Exceptions
    ExceptionDescription
    This file is not opened.
    Argument is null.
    Example
    This example shows how to save view from camera position and visibility settings as a new view. It allows you to create a view without changing camera position for the document.
    // Get a graphic document.
    GraphicDocument document = GetDocument("Document");
    document.Open(false, false);
    
    // Get the views controller.
    ViewsController views = document.Views;
    
    // Get the camera and visibility settings - for example from another view (View1).
    
    View view1 = views.View1;
    CameraPosition camera = view1.CameraPosition;
    Dictionary<string, bool> visibility = view1.Visibility;
    
    // Save view with name 'MyView' and obtained settings.
    View view = views.SaveView("MyView", camera, visibility);
    
    // At this moment you can find this view in the list of unmapped views.
    // View myView = views.UnmappedViews.First(v => v.Name == view.Name);
    
    // Save the document.
    document.Save();
    See Also