Harness proD API Help
EPLAN.Harness.API.Projects.Documents Namespace / Designer Class / ImportComplexEntity Method
Path to .hxce file.
Example
In This Topic
    ImportComplexEntity Method
    In This Topic
    Import complex entities to this document.
    Syntax
    public IEnumerable<IOccComplexEntity> ImportComplexEntity( 
       string path
    )

    Parameters

    path
    Path to .hxce file.

    Return Value

    Imported complex entities.
    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.
    The exception that is thrown when a managed assembly is found but cannot be loaded.
    Example
    The example shows the import of complex entities from 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];
    
    // Create a new workspace or workdesk
    Designer designer = variant.CreateWorkspace("MyWorkspace1");
    // Or open an existing one:
    // Designer designer = variant.GetWorkspaces().FirstOrDefault(d => d.Name == "Workspace_1");
    designer.Open(false, false);
    
    // Import complex entity from file.
    IEnumerable<IOccComplexEntity> complexEntities = designer.ImportComplexEntity(@"c:\Projects\CEtoImport.hxce");
    
    // Work with complex entities here.
    
    // Save changes and close documents.
    designer.Save();
    project.Save();
    designer.Close();
    variant.Close();
    project.Close();
    api.Close();
    See Also