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.
Install the ricaun.Revit.DA
library from NuGet.
<PackageReference Include="ricaun.Revit.DA" Version="*" />
The main feature of this library is to fix some issues and limitations from the official Design Automation for Revit.
- Support
PackageContents.xml
with multiple versions - Design Automation for Revit ignores PackageContents.xml configuration. - Support
ActiveAddInId
inside Design Automation ready event. - Design Automation for Revit ActiveAddInId is null
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() {}
}
The ControlledApplication
stores the internal ControlledApplication
from the IExternalDBApplication
.
public override void OnStartup()
{
ControlledApplication.ApplicationInitialized += (s, e) => { };
}
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
}
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
}
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
}
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
.
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.
This project is licensed under the MIT License.
Do you like this project? Please star this project on GitHub!