Skip to content

Commit

Permalink
Fix DesignAutomation method selection
Browse files Browse the repository at this point in the history
  • Loading branch information
ricaun committed Aug 28, 2024
1 parent ff2b34e commit 65b3f5b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Add `DesignAutomationLoadVersion` to load the right version of the addin.
- Add `AssemblyResolve` in the `DesignAutomationLoadVersion` to load dependencies in the right version.
- Use `where T : IDesignAutomation` in `DesignAutomation<T>` and `DesignAutomationLoadVersion<T>`.
- Fix `DesignAutomation` method selection by finding first method `Execute` with 3 parameters.

## [1.3.1] / 2025-06-15 - 2025-08-27
- Add `AddInId` in the output. #9
Expand Down
Binary file modified DesignAutomationConsole/Bundle/RevitAddin.DA.Tester.bundle.zip
Binary file not shown.
12 changes: 11 additions & 1 deletion RevitAddin.DA.Tester/Revit/DesignAutomation.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using DesignAutomationFramework;
using System;
using System.Linq;

namespace RevitAddin.DA.Tester.Revit
{
Expand Down Expand Up @@ -49,9 +50,18 @@ private void DesignAutomationReadyEvent(object sender, DesignAutomationReadyEven

var data = e.DesignAutomationData;

Console.WriteLine("--------------------------------------------------");
Console.WriteLine($"RevitApp: {data.RevitApp} FilePath: {data.FilePath} RevitDoc: {data.RevitDoc}");
Console.WriteLine("--------------------------------------------------");

try
{
var method = instance.GetType().GetMethod(nameof(IDesignAutomation.Execute));
var method = instance.GetType().GetMethods()
.Where(e => e.Name.Equals(nameof(IDesignAutomation.Execute)))
.FirstOrDefault(e => e.GetParameters().Count() == 3);

Console.WriteLine($"Invoke: {method}");

var result = method.Invoke(instance, new object[] { data.RevitApp, data.FilePath, data.RevitDoc });

if (result is bool resultBool)
Expand Down
2 changes: 1 addition & 1 deletion RevitAddin.DA.Tester/RevitAddin.DA.Tester.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@

<PropertyGroup>
<PackageId>RevitAddin.DA.Tester</PackageId>
<Version>1.4.0-beta</Version>
<Version>1.4.0-beta.1</Version>
<ProjectGuid>{7C324916-9F8D-43B0-B226-DA67D2504393}</ProjectGuid>
</PropertyGroup>

Expand Down

0 comments on commit 65b3f5b

Please sign in to comment.