Skip to content

Commit

Permalink
Merge pull request #98 from bvn-architecture/RBP-3
Browse files Browse the repository at this point in the history
RBP-3
  • Loading branch information
petersmithfromengland authored Nov 13, 2022
2 parents 0f6a2fd + 33a2e04 commit 5bd61d7
Show file tree
Hide file tree
Showing 18 changed files with 309,438 additions and 13 deletions.
4 changes: 4 additions & 0 deletions AddinDeployment/RemoveAddinAllVersions.bat
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ echo.
echo Removing BatchRvt addin for Revit 2022
call RemoveAddin.bat 2022

echo.
echo Removing BatchRvt addin for Revit 2023
call RemoveAddin.bat 2023

echo Done.
echo.

Expand Down
3 changes: 2 additions & 1 deletion BatchRevitDynamo/RevitBatchProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@ public enum UseRevitVersion {
Revit2019 = 5,
Revit2020 = 6,
Revit2021 = 7,
Revit2022 = 8
Revit2022 = 8,
Revit2023 = 9
}
public enum RevitSessionOption { UseSeparateSessionPerFile = 0, UseSameSessionForFilesOfSameVersion = 1 }
public enum CentralFileOpenOption { Detach = 0, CreateNewLocal = 1 }
Expand Down
10 changes: 10 additions & 0 deletions BatchRvtAddin2023/BatchRvtAddin2023.addin
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<RevitAddIns>
<AddIn Type="Application">
<Name>BatchRvtAddin</Name>
<Assembly>.\BatchRvt\BatchRvtAddin2023.dll</Assembly>
<AddInId>b57d22c8-5e1f-407a-86ea-a8615fd8df34</AddInId>
<FullClassName>BatchRvt.Addin.Revit2023.BatchRvtAddinApplication</FullClassName>
<VendorId>BATCHRVT</VendorId>
</AddIn>
</RevitAddIns>
90 changes: 90 additions & 0 deletions BatchRvtAddin2023/BatchRvtAddin2023.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{60C3C457-D35A-4343-A906-01CF666DC75E}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BatchRvt.Addin.Revit2023</RootNamespace>
<AssemblyName>BatchRvtAddin2023</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="IronPython, Version=2.7.0.40, Culture=neutral, PublicKeyToken=7f709c5b713576e1, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\References\IronPython-2.7.3\IronPython.dll</HintPath>
</Reference>
<Reference Include="IronPython.Modules, Version=2.7.0.40, Culture=neutral, PublicKeyToken=7f709c5b713576e1, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\References\IronPython-2.7.3\IronPython.Modules.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Dynamic, Version=1.1.0.20, Culture=neutral, PublicKeyToken=7f709c5b713576e1, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\References\IronPython-2.7.3\Microsoft.Dynamic.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Scripting, Version=1.1.0.20, Culture=neutral, PublicKeyToken=7f709c5b713576e1, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\References\IronPython-2.7.3\Microsoft.Scripting.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Scripting.Metadata, Version=1.1.0.20, Culture=neutral, PublicKeyToken=7f709c5b713576e1, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\References\IronPython-2.7.3\Microsoft.Scripting.Metadata.dll</HintPath>
</Reference>
<Reference Include="RevitAPI">
<HintPath>..\References\Revit\2023\RevitAPI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="RevitAPIUI">
<HintPath>..\References\Revit\2023\RevitAPIUI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\Common\GlobalAssemblyInfo.cs">
<Link>Properties\GlobalAssemblyInfo.cs</Link>
</Compile>
<Compile Include="BatchRvtAddinApplication.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BatchRvtScriptHost\BatchRvtScriptHost.csproj">
<Project>{673d1fb5-cfb2-4bdf-9609-c43979dd7197}</Project>
<Name>BatchRvtScriptHost</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="BatchRvtAddin2023.addin" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>call "$(ProjectDir)..\AddinDeployment\DeployAddin.bat" "$(ProjectDir)" "$(TargetDir)" "2023"</PostBuildEvent>
</PropertyGroup>
</Project>
96 changes: 96 additions & 0 deletions BatchRvtAddin2023/BatchRvtAddinApplication.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
//
// Revit Batch Processor
//
// Copyright (c) 2020 Daniel Rumery, BVN
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.ComponentModel;
using System.IO;
using WinForms = System.Windows.Forms;
using Autodesk.Revit.UI;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.ApplicationServices;

using BatchRvt.ScriptHost;

