Skip to content

Design Automation for Revit library utility.

License

Notifications You must be signed in to change notification settings

ricaun-io/ricaun.Revit.DA

Repository files navigation

ricaun.Revit.DA

Revit 2019 Visual Studio 2022 Nuke License MIT Build Release

ricaun.Revit.DA

ricaun.Revit.DA package makes it easier to work with Design Automation, and fix some issues and limitations from the official Design Automation for Revit.

This project was generated by the ricaun.AppLoader Revit plugin.

PackageReference

Install the ricaun.Revit.DA library from NuGet.

<PackageReference Include="ricaun.Revit.DA" Version="*" />

Features

The main feature of this library is to fix some issues and limitations from the official Design Automation for Revit.

DesignApplication

The DesignApplication is a base class with the IExternalDBApplication interface and some abstractions to help you to execute Design Automation for Revit.

public class App : DesignApplication
{
    public override bool Execute(Application application, string filePath, Document document)
    {
        return true;
    }
}

The DesignApplication<T> support the T type using the interface IDesignAutomation and an instance is created to Execute the Design Automation.

public class App : DesignApplication<DesignAutomation>
{

}
public class DesignAutomation : IDesignAutomation
{
    public bool Execute(Application application, string filePath, Document document)
    {
        return true;
    }
}

The OnStartup and OnShutdown methods are virtual to be overridden.

public class App : DesignApplication<DesignAutomation>
{
    public override void OnStartup() {}

    public override void OnShutdown() {}
}

Properties

ControlledApplication

The ControlledApplication stores the internal ControlledApplication from the IExternalDBApplication.

public override void OnStartup()
{
    ControlledApplication.ApplicationInitialized += (s, e) => { };
}

UseConsoleLog

The UseConsoleLog is true by default to disable/enable the console log for the internal DesignApplication methods.

public class App : DesignApplication<DesignAutomation>
{
    public override bool UseConsoleLog => false; // true by default
}

UseDesignApplicationLoader

The UseDesignApplicationLoader is true by default to force the Design Automation to support PackageContents.xml with multiple versions.

public class App : DesignApplication<DesignAutomation>
{
    public override bool UseDesignApplicationLoader => false; // true by default
}

UseExternalService

The UseExternalService is true by default to force the Design Automation to support ActiveAddInId by executing the Execute inside the ExternalService.

public class App : DesignApplication<DesignAutomation>
{
    public override bool UseExternalService => false; // true by default
}

Tests

The ricaun.Revit.DA.Tests test project requires some environment variables with the APS configuration to enable running Design Automation for Revit and test the ricaun.Revit.DA.Example.

The project use the package Autodesk.Forge.Oss.DesignAutomation with the environment variables APS_CLIENT_ID and APS_CLIENT_SECRET.

APS_CLIENT_ID=<your client id>
APS_CLIENT_SECRET=<your client secret>

Your APS application requires to have API access to Data Management API and Design Automation API.

Build

To build the project and generate the ricaun.Revit.DA.Example.bundle.zip is required to run the Build project or execute the build.cmd in the main solution folder.

License

This project is licensed under the MIT License.


Do you like this project? Please star this project on GitHub!