Overview
Renga API allows developers to manage Renga projects. The IApplication interface provides methods to create, create with template, import from IFC and open Renga projects. The IProject interface provides methods to save, save as and query project type and presence of unsaved changes.
How to Create Renga project
The code below demonstrates how to create and save a project:
C++
auto pApplication = Renga::CreateApplication(CLSCTX_LOCAL_SERVER);
int result = pApplication->CreateProject();
if (result == 0)
{
auto pProject = pApplication->Project();
pProject->SaveAs(bstr_t(filePath), Renga::ProjectType::ProjectType_Project, VARIANT_TRUE);
pApplication->CloseProject(VARIANT_TRUE);
}
C#
var application = new Renga.Application();
int result = application.CreateProject();
if (result == 0)
{
var project = application.Project();
project.SaveAs(filePath, Renga.ProjectType.ProjectType_Project, true);
application.CloseProject(true);
}
How to Open Renga project
The code below demonstrates how to open and save project:
C++
auto pApplication = Renga::CreateApplication(CLSCTX_LOCAL_SERVER);
int result = pApplication->OpenProject(bstr_t(filePath));
if (result == 0)
{
auto pProject = pApplication->Project();
if (pProject->HasUnsavedChanges())
pProject->Save();
pApplication->CloseProject(VARIANT_TRUE);
}
C#
var application = new Renga.Application();
int result = application.OpenProject(filePath);
if (result == 0)
{
var project = application.Project();
if (project.HasUnsavedChanges())
project.Save();
application.CloseProject(true);
}
See also
Related samples
- OpenSaveCloseProject
- ExportIfcDwgDxf