namespace BatchRvt.Addin.Revit2023
{
[Transaction(TransactionMode.Manual)]
[Regeneration(RegenerationOption.Manual)]
[DisplayName("BatchRvtAddin")]
[Description("BatchRvtAddin")]
public class BatchRvtAddinApplication : IExternalApplication
{
private static void SetupBatchScriptHost(ControlledApplication controlledApplication)
{
var pluginFolderPath = Path.GetDirectoryName(typeof(BatchRvtAddinApplication).Assembly.Location);

var batchRvtExternalEventHandler = new BatchRvtExternalEventHandler(pluginFolderPath);

batchRvtExternalEventHandler.Raise();
}

public Result OnStartup(UIControlledApplication uiApplication)
{
SetupBatchScriptHost(uiApplication.ControlledApplication);

return Result.Succeeded;
}

public Result OnShutdown(UIControlledApplication application)
{
return Result.Succeeded;
}
}

public class BatchRvtExternalEventHandler : IExternalEventHandler
{
private readonly ExternalEvent externalEvent_;
private readonly string pluginFolderPath_;

public BatchRvtExternalEventHandler(string pluginFolderPath)
{
this.externalEvent_ = ExternalEvent.Create(this);
this.pluginFolderPath_ = pluginFolderPath;
}

public void Execute(UIApplication uiApp)
{
try
{
ScriptHostUtil.ExecuteBatchScriptHost(this.pluginFolderPath_, uiApp);
}
catch (Exception e)
{
WinForms.MessageBox.Show(e.ToString(), ScriptHostUtil.BATCH_RVT_ERROR_WINDOW_TITLE);
}
}

public string GetName()
{
return "BatchRvt_ExternalEventHandler";
}

public ExternalEventRequest Raise()
{
return this.externalEvent_.Raise();
}
}
}

23 changes: 23 additions & 0 deletions BatchRvtAddin2023/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("BatchRvtAddin2023")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("BVN")]
[assembly: AssemblyProduct("BatchRvtAddin2023")]
[assembly: AssemblyCopyright("Copyright © BVN 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("60c3c457-d35a-4343-a906-01cf666dc75e")]
3 changes: 2 additions & 1 deletion BatchRvtUtil/BatchRvt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ public enum WorksetConfigurationOption { CloseAllWorksets = 0, OpenAllWorksets =
{ RevitVersion.SupportedRevitVersion.Revit2019, "BatchRvtAddin2019.addin" },
{ RevitVersion.SupportedRevitVersion.Revit2020, "BatchRvtAddin2020.addin" },
{ RevitVersion.SupportedRevitVersion.Revit2021, "BatchRvtAddin2021.addin" },
{ RevitVersion.SupportedRevitVersion.Revit2022, "BatchRvtAddin2022.addin" }
{ RevitVersion.SupportedRevitVersion.Revit2022, "BatchRvtAddin2022.addin" },
{ RevitVersion.SupportedRevitVersion.Revit2023, "BatchRvtAddin2023.addin" }
};

private static string ConstructCommandLineArguments(IEnumerable<KeyValuePair<string, string>> arguments)
Expand Down
7 changes: 5 additions & 2 deletions BatchRvtUtil/BatchRvtTasks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,9 @@ string testModeFolderPath
RevitVersion.SupportedRevitVersion.Revit2020 :
useRevitVersion == UseRevitVersion.Revit2021 ?
RevitVersion.SupportedRevitVersion.Revit2021 :
RevitVersion.SupportedRevitVersion.Revit2022
useRevitVersion == UseRevitVersion.Revit2022 ?
RevitVersion.SupportedRevitVersion.Revit2022 :
RevitVersion.SupportedRevitVersion.Revit2023

);

Expand Down Expand Up @@ -308,7 +310,8 @@ public enum UseRevitVersion {
Revit2019 = 5,
Revit2020 = 6,
Revit2021 = 7,
Revit2022 = 8
Revit2022 = 8,
Revit2023 = 9
}
}
}
19 changes: 15 additions & 4 deletions BatchRvtUtil/RevitVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ public enum SupportedRevitVersion {
Revit2019 = 4,
Revit2020 = 5,
Revit2021 = 6,
Revit2022 = 7
Revit2022 = 7,
Revit2023 = 8
}

private const string REVIT_EXECUTABLE_FILE_NAME = "Revit.exe";
Expand All @@ -49,7 +50,8 @@ public enum SupportedRevitVersion {
{ SupportedRevitVersion.Revit2019, @".\Autodesk\Revit\Addins\2019" },
{ SupportedRevitVersion.Revit2020, @".\Autodesk\Revit\Addins\2020" },
{ SupportedRevitVersion.Revit2021, @".\Autodesk\Revit\Addins\2021" },
{ SupportedRevitVersion.Revit2022, @".\Autodesk\Revit\Addins\2022" }
{ SupportedRevitVersion.Revit2022, @".\Autodesk\Revit\Addins\2022" },
{ SupportedRevitVersion.Revit2023, @".\Autodesk\Revit\Addins\2023" }
};

