Harness proD API Help
EPLAN.Harness.API.Projects.Documents Namespace / Designer Class / AddNewComplexEntity Method
Occurrences that will be added to the newly created complex entity.
Example
In This Topic
    AddNewComplexEntity Method
    In This Topic
    Syntax

    Parameters

    occurrences
    Occurrences that will be added to the newly created complex entity.

    Return Value

    Created complex entity.
    Exceptions
    ExceptionDescription
    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 object is in invalid state. Obtain a new one.
    Argument is null.
    This file is not opened.
    Thrown when the occurrence is not part of this document.
    Example
    This example shows how to add a new empty complex entity to the workspace.
    Workspace workspace = ...
    
    IOccComplexEntity complexEntity = workspace.AddNewComplexEntity();
    This example shows how to add a new complex entity with some occurrences.
    Workdesk workdesk = ...
    
    // All addable occurrences from this wordesk:
    IEnumerable<IComplexEntityAddable> occurrences = workdesk.GetAllOccurrences().OfType<IComplexEntityAddable>();
    
    IOccComplexEntity complexEntity = workdesk.AddNewComplexEntity(occurrences);
    See Also