Skip to content

Commit 082747d

Browse files
Merge pull request #127 from bvn-architecture/1.11.0-beta
v1.11.0 beta
2 parents 47b0c4b + 116111d commit 082747d

23 files changed

+621
-408
lines changed

AddinDeployment/RemoveAddinAllVersions.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
pushd %~dp0
44

5-
for %%i in (2015 2016 2017 2018 2019 2020 2021 2022 2023 2024) do (
5+
for %%i in (2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025) do (
66
echo.
77
echo Removing BatchRvt addin for Revit %%i
88
call RemoveAddin.bat %%i

BatchRevitDynamo/RevitBatchProcessor.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ public enum UseRevitVersion
5050
Revit2021 = 7,
5151
Revit2022 = 8,
5252
Revit2023 = 9,
53-
Revit2024 = 10
54-
53+
Revit2024 = 10,
54+
Revit2025 = 11
5555
}
5656

5757
/// <summary>
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8" standalone="no"?>
2+
<RevitAddIns>
3+
<AddIn Type="Application">
4+
<Name>BatchRvtAddin</Name>
5+
<Assembly>.\BatchRvt\BatchRvtAddin2025.dll</Assembly>
6+
<AddInId>b57d22c8-5e1f-407a-86ea-a8615fd8df34</AddInId>
7+
<FullClassName>BatchRvt.Addin.Revit2025.BatchRvtAddinApplication</FullClassName>
8+
<VendorId>BATCHRVT</VendorId>
9+
</AddIn>
10+
</RevitAddIns>
+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFramework>net8.0-windows</TargetFramework>
4+
<OutputType>Library</OutputType>
5+
<RootNamespace>BatchRvtAddin2025</RootNamespace>
6+
<AssemblyName>BatchRvtAddin2025</AssemblyName>
7+
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
8+
9+
10+
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
11+
<Copyright>Copyright © 2024</Copyright>
12+
<Company>BVN</Company>
13+
<Product>BatchRvtAddin2025</Product>
14+
<AssemblyTitle>BatchRvtAddin2025</AssemblyTitle>
15+
<AssemblyVersion>1.0.0</AssemblyVersion>
16+
<FileVersion>1.0.0</FileVersion>
17+
18+
<UseWindowsForms>true</UseWindowsForms>
19+
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
20+
<BaseOutputPath>bin\x64\</BaseOutputPath>
21+
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
22+
</PropertyGroup>
23+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
24+
<PlatformTarget>x64</PlatformTarget>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27+
<OutputPath>bin\x64\Release\</OutputPath>
28+
<PlatformTarget>x64</PlatformTarget>
29+
</PropertyGroup>
30+
<ItemGroup>
31+
<PackageReference Include="FluentAssertions">
32+
<Version>6.8.0</Version>
33+
</PackageReference>
34+
<PackageReference Include="IronPython" Version="2.7.12" />
35+
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
36+
<PackageReference Include="Moq">
37+
<Version>4.18.3</Version>
38+
</PackageReference>
39+
<PackageReference Include="Nice3point.Revit.Api.RevitAPI">
40+
<Version>2025.2.0</Version>
41+
</PackageReference>
42+
<PackageReference Include="Nice3point.Revit.Api.RevitAPIUI">
43+
<Version>2025.2.0</Version>
44+
</PackageReference>
45+
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
46+
<PackageReference Include="xunit">
47+
<Version>2.4.2</Version>
48+
</PackageReference>
49+
</ItemGroup>
50+
<ItemGroup>
51+
<ProjectReference Include="..\BatchRvtScriptHost\BatchRvtScriptHost.csproj" />
52+
<ProjectReference Include="..\BatchRvtUtil\BatchRvtUtil.csproj" />
53+
</ItemGroup>
54+
55+
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
56+
<Exec Command="call &quot;$(ProjectDir)..\AddinDeployment\DeployAddin.bat&quot; &quot;$(ProjectDir)&quot; &quot;$(TargetDir)&quot; &quot;2025&quot;" />
57+
</Target>
58+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
//
2+
// Revit Batch Processor
3+
//
4+
// Copyright (c) 2020 Daniel Rumery, BVN
5+
//
6+
// This program is free software: you can redistribute it and/or modify
7+
// it under the terms of the GNU General Public License as published by
8+
// the Free Software Foundation, either version 3 of the License, or
9+
// (at your option) any later version.
10+
//
11+
// This program is distributed in the hope that it will be useful,
12+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
// GNU General Public License for more details.
15+
//
16+
// You should have received a copy of the GNU General Public License
17+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
//
19+
//
20+
21+
using System;
22+
using System.ComponentModel;
23+
using System.IO;
24+
using Autodesk.Revit.ApplicationServices;
25+
using Autodesk.Revit.Attributes;
26+
using Autodesk.Revit.UI;
27+
using BatchRvt.ScriptHost;
28+
using WinForms = System.Windows.Forms;
29+
30+
namespace BatchRvt.Addin.Revit2025
31+
{
32+
[Transaction(TransactionMode.Manual)]
33+
[Regeneration(RegenerationOption.Manual)]
34+
[DisplayName("BatchRvtAddin")]
35+
[Description("BatchRvtAddin")]
36+
public class BatchRvtAddinApplication : IExternalApplication
37+
{
38+
public Result OnStartup(UIControlledApplication uiApplication)
39+
{
40+
SetupBatchScriptHost(uiApplication.ControlledApplication);
41+
42+
return Result.Succeeded;
43+
}
44+
45+
public Result OnShutdown(UIControlledApplication application)
46+
{
47+
return Result.Succeeded;
48+
}
49+
50+
private static void SetupBatchScriptHost(ControlledApplication controlledApplication)
51+
{
52+
var pluginFolderPath = Path.GetDirectoryName(typeof(BatchRvtAddinApplication).Assembly.Location);
53+
54+
var batchRvtExternalEventHandler = new BatchRvtExternalEventHandler(pluginFolderPath);
55+
56+
batchRvtExternalEventHandler.Raise();
57+
}
58+
}
59+
60+
public class BatchRvtExternalEventHandler : IExternalEventHandler
61+
{
62+
private readonly ExternalEvent externalEvent_;
63+
private readonly string pluginFolderPath_;
64+
65+
public BatchRvtExternalEventHandler(string pluginFolderPath)
66+
{
67+
externalEvent_ = ExternalEvent.Create(this);
68+
pluginFolderPath_ = pluginFolderPath;
69+
}
70+
71+
public void Execute(UIApplication uiApp)
72+
{
73+
try
74+
{
75+
ScriptHostUtil.ExecuteBatchScriptHost(pluginFolderPath_, uiApp);
76+
}
77+
catch (Exception e)
78+
{
79+
WinForms.MessageBox.Show(e.ToString(), ScriptHostUtil.BATCH_RVT_ERROR_WINDOW_TITLE);
80+
}
81+
}
82+
83+
public string GetName()
84+
{
85+
return "BatchRvt_ExternalEventHandler";
86+
}
87+
88+
public ExternalEventRequest Raise()
89+
{
90+
return externalEvent_.Raise();
91+
}
92+
}
93+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"profiles": {
3+
"Revit 2025": {
4+
"commandName": "Executable",
5+
"executablePath": "C:\\Program Files\\Autodesk\\Revit 2025\\Revit.exe"
6+
}
7+
}
8+
}

BatchRvtScriptHost/Util/ScriptHostUtil.cs

+12-10
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
using System;
2222
using System.Collections.Generic;
2323
using System.Collections.Specialized;
24-
using System.Diagnostics;
2524
using System.IO;
2625

2726
namespace BatchRvt.ScriptHost;
@@ -51,12 +50,13 @@ object uiApplicationObject
5150
engine,
5251
new Dictionary<string, object>
5352
{
54-
{ "__revit__", uiApplicationObject }
53+
{ "__revit__", uiApplicationObject },
5554
});
5655

