Harness proD API Help
EPLAN.Harness.API Namespace / HpdApi Class / CreateProject Method
Name of the project.
Location of the new project directory.
Path to connection file.
List of variant names for the new project. If not supplied just the single default 'Variant_1' is created.
Example
In This Topic
    CreateProject Method
    In This Topic
    Create a new HpD project.
    Syntax

    Parameters

    name
    Name of the project.
    location
    Location of the new project directory.
    defaultLibraryConnection
    Path to connection file.
    variants
    List of variant names for the new project. If not supplied just the single default 'Variant_1' is created.

    Return Value

    Path to the created project.
    Exceptions
    ExceptionDescription
    Api is not in an initialized state. You can get current state from Status property. If API is uninitialized, you can initialize it by calling Init(String,String[]) method. If API is in failed state, you can not resurrect it.
    Argument is invalid. The exception is thrown when a wrong argument is passed to the method or the setter of property.
    This directory was not found.
    The exception that is thrown when the file has the wrong extension.
    This file was not found.
    Project was not created.
    Remarks
    • The new project may or may not have default library connection.
    • The new project will have just one default variant with name 'Variant_1' unless the variants parameter is passed.
    Example
    This example shows how to create a new simple project.
    // API is already initialized.
    HpdApi api = HpdApi.GetInstance();
    
    string newProjectPath = api.CreateProject("NewProjectName", @"Path to directory where the project will be saved.");
    
    // Project "NewProjectName" is created. Path to the new project is returned.
    // You can open the project using:
    api.OpenProject(newProjectPath);
    This example shows how to create a new project with default project library.
    // API is already initialized.
    HpdApi api = HpdApi.GetInstance();
    
    string libraryConnection = @"Path to a connection file (*.hxcn)";
    
    string newProjectPath = api.CreateProject("NewProjectName", @"Location...", libraryConnection);
    See Also