However, you may also want to open or create a project in EPLAN via the API – this will certainly be the case with offline programs. For this and other project-related tasks, the Eplan.EplApi.DataModel namespace provides the ProjectManager class.
To create a project, use the CreateProject method. It takes two parameters, the full filename of the new project link file to be created and the project template link file. The project template can be a basic project in *.zw9 format or a project backup in *.zw1 format. After successfully creating the project, it is opened and the method returns the new Project object.
The following example shows how to create a project.
C# |
Copy Code
|
---|---|
Project oProject = new ProjectManager().CreateProject("$(MD_PROJECTS)\\Example_003.elk", "$(MD_TEMPLATES)\\IEC_bas003.zw9"); |
To open a project, use the OpenProject method. Its only parameter is the full name and path of the project link file.
C# |
Copy Code
|
---|---|
Project oProject = new ProjectManager().OpenProject("$(MD_PROJECTS)\\EPLAN_Sample_Project.elk"); |