-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fea677d
commit b074f0a
Showing
33 changed files
with
2,938 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -348,3 +348,6 @@ MigrationBackup/ | |
|
||
# Ionide (cross platform F# VS Code tools) working folder | ||
.ionide/ | ||
|
||
#Rider files | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 16.0.29806.167 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NWCBatchExporter", "NWCBatchExporter\NWCBatchExporter.csproj", "{B9E745D9-D2C1-401B-84B0-F51359A0914F}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{B9E745D9-D2C1-401B-84B0-F51359A0914F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{B9E745D9-D2C1-401B-84B0-F51359A0914F}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{B9E745D9-D2C1-401B-84B0-F51359A0914F}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{B9E745D9-D2C1-401B-84B0-F51359A0914F}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(NestedProjects) = preSolution | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {B4BEDBEF-64AD-4B91-BEE1-1BA3FD9DEC8C} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<RevitAddIns> | ||
<AddIn Type="Application"> | ||
<Name>BatchExporter</Name> | ||
<Assembly>NWCBatchExporter\NWCBatchExporter.dll</Assembly> | ||
<AddInId>01894EFB-E0C3-489E-9A44-7D64A4579FB0</AddInId> | ||
<FullClassName>NWCBatchExporter.Button</FullClassName> | ||
<VendorId>BIMO</VendorId> | ||
</AddIn> | ||
</RevitAddIns> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using System; | ||
using System.IO; | ||
using System.Reflection; | ||
using System.Windows.Media.Imaging; | ||
|
||
using Autodesk.Revit.UI; | ||
using Autodesk.Revit.Attributes; | ||
|
||
namespace NWCBatchExporter { | ||
[Transaction(TransactionMode.Manual)] | ||
public class Button : IExternalApplication { | ||
private const string TabLabel = "BIM One"; | ||
public Result OnStartup(UIControlledApplication application) { | ||
var toolsPanel = GetOrCreateRibbonPanel(application); | ||
|
||
string assemblieFolder = Path.GetDirectoryName(Assembly.GetAssembly(GetType()).Location); | ||
string commandPath = Path.Combine(assemblieFolder, "NWCBatchExporter.dll"); | ||
|
||
PushButton pushButton = toolsPanel.AddItem(new PushButtonData( | ||
"Batch Exporter", | ||
"Batch\nExporter", | ||
commandPath, | ||
"NWCBatchExporter.Command")) as PushButton; | ||
|
||
var buttonImage = Path.Combine(assemblieFolder, @"Resources\button.png"); | ||
if (!File.Exists(buttonImage)) | ||
buttonImage = Path.Combine(Directory.GetParent(assemblieFolder).FullName, @"Resources\button.png"); | ||
|
||
pushButton.LargeImage = new BitmapImage(new Uri(buttonImage)); | ||
pushButton.ToolTip = "Export your Revit 3D views in batch to Navisworks"; | ||
pushButton.ToolTipImage = new BitmapImage(new Uri(buttonImage)); | ||
|
||
return Result.Succeeded; | ||
} | ||
|
||
public Result OnShutdown(UIControlledApplication application) { | ||
return Result.Succeeded; | ||
} | ||
|
||
private RibbonPanel GetOrCreateRibbonPanel(UIControlledApplication application) | ||
{ | ||
var ribbonPanel = application.GetRibbonPanels(Tab.AddIns).Find(x => x.Name == TabLabel); | ||
if (ribbonPanel == null) | ||
ribbonPanel = application.CreateRibbonPanel(Tab.AddIns, TabLabel); | ||
|
||
return ribbonPanel; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System.Threading; | ||
using System.Globalization; | ||
using System.Windows; | ||
|
||
using Autodesk.Revit.DB; | ||
using Autodesk.Revit.UI; | ||
using Autodesk.Revit.Attributes; | ||
|
||
using NWCBatchExporter.Views; | ||
using NWCBatchExporter.Resources; | ||
|
||
|
||
namespace NWCBatchExporter { | ||
[Transaction(TransactionMode.Manual)] | ||
public class Command : IExternalCommand { | ||
public Autodesk.Revit.UI.Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { | ||
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; | ||
UIApplication uiapp = commandData.Application; | ||
UIDocument uidoc = uiapp.ActiveUIDocument; | ||
Document doc = uidoc.Document; | ||
//If the host document is not saved | ||
if (doc == null || string.IsNullOrEmpty(doc.PathName)) { | ||
System.Windows.MessageBox.Show(Resource.MsgBoxInfo_ProjectMustBeSaved, Resource.MsgBoxTitle_ProjectNotSaved, MessageBoxButton.OK,MessageBoxImage.Warning); | ||
return Result.Cancelled; | ||
} | ||
else | ||
{ | ||
if (OptionalFunctionalityUtils.IsNavisworksExporterAvailable() == false) { | ||
if (System.Windows.MessageBox.Show(Resource.MsgBoxInfo_NeedInstallAutodesk,Resource.MsgBoxTitle_MissingUtility, MessageBoxButton.YesNo,MessageBoxImage.Asterisk) == MessageBoxResult.Yes) | ||
{ | ||
System.Diagnostics.Process.Start("http://www.autodesk.com/products/navisworks/autodesk-navisworks-nwc-export-utility"); | ||
} | ||
return Result.Failed; | ||
} | ||
else | ||
{ | ||
NWCBatchExporterWindow dlg = new NWCBatchExporterWindow(doc); | ||
dlg.ShowDialog(); | ||
return Result.Succeeded; | ||
} | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#region Using Directives | ||
|
||
using System.Diagnostics; | ||
using System.Windows; | ||
using System.Windows.Documents; | ||
using System.Windows.Navigation; | ||
|
||
#endregion | ||
|
||
namespace NWCBatchExporter.Common | ||
{ | ||
public static class HyperlinkExtensions | ||
{ | ||
#region Static Fields | ||
|
||
/// <summary> | ||
/// Dependency Property used to extend the HyberLink element | ||
/// By using this Extension property the HyberLink element will open the URL without | ||
/// adding additional code to handle it. | ||
/// </summary> | ||
public static readonly DependencyProperty IsExternalProperty = | ||
DependencyProperty.RegisterAttached("IsExternal", typeof (bool), typeof (HyperlinkExtensions), | ||
new UIPropertyMetadata(false, OnIsExternalChanged)); | ||
|
||
#endregion | ||
|
||
#region Methods | ||
|
||
public static bool GetIsExternal(DependencyObject obj) | ||
{ | ||
return (bool) obj.GetValue(IsExternalProperty); | ||
} | ||
|
||
public static void SetIsExternal(DependencyObject obj, bool value) | ||
{ | ||
obj.SetValue(IsExternalProperty, value); | ||
} | ||
|
||
private static void OnIsExternalChanged(object sender, DependencyPropertyChangedEventArgs args) | ||
{ | ||
var hyperlink = sender as Hyperlink; | ||
|
||
if ((bool) args.NewValue) | ||
hyperlink.RequestNavigate += Hyperlink_RequestNavigate; | ||
else | ||
hyperlink.RequestNavigate -= Hyperlink_RequestNavigate; | ||
} | ||
|
||
private static void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e) | ||
{ | ||
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri)); | ||
e.Handled = true; | ||
} | ||
|
||
#endregion | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>net48</TargetFramework> | ||
<SccProjectName>SAK</SccProjectName> | ||
<SccLocalPath>SAK</SccLocalPath> | ||
<SccAuxPath>SAK</SccAuxPath> | ||
<SccProvider>SAK</SccProvider> | ||
<DebugEngines> | ||
{351668CC-8477-4fbf-BFE3-5F1006E4DB1F} | ||
</DebugEngines> | ||
<AssemblyTitle>BatchExporter</AssemblyTitle> | ||
<Product>BatchExporter</Product> | ||
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> | ||
<AssemblyVersion>21.0.0.0</AssemblyVersion> | ||
<FileVersion>21.0.0.0</FileVersion> | ||
<OutputPath>bin\$(Configuration)\</OutputPath> | ||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> | ||
<PostBuildEvent> | ||
copy "$(MSBuildProjectDirectory)\addin.addin" "%25appdata%25\Autodesk\Revit\Addins\2021\$(MSBuildProjectName).addin" | ||
xcopy "$(MSBuildProjectDirectory)\$(OutputPath)$(TargetFramework)\*" "%25appdata%25\Autodesk\Revit\Addins\2021\NWCBatchExporter\" /S /E /R /I /F /Y | ||
</PostBuildEvent> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'"> | ||
<DebugType>pdbonly</DebugType> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'"> | ||
<DebugType>full</DebugType> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Revit.RevitApi.x64" Version="2021.0.0"> | ||
</PackageReference> | ||
<PackageReference Include="Revit.RevitApiUI.x64" Version="2021.0.0"> | ||
</PackageReference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Reference Include="PresentationCore" /> | ||
<Reference Include="PresentationFramework" /> | ||
<Reference Include="System.Configuration.Install" /> | ||
<Reference Include="System.ServiceModel" /> | ||
<Reference Include="System.Windows" /> | ||
<Reference Include="System.Windows.Forms" /> | ||
<Reference Include="System.Xaml" /> | ||
<Reference Include="WindowsBase" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Update="Resources\Resource.fr.Designer.cs"> | ||
<DependentUpon>Resource.fr.resx</DependentUpon> | ||
<AutoGen>True</AutoGen> | ||
<DesignTime>True</DesignTime> | ||
</Compile> | ||
<Compile Update="Resources\Resource.Designer.cs"> | ||
<AutoGen>True</AutoGen> | ||
<DesignTime>True</DesignTime> | ||
<DependentUpon>Resource.resx</DependentUpon> | ||
</Compile> | ||
<Compile Update="Views\ExportOptionsWindow.xaml.cs"> | ||
<DependentUpon>ExportOptionsWindow.xaml</DependentUpon> | ||
</Compile> | ||
<Compile Update="Views\NWCBatchExporterWindow.xaml.cs"> | ||
<DependentUpon>NWCBatchExporterWindow.xaml</DependentUpon> | ||
</Compile> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="Resources\Styles.xaml"> | ||
<Generator>MSBuild:Compile</Generator> | ||
<SubType>Designer</SubType> | ||
</None> | ||
<Page Include="Views\ExportOptionsWindow.xaml"> | ||
<SubType>Designer</SubType> | ||
<Generator>MSBuild:Compile</Generator> | ||
</Page> | ||
<Page Include="Views\NWCBatchExporterWindow.xaml"> | ||
<SubType>Designer</SubType> | ||
<Generator>MSBuild:Compile</Generator> | ||
</Page> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Resource Include="Resources\TooIconNoNewVersionMiniGray.png" /> | ||
<Resource Include="Resources\ToolIconExitMiniGray.png" /> | ||
<Resource Include="Resources\ToolIconHelpMini.png" /> | ||
<Resource Include="Resources\ToolIconHelpMiniGray.png" /> | ||
<Resource Include="Resources\ToolIconNewVersionMini.png" /> | ||
<Resource Include="Resources\ToolIconNewVersionMiniGray.png" /> | ||
<Resource Include="Resources\ToolIconNoConnectMini.png" /> | ||
<Resource Include="Resources\ToolIconNoConnectMiniGray.png" /> | ||
<Resource Include="Resources\ToolIconSupportMiniGray.png" /> | ||
<None Include="Addin.addin"> | ||
<AutoGen>True</AutoGen> | ||
<DesignTime>True</DesignTime> | ||
</None> | ||
<Resource Include="Resources\appicon.ico"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</Resource> | ||
<Content Include="Resources\apps.gif"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</Content> | ||
<Content Include="Resources\button.png"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</Content> | ||
<Content Include="Resources\mail.gif"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</Content> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<EmbeddedResource Update="Resources\Resource.fr.resx"> | ||
<Generator>PublicResXFileCodeGenerator</Generator> | ||
<LastGenOutput>Resource.fr.Designer.cs</LastGenOutput> | ||
</EmbeddedResource> | ||
<EmbeddedResource Update="Resources\Resource.resx"> | ||
<Generator>PublicResXFileCodeGenerator</Generator> | ||
<LastGenOutput>Resource.Designer.cs</LastGenOutput> | ||
</EmbeddedResource> | ||
</ItemGroup> | ||
</Project> |
Oops, something went wrong.