5756
var mainModuleScope = ScriptUtil.CreateMainModule(engine);
5857

5958
var pluginFullFolderPath = Path.GetFullPath(pluginFolderPath);
59+
6060
var scriptHostFilePath = Path.Combine(batchRvtScriptsFolderPath, BatchScriptHostFilename);
6161
var batchRvtFolderPath = GetBatchRvtFolderPath(environmentVariables);
6262

@@ -108,18 +108,20 @@ private static string GetEnvironmentVariable(StringDictionary environmentVariabl
108108

109109
private static StringDictionary GetEnvironmentVariables()
110110
{
111-
StringDictionary environmentVariables = null;
112-
113-
// NOTE: Have encountered (at least once) a NullReferenceException upon accessing the EnvironmentVariables property!
114111
try
115112
{
116-
environmentVariables = Process.GetCurrentProcess().StartInfo.EnvironmentVariables;
113+
var environmentVariables = new StringDictionary();
114+
var ev = Environment.GetEnvironmentVariables();
115+
foreach (string key in ev.Keys)
116+
{
117+
environmentVariables[key] = ev[key].ToString();
118+
}
119+
120+
return environmentVariables;
117121
}
118-
catch (NullReferenceException e)
122+
catch (NullReferenceException)
119123
{
120-
environmentVariables = null;
124+
return null;
121125
}
122-
123-
return environmentVariables;
124126
}
125127
}

BatchRvtUtil/BatchRvt.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ public enum RevitSessionOption
6868
{ RevitVersion.SupportedRevitVersion.Revit2021, "BatchRvtAddin2021.addin" },
6969
{ RevitVersion.SupportedRevitVersion.Revit2022, "BatchRvtAddin2022.addin" },
7070
{ RevitVersion.SupportedRevitVersion.Revit2023, "BatchRvtAddin2023.addin" },
71-
{ RevitVersion.SupportedRevitVersion.Revit2024, "BatchRvtAddin2024.addin" }
71+
{ RevitVersion.SupportedRevitVersion.Revit2024, "BatchRvtAddin2024.addin" },
72+
{ RevitVersion.SupportedRevitVersion.Revit2025, "BatchRvtAddin2025.addin" },
7273
};
7374

7475

0 commit comments

Comments
 (0)