private static readonly Dictionary<SupportedRevitVersion, string> SUPPORTED_REVIT_VERSION_NUMBERS =
Expand All @@ -62,7 +64,8 @@ public enum SupportedRevitVersion {
{ SupportedRevitVersion.Revit2019, "2019" },
{ SupportedRevitVersion.Revit2020, "2020" },
{ SupportedRevitVersion.Revit2021, "2021" },
{ SupportedRevitVersion.Revit2022, "2022" }
{ SupportedRevitVersion.Revit2022, "2022" },
{ SupportedRevitVersion.Revit2023, "2023" }
};

private static readonly Dictionary<SupportedRevitVersion, IEnumerable<string>> REVIT_EXECUTABLE_FOLDER_PATHS =
Expand Down Expand Up @@ -127,6 +130,13 @@ public enum SupportedRevitVersion {
@"C:\Program Files\Autodesk\Revit 2022",
@"D:\Program Files\Autodesk\Revit 2022"
}
},
{
SupportedRevitVersion.Revit2023,
new [] {
@"C:\Program Files\Autodesk\Revit 2023",
@"D:\Program Files\Autodesk\Revit 2023"
}
}
};

Expand All @@ -140,7 +150,8 @@ public enum SupportedRevitVersion {
{ SupportedRevitVersion.Revit2019, @"C:\REVIT_LOCAL2019" },
{ SupportedRevitVersion.Revit2020, @"C:\REVIT_LOCAL2020" },
{ SupportedRevitVersion.Revit2021, @"C:\REVIT_LOCAL2021" },
{ SupportedRevitVersion.Revit2022, @"C:\REVIT_LOCAL2022" }
{ SupportedRevitVersion.Revit2022, @"C:\REVIT_LOCAL2022" },
{ SupportedRevitVersion.Revit2023, @"C:\REVIT_LOCAL2023" }
};

public static string GetRevitExecutableFolderPath(SupportedRevitVersion revitVersion)
Expand Down
2 changes: 2 additions & 0 deletions BatchRvtUtil/Scripts/revit_file_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ def __init__(self, revitFilePathData):
revitVersionNumber = RevitVersion.SupportedRevitVersion.Revit2021
elif any(revitVersionText.StartsWith(prefix) for prefix in revit_file_version.REVIT_VERSION_TEXT_PREFIXES_2022):
revitVersionNumber = RevitVersion.SupportedRevitVersion.Revit2022
elif any(revitVersionText.StartsWith(prefix) for prefix in revit_file_version.REVIT_VERSION_TEXT_PREFIXES_2023):
revitVersionNumber = RevitVersion.SupportedRevitVersion.Revit2023
self.revitVersionText = revitVersionText
self.revitVersionNumber = revitVersionNumber
return
Expand Down
3 changes: 3 additions & 0 deletions BatchRvtUtil/Scripts/revit_file_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ def GenerateRevitVersionTextPrefixes(revitVersionNumberText, includeDisciplineVe
REVIT_VERSION_TEXT_PREFIXES_2020 = GenerateRevitVersionTextPrefixes("2020")
REVIT_VERSION_TEXT_PREFIXES_2021 = GenerateRevitVersionTextPrefixes("2021")
REVIT_VERSION_TEXT_PREFIXES_2022 = GenerateRevitVersionTextPrefixes("2022")
REVIT_VERSION_TEXT_PREFIXES_2023 = GenerateRevitVersionTextPrefixes("2023")

def GetRevitVersionNumberTextFromRevitVersionText(revitVersionText):
revitVersionNumberText = None
Expand Down Expand Up @@ -237,5 +238,7 @@ def StartsWithOneOfPrefixes(text, prefixes):
revitVersionNumberText = "2021"
elif StartsWithOneOfPrefixes(revitVersionText, REVIT_VERSION_TEXT_PREFIXES_2022):
revitVersionNumberText = "2022"
elif StartsWithOneOfPrefixes(revitVersionText, REVIT_VERSION_TEXT_PREFIXES_2023):
revitVersionNumberText = "2023"
return revitVersionNumberText

6 changes: 3 additions & 3 deletions Common/GlobalAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
// Revision
//

[assembly: System.Reflection.AssemblyVersion("1.8.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersion("1.8.0.0")]
[assembly: System.Reflection.AssemblyFileVersion("1.8.0.0")]
[assembly: System.Reflection.AssemblyVersion("1.9.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersion("1.9.0.0")]
[assembly: System.Reflection.AssemblyFileVersion("1.9.0.0")]
Binary file added References/Revit/2023/RevitAPI.dll
Binary file not shown.
Loading

0 comments on commit 5bd61d7

Please sign in to comment.