Harness proD API Help
EPLAN.Harness.API.Projects.Documents Namespace / Designer Class / ExportComplexEntity Method
Occurrences of type complex entity that will be exported.
Path to .hxce file.
Example
In This Topic
    ExportComplexEntity Method
    In This Topic
    Export complex entities from this document to .hxce file.
    Syntax
    public void ExportComplexEntity( 
       IEnumerable<IOccComplexEntity> entities,
       string path
    )

    Parameters

    entities
    Occurrences of type complex entity that will be exported.
    path
    Path to .hxce file.
    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.
    Example
    The example shows the export of complex entities to a file.
    // Init API
    HpdApi api = HpdApi.GetInstance();
    api.Init();
    
    // Open project and select variant
    Project project = api.OpenProject(@"c:\Projects\Demo\Demo.hxproj");
    Variant variant = project.GetVariants()[0];
    
    // Open workspace or workdesk existing one:
    Designer designer = variant.GetWorkspaces().FirstOrDefault(d => d.Name == "Workspace_1");
    // Designer designer = variant.GetWorkdesks().FirstOrDefault(d => d.Name == "Workdesk_1");
    designer.Open(false, false);
    
    // Select complex entities (or all)
    IEnumerable<IOccComplexEntity> ces = designer.GetAllOccurrences().OfType<IOccComplexEntity>();
    
    // Export complex entities to file
    designer.ExportComplexEntity(ces, @"c:\Users\xyz\Documents\exportCE.hxce");
    
    // Close documents.
    designer.Close();
    variant.Close();
    project.Close();
    
    // Close the API.
    api.Close();
    See Also