From b50135678aad1e12625723887a9f5d114ffcf697 Mon Sep 17 00:00:00 2001 From: Luiz Henrique Cassettari Date: Mon, 20 Jan 2025 18:35:23 -0300 Subject: [PATCH] Update documentation --- ricaun.Revit.DA/DesignApplication.cs | 38 +++++++++++++++++++++------ ricaun.Revit.DA/DesignApplicationT.cs | 25 ++++++++++++++++++ ricaun.Revit.DA/IDesignAutomation.cs | 10 +++++++ 3 files changed, 65 insertions(+), 8 deletions(-) create mode 100644 ricaun.Revit.DA/DesignApplicationT.cs diff --git a/ricaun.Revit.DA/DesignApplication.cs b/ricaun.Revit.DA/DesignApplication.cs index 56c51fa..100dc9b 100644 --- a/ricaun.Revit.DA/DesignApplication.cs +++ b/ricaun.Revit.DA/DesignApplication.cs @@ -7,14 +7,9 @@ namespace ricaun.Revit.DA { - public abstract class DesignApplication : DesignApplication where T : IDesignAutomation - { - public override bool Execute(Application application, string filePath, Document document) - { - return Activator.CreateInstance().Execute(application, filePath, document); - } - } - + /// + /// Represents a design application that executes a specific type of design automation. + /// public abstract class DesignApplication : IExternalDBApplication, IDesignAutomation { /// @@ -25,13 +20,35 @@ public abstract class DesignApplication : IExternalDBApplication, IDesignAutomat /// Use DesignApplicationLoader to load the correct version of the DesignApplication based in the `PackageContents.xml` configuration. /// public virtual bool UseDesignApplicationLoader => true; + /// + /// Gets the controlled application. + /// public ControlledApplication ControlledApplication { get; private set; } + /// + /// Method called when the application starts up. + /// public virtual void OnStartup() { } + /// + /// Method called when the application shuts down. + /// public virtual void OnShutdown() { } + /// + /// Executes the design automation. + /// + /// The Revit application. + /// The file path to the document. + /// The Revit document. + /// True if the execution is successful; otherwise, false. public abstract bool Execute(Application application, string filePath, Document document); private IExternalDBApplication designApplication; private DesignAutomationSingleExternalServer externalServer; + + /// + /// Method called when the application starts up. + /// + /// The controlled application. + /// The result of the external DB application startup. public ExternalDBApplicationResult OnStartup(ControlledApplication application) { ControlledApplication = application; @@ -66,6 +83,11 @@ public ExternalDBApplicationResult OnStartup(ControlledApplication application) return ExternalDBApplicationResult.Succeeded; } + /// + /// Method called when the application shuts down. + /// + /// The controlled application. + /// The result of the external DB application shutdown. public ExternalDBApplicationResult OnShutdown(ControlledApplication application) { ControlledApplication = application; diff --git a/ricaun.Revit.DA/DesignApplicationT.cs b/ricaun.Revit.DA/DesignApplicationT.cs new file mode 100644 index 0000000..f66822b --- /dev/null +++ b/ricaun.Revit.DA/DesignApplicationT.cs @@ -0,0 +1,25 @@ +using Autodesk.Revit.ApplicationServices; +using Autodesk.Revit.DB; +using System; + +namespace ricaun.Revit.DA +{ + /// + /// Represents a design application that executes a specific type of design automation. + /// + /// The type of design automation to execute. + public abstract class DesignApplication : DesignApplication where T : IDesignAutomation + { + /// + /// Executes the design automation of type . + /// + /// The Revit application. + /// The file path to the document. + /// The Revit document. + /// True if the execution is successful; otherwise, false. + public override bool Execute(Application application, string filePath, Document document) + { + return Activator.CreateInstance().Execute(application, filePath, document); + } + } +} diff --git a/ricaun.Revit.DA/IDesignAutomation.cs b/ricaun.Revit.DA/IDesignAutomation.cs index e9b40bc..c7dcf28 100644 --- a/ricaun.Revit.DA/IDesignAutomation.cs +++ b/ricaun.Revit.DA/IDesignAutomation.cs @@ -3,8 +3,18 @@ namespace ricaun.Revit.DA { + /// + /// Interface for design automation tasks in Revit. + /// public interface IDesignAutomation { + /// + /// Executes a design automation task. + /// + /// The Revit application instance. + /// The file path to the document. + /// The Revit document instance. + /// True if the task was executed successfully, otherwise false. bool Execute(Application application, string filePath, Document document); } }