diff --git a/RevitAddin.sln b/RevitAddin.sln deleted file mode 100644 index 5b70a9c..0000000 --- a/RevitAddin.sln +++ /dev/null @@ -1,41 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.28803.352 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3F33163D-0074-4DF6-B12F-3A587CEC4781}" - ProjectSection(SolutionItems) = preProject - .gitattributes = .gitattributes - .gitignore = .gitignore - src\__TemplateIcon.ico = src\__TemplateIcon.ico - appveyor.yml = appveyor.yml - build.ps1 = build.ps1 - global.json = global.json - LICENSE = LICENSE - README.md = README.md - src\RevitAddin.vstemplate = src\RevitAddin.vstemplate - EndProjectSection -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RevitAddin", "src\RevitAddin.csproj", "{286410B8-6185-4DFE-AEEC-8680398938CA}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug One|x64 = Debug One|x64 - Debug|x64 = Debug|x64 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {286410B8-6185-4DFE-AEEC-8680398938CA}.Debug One|x64.ActiveCfg = Debug One|x64 - {286410B8-6185-4DFE-AEEC-8680398938CA}.Debug One|x64.Build.0 = Debug One|x64 - {286410B8-6185-4DFE-AEEC-8680398938CA}.Debug|x64.ActiveCfg = Debug|x64 - {286410B8-6185-4DFE-AEEC-8680398938CA}.Debug|x64.Build.0 = Debug|x64 - {286410B8-6185-4DFE-AEEC-8680398938CA}.Release|x64.ActiveCfg = Release|x64 - {286410B8-6185-4DFE-AEEC-8680398938CA}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {D1BC8B4A-4C07-465E-928B-C7D92F559335} - EndGlobalSection -EndGlobal diff --git a/RevitAddin.sln.DotSettings b/RevitAddin.sln.DotSettings deleted file mode 100644 index ae25e8f..0000000 --- a/RevitAddin.sln.DotSettings +++ /dev/null @@ -1,4 +0,0 @@ - - True - True - True \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index d71a5ad..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,109 +0,0 @@ -# Operating system (build VM template) -os: Windows Server 2016 - -# If the build configuration does not specify build worker image -# then Visual Studio 2015 image is used. -image: Visual Studio 2017 - -# Restrict to Git branches below -branches: - only: - - master - -environment: - VERSION_SIMPLE: '{version}' - VERSION_INFORMATIONAL: '{version}' - VERSION_UNSTABLE_SUFFIX: 'preview' - APPVEYOR_TOKEN: - secure: LtoVAPATN9iTCl1zkCvEktqP92QSEEngyS3vqG3GphE= - -init: -- ps: | - $env:VERSION_SIMPLE = $env:APPVEYOR_BUILD_VERSION.TrimStart("v") - $env:VERSION_INFORMATIONAL = "$env:VERSION_SIMPLE" - $env:GITHUB_REPO_API = "https://api.github.com/repos/$env:APPVEYOR_REPO_NAME/tags" - - if ($env:APPVEYOR_REPO_TAG -eq "true" -and $env:APPVEYOR_REPO_TAG_NAME) { - ### CHECK IF A IT'S A TAGGED BUILD - $env:APPVEYOR_REPO_TAG_NAME = $env:APPVEYOR_REPO_TAG_NAME.TrimStart("v") - Write-Host "Building a tagged Git commit: $git_current_tag"; - if ($env:APPVEYOR_REPO_TAG_NAME -match '^([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?)$') { - $tag_ver = [version]$env:APPVEYOR_REPO_TAG_NAME - $env:VERSION_INFORMATIONAL = "{0}.{1}.{2}" -f $tag_ver.Major, $tag_ver.Minor, $tag_ver.Build - $env:VERSION_SIMPLE = "$env:VERSION_INFORMATIONAL.$env:APPVEYOR_BUILD_NUMBER" - } - } elseif ($env:VERSION_INFORMATIONAL -match '^([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?)$') { - $current_ver = [version]$env:VERSION_INFORMATIONAL - $env:VERSION_INFORMATIONAL = "{0}.{1}.{2}" -f $current_ver.Major, $current_ver.Minor, $current_ver.Build - $env:VERSION_INFORMATIONAL = "{0}-{1}{2}" -f $env:VERSION_INFORMATIONAL, $env:VERSION_UNSTABLE_SUFFIX, $env:APPVEYOR_BUILD_NUMBER - } - - ### MAKE CALCULATED INFORMATIONAL VERSION THE ACTUAL BUILD VERSION - Update-AppveyorBuild -Version $env:VERSION_INFORMATIONAL - Write-Host "Using build version: $env:VERSION_SIMPLE" - Write-Host "Using (informational) build version: $env:VERSION_INFORMATIONAL" - -dotnet_csproj: - patch: true - file: '**\*.csproj' - assembly_version: $(VERSION_SIMPLE) - file_version: $(VERSION_SIMPLE) - version: $(VERSION_INFORMATIONAL) - package_version: $(VERSION_INFORMATIONAL) - informational_version: $(VERSION_INFORMATIONAL) - -# Scripts that run after cloning repository -install: - - dotnet restore - -# Run scripts below before -before_build: - - where msbuild - - cmd: msbuild /t:Clean - -# To run your custom scripts instead of automatic MSBuild -build_script: - - cmd: msbuild /t:Rebuild - - ps: .\build.ps1 - -after_build: - - cmd: 7z a RevitAddin_2014-2020.zip %APPVEYOR_BUILD_FOLDER%\dist\*.* - - cmd: 7z a RevitAddin_2014-2020.zip %APPVEYOR_BUILD_FOLDER%\dist\**\*.* - -artifacts: - - path: RevitAddin_2014-2020.zip - name: RevitAddin - -after_deploy: - - ps: | - if ($env:APPVEYOR_REPO_TAG -eq "true" -and $env:APPVEYOR_REPO_TAG_NAME) { - $apiUrl = 'https://ci.appveyor.com/api' - $headers = @{ - "Authorization" = "Bearer $env:APPVEYOR_TOKEN" - "Content-type" = "application/json" - } - Invoke-RestMethod -Method Put "$apiUrl/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/settings/build-number" -Body '{"nextBuildNumber": 1 }' -Headers $headers - ## Update the version in case of ragged build - $env:APPVEYOR_REPO_TAG_NAME = $env:APPVEYOR_REPO_TAG_NAME.TrimStart("v") - if ($env:APPVEYOR_REPO_TAG_NAME -match '^([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?)$') { - $tag_ver = [version]$env:APPVEYOR_REPO_TAG_NAME - $ver_format = "version: {0}.{1}.{2}.{3}" -f $tag_ver.Major, $tag_ver.Minor, ($tag_ver.Build + 1), '{build}' - $headers."Content-type" = "text/plain"; - Invoke-RestMethod -Method Put "$apiUrl/projects/$env:APPVEYOR_ACCOUNT_NAME/$env:APPVEYOR_PROJECT_SLUG/settings/yaml" -Body $ver_format -Headers $headers - } - } - -# Deploy to GitHub releases -deploy: - - - provider: GitHub - auth_token: - secure: 2+d0KgCbWQpUR8TZfzvUEzbi4NQP6F/Tt0PUwLn6jXZCyO8FnrFVFJPsFa0QBQFl - artifact: RevitAddin - draft: false - force_update: true - prerelease: false - release: "Revit 2014-2020 C# Addin Template fro Visual Studio v$(APPVEYOR_REPO_TAG_NAME)" - tag: $(APPVEYOR_REPO_TAG_NAME) - on: - appveyor_repo_tag: true \ No newline at end of file diff --git a/build.ps1 b/build.ps1 deleted file mode 100644 index 9708299..0000000 --- a/build.ps1 +++ /dev/null @@ -1,17 +0,0 @@ -#Requires -Version 3 - -# Process source files -$srcFiles = Get-ChildItem -Recurse .\src\* -Include *.cs*, *.addin | Where-Object {$_.FullName -NotMatch "\\obj\\"} -foreach ($file in $srcFiles) { - $outfile = ($file | Resolve-Path -Relative).Replace('\src\', '\dist\') - New-Item -ItemType Directory -Force -Path (Split-Path -Path $outfile -Parent) | Out-Null - (Get-Content $file).Replace('RevitAddin', '$safeprojectname$').Replace('00000000-0000-0000-0000-00000000000', '$guid').Replace(' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Localization: test string with spaces ->work! - - \ No newline at end of file diff --git a/src/Properties/Resources.ru-RU.resx b/src/Properties/Resources.ru-RU.resx deleted file mode 100644 index 26ec637..0000000 --- a/src/Properties/Resources.ru-RU.resx +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Локализация: тестовая строка с пробелами -> работает! - - - Моя тестовая подсказка - - - Тестовая панель - - - Тестовое меню - - - Текст 1 - - - Эта команда может быть вызвана только если у Вас уже документ открыт и он готов к работе! - - \ No newline at end of file diff --git a/src/Resources/trollFace.png b/src/Resources/trollFace.png deleted file mode 100644 index 243c4d9..0000000 Binary files a/src/Resources/trollFace.png and /dev/null differ diff --git a/src/RevitAddin.csproj.DotSettings b/src/RevitAddin.csproj.DotSettings deleted file mode 100644 index 29470bf..0000000 --- a/src/RevitAddin.csproj.DotSettings +++ /dev/null @@ -1,3 +0,0 @@ - - True - True \ No newline at end of file diff --git a/src/RevitAddin.vstemplate b/src/RevitAddin.vstemplate deleted file mode 100644 index 0350112..0000000 --- a/src/RevitAddin.vstemplate +++ /dev/null @@ -1,37 +0,0 @@ - - - Revit 2014-2020 C# Addin - Class library template for a Revit 2014-2020 C# .NET add-in project - CSharp - - - true - RevitAddin - true - Enabled - true - true - __TemplateIcon.ico - - - - - launchSettings.json - Resources.resx - Resources.ru-RU.resx - - - - testCommand.png - trollFace.png - - AddinManifest.addin - App.cs - ExternalCommand.cs - RibbonCommand.cs - RibbonHelper.cs - StringLocalizer.cs - ZeroDocStateAvailability.cs - - - diff --git a/src/RevitDev.StarterKit.sln b/src/RevitDev.StarterKit.sln new file mode 100644 index 0000000..b0f89a3 --- /dev/null +++ b/src/RevitDev.StarterKit.sln @@ -0,0 +1,79 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29020.237 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Project.ExternalApplication", "Templates\Project.ExternalApplication\Project.ExternalApplication.csproj", "{BCF8B7E6-0D97-4AE1-AB3B-26AAF60732A0}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Templates", "Templates", "{40F08C22-7760-4E44-8613-8B9143A275C7}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Project.ExternalCommand", "Templates\Project.ExternalCommand\Project.ExternalCommand.csproj", "{5F774587-1A80-44BD-BA2E-820CF974DFB2}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Item.ExternalCommand", "Templates\Item.ExternalCommand\Item.ExternalCommand.csproj", "{79EE33AD-B194-4312-B66C-140CE02B6A16}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Item.ExternalApplication", "Templates\Item.ExternalApplication\Item.ExternalApplication.csproj", "{67104F22-AAFD-4FC3-BA69-BF7C8D8A25CD}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RevitDev.StarterKit", "RevitDev.StarterKit\RevitDev.StarterKit.csproj", "{DAB19057-139F-46FD-A291-C15B44AC244C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {BCF8B7E6-0D97-4AE1-AB3B-26AAF60732A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BCF8B7E6-0D97-4AE1-AB3B-26AAF60732A0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BCF8B7E6-0D97-4AE1-AB3B-26AAF60732A0}.Debug|x64.ActiveCfg = Debug|Any CPU + {BCF8B7E6-0D97-4AE1-AB3B-26AAF60732A0}.Debug|x64.Build.0 = Debug|Any CPU + {BCF8B7E6-0D97-4AE1-AB3B-26AAF60732A0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BCF8B7E6-0D97-4AE1-AB3B-26AAF60732A0}.Release|Any CPU.Build.0 = Release|Any CPU + {BCF8B7E6-0D97-4AE1-AB3B-26AAF60732A0}.Release|x64.ActiveCfg = Release|Any CPU + {BCF8B7E6-0D97-4AE1-AB3B-26AAF60732A0}.Release|x64.Build.0 = Release|Any CPU + {5F774587-1A80-44BD-BA2E-820CF974DFB2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5F774587-1A80-44BD-BA2E-820CF974DFB2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5F774587-1A80-44BD-BA2E-820CF974DFB2}.Debug|x64.ActiveCfg = Debug|Any CPU + {5F774587-1A80-44BD-BA2E-820CF974DFB2}.Debug|x64.Build.0 = Debug|Any CPU + {5F774587-1A80-44BD-BA2E-820CF974DFB2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5F774587-1A80-44BD-BA2E-820CF974DFB2}.Release|Any CPU.Build.0 = Release|Any CPU + {5F774587-1A80-44BD-BA2E-820CF974DFB2}.Release|x64.ActiveCfg = Release|Any CPU + {5F774587-1A80-44BD-BA2E-820CF974DFB2}.Release|x64.Build.0 = Release|Any CPU + {79EE33AD-B194-4312-B66C-140CE02B6A16}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {79EE33AD-B194-4312-B66C-140CE02B6A16}.Debug|Any CPU.Build.0 = Debug|Any CPU + {79EE33AD-B194-4312-B66C-140CE02B6A16}.Debug|x64.ActiveCfg = Debug|Any CPU + {79EE33AD-B194-4312-B66C-140CE02B6A16}.Debug|x64.Build.0 = Debug|Any CPU + {79EE33AD-B194-4312-B66C-140CE02B6A16}.Release|Any CPU.ActiveCfg = Release|Any CPU + {79EE33AD-B194-4312-B66C-140CE02B6A16}.Release|Any CPU.Build.0 = Release|Any CPU + {79EE33AD-B194-4312-B66C-140CE02B6A16}.Release|x64.ActiveCfg = Release|Any CPU + {79EE33AD-B194-4312-B66C-140CE02B6A16}.Release|x64.Build.0 = Release|Any CPU + {67104F22-AAFD-4FC3-BA69-BF7C8D8A25CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {67104F22-AAFD-4FC3-BA69-BF7C8D8A25CD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {67104F22-AAFD-4FC3-BA69-BF7C8D8A25CD}.Debug|x64.ActiveCfg = Debug|Any CPU + {67104F22-AAFD-4FC3-BA69-BF7C8D8A25CD}.Debug|x64.Build.0 = Debug|Any CPU + {67104F22-AAFD-4FC3-BA69-BF7C8D8A25CD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {67104F22-AAFD-4FC3-BA69-BF7C8D8A25CD}.Release|Any CPU.Build.0 = Release|Any CPU + {67104F22-AAFD-4FC3-BA69-BF7C8D8A25CD}.Release|x64.ActiveCfg = Release|Any CPU + {67104F22-AAFD-4FC3-BA69-BF7C8D8A25CD}.Release|x64.Build.0 = Release|Any CPU + {DAB19057-139F-46FD-A291-C15B44AC244C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DAB19057-139F-46FD-A291-C15B44AC244C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DAB19057-139F-46FD-A291-C15B44AC244C}.Debug|x64.ActiveCfg = Debug|Any CPU + {DAB19057-139F-46FD-A291-C15B44AC244C}.Debug|x64.Build.0 = Debug|Any CPU + {DAB19057-139F-46FD-A291-C15B44AC244C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DAB19057-139F-46FD-A291-C15B44AC244C}.Release|Any CPU.Build.0 = Release|Any CPU + {DAB19057-139F-46FD-A291-C15B44AC244C}.Release|x64.ActiveCfg = Release|Any CPU + {DAB19057-139F-46FD-A291-C15B44AC244C}.Release|x64.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {BCF8B7E6-0D97-4AE1-AB3B-26AAF60732A0} = {40F08C22-7760-4E44-8613-8B9143A275C7} + {5F774587-1A80-44BD-BA2E-820CF974DFB2} = {40F08C22-7760-4E44-8613-8B9143A275C7} + {79EE33AD-B194-4312-B66C-140CE02B6A16} = {40F08C22-7760-4E44-8613-8B9143A275C7} + {67104F22-AAFD-4FC3-BA69-BF7C8D8A25CD} = {40F08C22-7760-4E44-8613-8B9143A275C7} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {D60539CD-A62A-4D5F-B286-9314AB6F5B31} + EndGlobalSection +EndGlobal diff --git a/src/RevitDev.StarterKit/Properties/AssemblyInfo.cs b/src/RevitDev.StarterKit/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..607a5ed --- /dev/null +++ b/src/RevitDev.StarterKit/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +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("RevitDev.Extension")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("RevitDev.Extension")] +[assembly: AssemblyCopyright("")] +[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)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/RevitDev.StarterKit/RevitDev.StarterKit.csproj b/src/RevitDev.StarterKit/RevitDev.StarterKit.csproj new file mode 100644 index 0000000..20e8e21 --- /dev/null +++ b/src/RevitDev.StarterKit/RevitDev.StarterKit.csproj @@ -0,0 +1,101 @@ + + + + 16.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + Debug + AnyCPU + 2.0 + {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {DAB19057-139F-46FD-A291-C15B44AC244C} + Library + Properties + RevitDev.StarterKit + RevitDev.StarterKit + v4.7.2 + false + false + false + false + false + false + Program + $(DevEnvDir)devenv.exe + /rootsuffix Exp + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + Designer + + + + + + + + + {67104F22-AAFD-4FC3-BA69-BF7C8D8A25CD} + Item.ExternalApplication + ItemTemplates + false + TemplateProjectOutputGroup%3b + + + {79EE33AD-B194-4312-B66C-140CE02B6A16} + Item.ExternalCommand + ItemTemplates + false + TemplateProjectOutputGroup%3b + + + {BCF8B7E6-0D97-4AE1-AB3B-26AAF60732A0} + Project.ExternalApplication + ProjectTemplates + false + TemplateProjectOutputGroup%3b + + + {5F774587-1A80-44BD-BA2E-820CF974DFB2} + Project.ExternalCommand + ProjectTemplates + false + TemplateProjectOutputGroup%3b + + + + + + + + + + + + \ No newline at end of file diff --git a/src/RevitDev.StarterKit/source.extension.vsixmanifest b/src/RevitDev.StarterKit/source.extension.vsixmanifest new file mode 100644 index 0000000..85d1999 --- /dev/null +++ b/src/RevitDev.StarterKit/source.extension.vsixmanifest @@ -0,0 +1,24 @@ + + + + + RevitDev StarterKit + A set of ready-to-use templates to kick-off the development of an add-in for Autodesk Revit. + revit, revit api, templates + + + + + + + + + + + + + + + + + diff --git a/src/StringLocalizer.cs b/src/StringLocalizer.cs deleted file mode 100644 index e7f3f6e..0000000 --- a/src/StringLocalizer.cs +++ /dev/null @@ -1,97 +0,0 @@ -using System; -using System.Diagnostics; -using System.Linq; -using System.Reflection; -using System.Resources; - -namespace RevitAddin -{ - /// - /// In absence of and - /// on .NET Framework < 4.6.1 this class provides an easy access to localized resources - /// - /// - /// - public class StringLocalizer : IDisposable - { - public static StringLocalizer ExecutingAssembly { get; } - - public static StringLocalizer CallingAssembly { get; } - - static StringLocalizer() - { - var execAssembly = Assembly.GetExecutingAssembly(); - ExecutingAssembly = new StringLocalizer(execAssembly); - - var callAssembly = Assembly.GetExecutingAssembly(); - CallingAssembly = Equals(execAssembly, callAssembly) - ? ExecutingAssembly - : new StringLocalizer(callAssembly); - } - - protected ResourceManager resourceManager; - - /// - /// Initializes a new instance of the class. - /// - /// The assembly containing localized string resources. - /// The resource location, defaults to 'Properties.Resources'. - public StringLocalizer(Assembly assembly = null, string resourceLocation = "Properties.Resources") - { - var callingAssembly = assembly ?? - new StackTrace().GetFrame(1).GetMethod()?.ReflectedType?.Assembly ?? - Assembly.GetEntryAssembly(); - var rootNameSpace = callingAssembly.ManifestModule.GetTypes().Min(t => t.Namespace); - resourceManager = new ResourceManager($"{rootNameSpace}.{resourceLocation}", callingAssembly); - } - - /// - /// Finalizes an instance of the class. - /// - ~StringLocalizer() - { - ReleaseUnmanagedResources(); - } - - /// - /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. - /// - /// - public void Dispose() - { - ReleaseUnmanagedResources(); - GC.SuppressFinalize(this); - } - - /// - /// Releases the unmanaged resources. - /// - private void ReleaseUnmanagedResources() - { - resourceManager?.ReleaseAllResources(); - } - - /// - /// Gets the with the specified string. - /// - /// - /// The . - /// - /// The string. - /// - public string this[string str] - { - get - { - try - { - return resourceManager.GetString(str) ?? str; - } - catch - { - return str; - } - } - } - } -} diff --git a/src/Templates/Item.ExternalApplication/ExternalApplication.cs b/src/Templates/Item.ExternalApplication/ExternalApplication.cs new file mode 100644 index 0000000..7a32cd2 --- /dev/null +++ b/src/Templates/Item.ExternalApplication/ExternalApplication.cs @@ -0,0 +1,234 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +$if$ ($targetframeworkversion$ >= 3.5)using System.Linq; +$endif$using System.Text; +using Autodesk.Revit.Attributes; +using Autodesk.Revit.DB; +using Autodesk.Revit.DB.Events; +using Autodesk.Revit.UI; +using Autodesk.Revit.UI.Events; + +namespace $rootnamespace$ +{ + /// + /// The main application defined in this add-in + /// + /// + [Transaction(TransactionMode.Manual)] + [Regeneration(RegenerationOption.Manual)] + public class $safeitemrootname$ : IExternalApplication + { + protected UIControlledApplication uiControlledApplication; + + /// + /// Called when [startup]. + /// + /// The UI control application. + /// + /// ReSharper disable once ParameterHidesMember + public Result OnStartup(UIControlledApplication uiControlledApplication) + { + this.uiControlledApplication = uiControlledApplication; + + try + { + // Idling and initialization + uiControlledApplication.Idling += OnIdling; + uiControlledApplication.ControlledApplication.ApplicationInitialized += OnApplicationInitialized; + // Open / change + uiControlledApplication.ControlledApplication.DocumentOpened += OnDocumentOpened; + uiControlledApplication.ControlledApplication.DocumentChanged += OnDocumentChanged; + // Save / SaveAs + uiControlledApplication.ControlledApplication.DocumentSaved += OnDocumentSaved; + uiControlledApplication.ControlledApplication.DocumentSavedAs += OnDocumentSavedAs; + // Progress & Failure + uiControlledApplication.ControlledApplication.ProgressChanged += OnProgressChanged; + uiControlledApplication.ControlledApplication.FailuresProcessing += OnFailuresProcessing; + // Closing + uiControlledApplication.ControlledApplication.DocumentClosing += OnDocumentClosing; + uiControlledApplication.ControlledApplication.DocumentClosed += OnDocumentClosed; + // Views + uiControlledApplication.ViewActivated += OnViewActivated; + + // TODO: add you code here + } + catch (Exception ex) + { + TaskDialog.Show($"Error in {nameof(OnStartup)} method", ex.ToString()); + return Result.Failed; + } + + return Result.Succeeded; + } + + /// + /// Called when [shutdown]. + /// + /// The application. + /// + public Result OnShutdown(UIControlledApplication uiCtrlApp) + { + try + { + // Idling and initialization + uiControlledApplication.Idling -= OnIdling; + uiControlledApplication.ControlledApplication.ApplicationInitialized -= OnApplicationInitialized; + // Open / change + uiControlledApplication.ControlledApplication.DocumentOpened -= OnDocumentOpened; + uiControlledApplication.ControlledApplication.DocumentChanged -= OnDocumentChanged; + // Save / SaveAs + uiControlledApplication.ControlledApplication.DocumentSaved -= OnDocumentSaved; + uiControlledApplication.ControlledApplication.DocumentSavedAs -= OnDocumentSavedAs; + // Progress & Failure + uiControlledApplication.ControlledApplication.ProgressChanged -= OnProgressChanged; + uiControlledApplication.ControlledApplication.FailuresProcessing -= OnFailuresProcessing; + // Closing + uiControlledApplication.ControlledApplication.DocumentClosing -= OnDocumentClosing; + uiControlledApplication.ControlledApplication.DocumentClosed -= OnDocumentClosed; + // Views + uiControlledApplication.ViewActivated -= OnViewActivated; + + // TODO: add you code here + } + catch (Exception ex) + { + TaskDialog.Show($"Error in {nameof(OnShutdown)} method", ex.ToString()); + return Result.Failed; + } + + return Result.Succeeded; + } + + /// + /// Called when [idling]. + /// This event is raised only when the Revit UI is in a state + /// when there is no active document. + /// + /// The sender. + /// The instance containing the event data. + private void OnIdling(object sender, IdlingEventArgs args) + { + // TODO: add you code here + } + + /// + /// Called when [application initialized]. + /// + /// The sender. + /// The instance containing the event data. + private void OnApplicationInitialized(object sender, ApplicationInitializedEventArgs args) + { + // TODO: add you code here + } + + /// + /// Called when [document opened]. + /// + /// The sender. + /// The instance containing the event data. + private void OnDocumentOpened(object sender, DocumentOpenedEventArgs args) + { + // TODO: this is just an example, remove or change code below + var doc = args.Document; + Debug.Assert(null != doc, $"Expected a valid Revit {nameof(Document)} instance"); + + // TODO: this is just an example, remove or change code below + var app = args.Document?.Application; + var uiapp = new UIApplication(app); + Debug.Assert(null != uiapp, $"Expected a valid Revit {nameof(UIApplication)} instance"); + } + + /// + /// Called when [document changed]. + /// + /// The sender. + /// The instance containing the event data. + /// + /// ReSharper disable once MemberCanBeMadeStatic.Local + private void OnDocumentChanged(object sender, DocumentChangedEventArgs e) + { + // TODO: add you code here + } + + /// + /// Called when [document saved]. + /// + /// The sender. + /// The instance containing the event data. + /// ReSharper disable once MemberCanBeMadeStatic.Local + private void OnDocumentSaved(object sender, DocumentSavedEventArgs args) + { + // TODO: add you code here + } + + /// + /// Called when [document saved as]. + /// + /// The sender. + /// The instance containing the event data. + /// ReSharper disable once MemberCanBeMadeStatic.Local + private void OnDocumentSavedAs(object sender, DocumentSavedAsEventArgs args) + { + // TODO: add you code here + } + + /// + /// Called when [failures processing]. + /// + /// The sender. + /// The instance containing the event data. + /// + /// ReSharper disable once MemberCanBeMadeStatic.Local + private void OnFailuresProcessing(object sender, FailuresProcessingEventArgs e) + { + // TODO: add you code here + } + + /// + /// Called when [progress changed]. + /// + /// The sender. + /// The instance containing the event data. + /// + /// ReSharper disable once MemberCanBeMadeStatic.Local + private void OnProgressChanged(object sender, ProgressChangedEventArgs progressChangedEventArgs) + { + // TODO: add you code here + } + + /// + /// Called when [document closing]. + /// + /// The sender. + /// The instance containing the event data. + /// ReSharper disable once MemberCanBeMadeStatic.Local + private void OnDocumentClosing(object sender, DocumentClosingEventArgs args) + { + // TODO: add you code here + } + + /// + /// Called when [document closed]. + /// + /// The sender. + /// The instance containing the event data. + /// ReSharper disable once MemberCanBeMadeStatic.Local + private void OnDocumentClosed(object sender, DocumentClosedEventArgs args) + { + // TODO: add you code here + } + + /// + /// Called when [view activated]. + /// + /// The sender. + /// The instance containing the event data. + /// + private void OnViewActivated(object sender, ViewActivatedEventArgs e) + { + // TODO: add you code here + } + } + } +} diff --git a/src/Templates/Item.ExternalApplication/Item.ExternalApplication.csproj b/src/Templates/Item.ExternalApplication/Item.ExternalApplication.csproj new file mode 100644 index 0000000..c3affc8 --- /dev/null +++ b/src/Templates/Item.ExternalApplication/Item.ExternalApplication.csproj @@ -0,0 +1,77 @@ + + + + 16.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + Debug + AnyCPU + {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {67104F22-AAFD-4FC3-BA69-BF7C8D8A25CD} + Library + Properties + Item.ExternalApplication + Item.ExternalApplication + v4.7.2 + 512 + false + false + false + false + false + false + false + false + false + false + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/__TemplateIcon.ico b/src/Templates/Item.ExternalApplication/Item.ExternalApplication.ico similarity index 100% rename from src/__TemplateIcon.ico rename to src/Templates/Item.ExternalApplication/Item.ExternalApplication.ico diff --git a/src/Templates/Item.ExternalApplication/Item.ExternalApplication.vstemplate b/src/Templates/Item.ExternalApplication/Item.ExternalApplication.vstemplate new file mode 100644 index 0000000..512b964 --- /dev/null +++ b/src/Templates/Item.ExternalApplication/Item.ExternalApplication.vstemplate @@ -0,0 +1,21 @@ + + + + RevitDev - ExternalApplication File + Template for a Revit 2014-2020 C# .NET, ExternalApplication File + Item.ExternalApplication.ico + 0259defa-5bdc-4ca2-a856-797a91031c5c + CSharp + 2.0 + 1 + ExternalApplication.cs + + + + + System + + + ExternalApplication.cs + + \ No newline at end of file diff --git a/src/Templates/Item.ExternalApplication/Properties/AssemblyInfo.cs b/src/Templates/Item.ExternalApplication/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..65514bc --- /dev/null +++ b/src/Templates/Item.ExternalApplication/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +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("Item.ExternalApplication")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("HP Inc.")] +[assembly: AssemblyProduct("Item.ExternalApplication")] +[assembly: AssemblyCopyright("Copyright © HP Inc. 2019")] +[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("67104f22-aafd-4fc3-ba69-bf7c8d8a25cd")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/Templates/Item.ExternalCommand/ExternalCommand.cs b/src/Templates/Item.ExternalCommand/ExternalCommand.cs new file mode 100644 index 0000000..95b9756 --- /dev/null +++ b/src/Templates/Item.ExternalCommand/ExternalCommand.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +$if$ ($targetframeworkversion$ >= 3.5)using System.Linq; +$endif$using System.Text; +using Autodesk.Revit.Attributes; +using Autodesk.Revit.DB; +using Autodesk.Revit.UI; + +namespace $rootnamespace$ +{ + /// + /// A sample command. + /// + /// + [Transaction(TransactionMode.Manual)] + [Regeneration(RegenerationOption.Manual)] + public class $safeitemrootname$ : IExternalCommand + { + /// + /// Executes the specified Revit command . + /// The main Execute method (inherited from IExternalCommand) must be public. + /// + /// The command data / context. + /// The message. + /// The elements. + /// The result of command execution. + public Result Execute( + ExternalCommandData commandData, + ref string message, + ElementSet elements + ) + { + TaskDialog.Show("It's alive!", "Hello World!"); + return Result.Succeeded; + } + } +} diff --git a/src/Templates/Item.ExternalCommand/Item.ExternalCommand.csproj b/src/Templates/Item.ExternalCommand/Item.ExternalCommand.csproj new file mode 100644 index 0000000..d6c732a --- /dev/null +++ b/src/Templates/Item.ExternalCommand/Item.ExternalCommand.csproj @@ -0,0 +1,77 @@ + + + + 16.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + Debug + AnyCPU + {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {79EE33AD-B194-4312-B66C-140CE02B6A16} + Library + Properties + Item.ExternalCommand + Item.ExternalCommand + v4.7.2 + 512 + false + false + false + false + false + false + false + false + false + false + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Templates/Item.ExternalCommand/Item.ExternalCommand.ico b/src/Templates/Item.ExternalCommand/Item.ExternalCommand.ico new file mode 100644 index 0000000..b48fbe8 Binary files /dev/null and b/src/Templates/Item.ExternalCommand/Item.ExternalCommand.ico differ diff --git a/src/Templates/Item.ExternalCommand/Item.ExternalCommand.vstemplate b/src/Templates/Item.ExternalCommand/Item.ExternalCommand.vstemplate new file mode 100644 index 0000000..78f7a6b --- /dev/null +++ b/src/Templates/Item.ExternalCommand/Item.ExternalCommand.vstemplate @@ -0,0 +1,21 @@ + + + + RevitDev - ExternalCommand File + Template for a Revit 2014-2020 C# .NET, ExternalCommand File + Item.ExternalCommand.ico + af513790-f22a-448d-b436-5595ef294ca8 + CSharp + 2.0 + 1 + ExternalCommand.cs + + + + + System + + + ExternalCommand.cs + + \ No newline at end of file diff --git a/src/Templates/Item.ExternalCommand/Properties/AssemblyInfo.cs b/src/Templates/Item.ExternalCommand/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..59a9d4f --- /dev/null +++ b/src/Templates/Item.ExternalCommand/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +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("Item.ExternalCommand")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("HP Inc.")] +[assembly: AssemblyProduct("Item.ExternalCommand")] +[assembly: AssemblyCopyright("Copyright © HP Inc. 2019")] +[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("79ee33ad-b194-4312-b66c-140ce02b6a16")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/RevitAddin.csproj b/src/Templates/Project.ExternalApplication/ExternalApplication.csproj similarity index 89% rename from src/RevitAddin.csproj rename to src/Templates/Project.ExternalApplication/ExternalApplication.csproj index f4be848..865e22e 100644 --- a/src/RevitAddin.csproj +++ b/src/Templates/Project.ExternalApplication/ExternalApplication.csproj @@ -1,4 +1,4 @@ - + Debug;Debug One;Release @@ -114,20 +114,10 @@ - + Never - - - - - - - - - Never @@ -138,23 +128,21 @@ - - - - - + + + - RevitAddin - RevitAddin + $safeprojectname$ + $safeprojectname$ - Your name - sample.vendor.id.change.it + $username$ + $guid5$ Acme Ltd http://example.com/test - The description for your application goes here + $projectname$ 0.0.1 en @@ -163,7 +151,7 @@ - + diff --git a/src/App.cs b/src/Templates/Project.ExternalApplication/Files/App.cs similarity index 82% rename from src/App.cs rename to src/Templates/Project.ExternalApplication/Files/App.cs index 426fd1b..2eebd48 100644 --- a/src/App.cs +++ b/src/Templates/Project.ExternalApplication/Files/App.cs @@ -9,6 +9,9 @@ using Autodesk.Revit.UI; using Autodesk.Revit.UI.Events; +using $safeprojectname$.Commands; +using $safeprojectname$.Utils; + #if REVIT2017 using System.Globalization; using System.Linq; @@ -17,7 +20,7 @@ #endregion -namespace RevitAddin +namespace $safeprojectname$ { /// /// The main application defined in this add-in @@ -34,19 +37,21 @@ public class App : IExternalApplication /// static App() { + // Below code is commented as can prevent your add-in from being loaded. + // If implementing any WinForms and no behaving properly, please uncomment. #if WINFORMS - global::System.Windows.Forms.Application.EnableVisualStyles(); - global::System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false); + //global::System.Windows.Forms.Application.EnableVisualStyles(); + //global::System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false); #endif - } + } - /// - /// Called when [startup]. - /// - /// The UI control application. - /// - /// ReSharper disable once ParameterHidesMember - public Result OnStartup(UIControlledApplication uiControlledApplication) + /// + /// Called when [startup]. + /// + /// The UI control application. + /// + /// ReSharper disable once ParameterHidesMember + public Result OnStartup(UIControlledApplication uiControlledApplication) { this.uiControlledApplication = uiControlledApplication; @@ -135,28 +140,19 @@ private void InitializeRibbon() // TODO declare your ribbon items here var ribbonItems = new List { - new RibbonHelper.RibbonButton // One can reference commands defined in other assemblies - { - // You could make your ribbon buttons active with no documenent open/active - // Try to create your own class with complex rules on when the given button is active and when it's not - AvailabilityClassName = typeof(ZeroDocStateAvailability).FullName, - Text = StringLocalizer.CallingAssembly["Always active"], // Text displayed on the command, can be stored in the resources - Tooltip = StringLocalizer.CallingAssembly["I'm always active"], // Tooltip and long description - IconName = "Resources.trollFace.png", // Path to the image, it's relative to the assembly where the command above is defined - }, - new RibbonHelper.RibbonButton // One can reference commands defined in other assemblies + new RibbonHelper.RibbonButton // One can reference commands defined in other assemblies { - Text = StringLocalizer.CallingAssembly["Text 1"], // Text displayed on the command, can be stored in the resources - Tooltip = StringLocalizer.CallingAssembly["My test tooltip"], // Tooltip and long description - IconName = "Resources.testCommand.png", // Path to the image, it's relative to the assembly where the command above is defined + Text = "Hello World!", // Text displayed on the command, can be stored in the resources + Tooltip = "My test tooltip", // Tooltip and long description + IconName = "Resources.testCommand.png", // Path to the image, it's relative to the assembly where the command above is defined } }; RibbonHelper.AddButtons( uiControlledApplication, ribbonItems, - ribbonPanelName: StringLocalizer.CallingAssembly["Test panel"], // The title of the ribbot panel - ribbonTabName: StringLocalizer.CallingAssembly["Test ribbon"] // The title of the ribbon tab + ribbonPanelName: "Test panel", // The title of the ribbot panel + ribbonTabName: "$safeprojectname$" // The title of the ribbon tab ); } @@ -167,7 +163,6 @@ private void InitializeRibbon() /// /// The sender. /// The instance containing the event data. - /// ReSharper disable once MemberCanBeMadeStatic.Local private void OnIdling(object sender, IdlingEventArgs args) { // TODO: add you code here @@ -178,7 +173,6 @@ private void OnIdling(object sender, IdlingEventArgs args) /// /// The sender. /// The instance containing the event data. - /// ReSharper disable once MemberCanBeMadeStatic.Local private void OnApplicationInitialized(object sender, ApplicationInitializedEventArgs args) { // TODO: add you code here diff --git a/src/ExternalCommand.cs b/src/Templates/Project.ExternalApplication/Files/Commands/ExternalCommand.cs similarity index 94% rename from src/ExternalCommand.cs rename to src/Templates/Project.ExternalApplication/Files/Commands/ExternalCommand.cs index 05f5aef..9503094 100644 --- a/src/ExternalCommand.cs +++ b/src/Templates/Project.ExternalApplication/Files/Commands/ExternalCommand.cs @@ -9,7 +9,7 @@ #endregion -namespace RevitAddin +namespace $safeprojectname$.Commands { /// /// A simple example of an external command, usually it's used for batch processing @@ -41,7 +41,7 @@ ElementSet elements if (null == app || null == doc) { // TODO it's just an example, an external command can open a document if needed - MessageBox.Show(StringLocalizer.CallingAssembly["This command can be called only when a document is opened and ready!"]); + MessageBox.Show("This command can be called only when a document is opened and ready!"); return Result.Cancelled; } diff --git a/src/RibbonCommand.cs b/src/Templates/Project.ExternalApplication/Files/Commands/HelloWorldCommand.cs similarity index 84% rename from src/RibbonCommand.cs rename to src/Templates/Project.ExternalApplication/Files/Commands/HelloWorldCommand.cs index bc8b5b8..c93e940 100644 --- a/src/RibbonCommand.cs +++ b/src/Templates/Project.ExternalApplication/Files/Commands/HelloWorldCommand.cs @@ -2,7 +2,7 @@ using Autodesk.Revit.DB; using Autodesk.Revit.UI; -namespace RevitAddin +namespace $safeprojectname$.Commands { /// /// A sample ribbon command, demonstrates the possibility to bind Revit commands to ribbon buttons @@ -10,7 +10,7 @@ namespace RevitAddin /// [Transaction(TransactionMode.Manual)] [Regeneration(RegenerationOption.Manual)] - public class RibbonCommand : IExternalCommand + public class HelloWorldCommand : IExternalCommand { /// /// Executes the specified Revit command . @@ -25,7 +25,7 @@ public Result Execute( ref string message, ElementSet elements ){ - TaskDialog.Show("It's alive!", StringLocalizer.CallingAssembly["Localization: test string with spaces"]); + TaskDialog.Show("It's alive!", "Hello World!"); return Result.Succeeded; } } diff --git a/src/RibbonHelper.cs b/src/Templates/Project.ExternalApplication/Files/Utils/RibbonHelper.cs similarity index 99% rename from src/RibbonHelper.cs rename to src/Templates/Project.ExternalApplication/Files/Utils/RibbonHelper.cs index 222b525..d746fd5 100644 --- a/src/RibbonHelper.cs +++ b/src/Templates/Project.ExternalApplication/Files/Utils/RibbonHelper.cs @@ -8,7 +8,7 @@ using System.Windows.Media.Imaging; using Autodesk.Revit.UI; -namespace RevitAddin +namespace $safeprojectname$.Utils { /// /// A set of helpers for Revit Ribbon @@ -30,7 +30,7 @@ public static void AddButtons( ) { ribbonPanelName = string.IsNullOrWhiteSpace(ribbonPanelName) - ? nameof(RevitAddin) + ? nameof($safeprojectname$) : ribbonPanelName; RibbonPanel ribbonPanel = null; diff --git a/src/AddinManifest.addin b/src/Templates/Project.ExternalApplication/Manifests/AddinTemplate.addin similarity index 85% rename from src/AddinManifest.addin rename to src/Templates/Project.ExternalApplication/Manifests/AddinTemplate.addin index 5c87043..e792b8a 100644 --- a/src/AddinManifest.addin +++ b/src/Templates/Project.ExternalApplication/Manifests/AddinTemplate.addin @@ -2,20 +2,20 @@ - RevitAddin.App + $safeprojectname$.App 00000000-0000-0000-0000-000000000001 == Edit in project's properties == - RevitAddin.dll + $safeprojectname$.dll == Edit in project's properties == == Edit (company + authors + website) in project's properties == - RevitAddin.ExternalCommand + $safeprojectname$.ExternalCommand 00000000-0000-0000-0000-000000000002 Your external command The description for your command goes here - RevitAddin.dll + $safeprojectname$.dll == Edit in project's properties == == Edit (company + authors + website) in project's properties == @@ -26,7 +26,6 @@ NotVisibleInFamily NotVisibleInStructure NotVisibleWhenNoActiveDocument - RevitAddin.SampleAccessibilityCheck --> + \ No newline at end of file diff --git a/src/Templates/Project.ExternalApplication/Project.ExternalApplication.ico b/src/Templates/Project.ExternalApplication/Project.ExternalApplication.ico new file mode 100644 index 0000000..b48fbe8 Binary files /dev/null and b/src/Templates/Project.ExternalApplication/Project.ExternalApplication.ico differ diff --git a/src/Templates/Project.ExternalApplication/Project.ExternalApplication.vstemplate b/src/Templates/Project.ExternalApplication/Project.ExternalApplication.vstemplate new file mode 100644 index 0000000..5d12fb5 --- /dev/null +++ b/src/Templates/Project.ExternalApplication/Project.ExternalApplication.vstemplate @@ -0,0 +1,42 @@ + + + + RevitDev - ExternalApplication Project + Template for a Revit 2014-2020 C# .NET, ExternalApplication Project + CSharp + + + true + RevitDev.ExternalApplication + true + Enabled + true + true + Project.ExternalApplication.ico + + + + + AssemblyInfo.cs + launchSettings.json + + + testCommand.png + + + ExternalCommand.cs + HelloWorldCommand.cs + + + RibbonHelper.cs + + + App.cs + + + AddinTemplate.addin + + + + + diff --git a/src/Templates/Project.ExternalApplication/Properties/AssemblyInfo.cs b/src/Templates/Project.ExternalApplication/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..66b4098 --- /dev/null +++ b/src/Templates/Project.ExternalApplication/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +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("Project.ExternalApplication")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("HP Inc.")] +[assembly: AssemblyProduct("Project.ExternalApplication")] +[assembly: AssemblyCopyright("Copyright © HP Inc. 2019")] +[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("bcf8b7e6-0d97-4ae1-ab3b-26aaf60732a0")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/Resources/testCommand.png b/src/Templates/Project.ExternalApplication/Resources/testCommand.png similarity index 100% rename from src/Resources/testCommand.png rename to src/Templates/Project.ExternalApplication/Resources/testCommand.png diff --git a/src/Templates/Project.ExternalApplication/TemplateProperties/AssemblyInfo.cs b/src/Templates/Project.ExternalApplication/TemplateProperties/AssemblyInfo.cs new file mode 100644 index 0000000..a0edcb6 --- /dev/null +++ b/src/Templates/Project.ExternalApplication/TemplateProperties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +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("$projectname$")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("$registeredorganization$")] +[assembly: AssemblyProduct("$projectname$")] +[assembly: AssemblyCopyright("Copyright © $registeredorganization$ $year$")] +[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("$guid1$")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/Properties/launchSettings.json b/src/Templates/Project.ExternalApplication/TemplateProperties/launchSettings.json similarity index 100% rename from src/Properties/launchSettings.json rename to src/Templates/Project.ExternalApplication/TemplateProperties/launchSettings.json diff --git a/src/Templates/Project.ExternalCommand/ExternalCommand.csproj b/src/Templates/Project.ExternalCommand/ExternalCommand.csproj new file mode 100644 index 0000000..e990f62 --- /dev/null +++ b/src/Templates/Project.ExternalCommand/ExternalCommand.csproj @@ -0,0 +1,215 @@ + + + + Debug;Debug One;Release + + + + + net40;net45;net451;net452;net46;net47;net471 + win + + + + + net471 + + + + 2014 + + + 2015 + + + 2016 + + + 2017 + + + 2018 + + + 2019 + + + 2020 + + + + + x64 + x64 + None + + + {351668CC-8477-4fbf-BFE3-5F1006E4DB1F} + + + false + false + + + REVIT$(RevitVersion);WINFORMS + $(DefineConstants) + + + false + + + false + ..\bin\$(Configuration)\$(RevitVersion) + + + + $(DefineConstants);DEBUG + full + ..\bin\Debug\$(RevitVersion) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Never + + + + Never + + + + Never + + + + + + + + + $safeprojectname$ + $safeprojectname$ + + $username$ + $guid5$ + Acme Ltd + http://example.com/test + $projectname$ + 0.0.1 + en + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Templates/Project.ExternalCommand/Files/HelloWorldCommand.cs b/src/Templates/Project.ExternalCommand/Files/HelloWorldCommand.cs new file mode 100644 index 0000000..a63b480 --- /dev/null +++ b/src/Templates/Project.ExternalCommand/Files/HelloWorldCommand.cs @@ -0,0 +1,32 @@ +using Autodesk.Revit.Attributes; +using Autodesk.Revit.DB; +using Autodesk.Revit.UI; + +namespace $safeprojectname$ +{ + /// + /// A sample command. + /// + /// + [Transaction(TransactionMode.Manual)] + [Regeneration(RegenerationOption.Manual)] + public class HelloWorldCommand : IExternalCommand + { + /// + /// Executes the specified Revit command . + /// The main Execute method (inherited from IExternalCommand) must be public. + /// + /// The command data / context. + /// The message. + /// The elements. + /// The result of command execution. + public Result Execute( + ExternalCommandData commandData, + ref string message, + ElementSet elements + ){ + TaskDialog.Show("It's alive!", "Hello World!"); + return Result.Succeeded; + } + } +} diff --git a/src/Templates/Project.ExternalCommand/Manifests/AddinTemplate.addin b/src/Templates/Project.ExternalCommand/Manifests/AddinTemplate.addin new file mode 100644 index 0000000..60bf5bf --- /dev/null +++ b/src/Templates/Project.ExternalCommand/Manifests/AddinTemplate.addin @@ -0,0 +1,33 @@ + + + + $safeprojectname$.HelloWorldCommand + 00000000-0000-0000-0000-000000000002 + $safeprojectname$ - Hello World + The description for your command goes here + $safeprojectname$.dll + == Edit in project's properties == + == Edit (company + authors + website) in project's properties == + + AlwaysVisible + + + + + + + + diff --git a/src/Templates/Project.ExternalCommand/Project.ExternalCommand.csproj b/src/Templates/Project.ExternalCommand/Project.ExternalCommand.csproj new file mode 100644 index 0000000..356d234 --- /dev/null +++ b/src/Templates/Project.ExternalCommand/Project.ExternalCommand.csproj @@ -0,0 +1,77 @@ + + + + 16.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + Debug + AnyCPU + {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {5F774587-1A80-44BD-BA2E-820CF974DFB2} + Library + Properties + Project.ExternalCommand + Project.ExternalCommand + v4.7.2 + 512 + false + false + false + false + false + false + false + false + false + false + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Templates/Project.ExternalCommand/Project.ExternalCommand.ico b/src/Templates/Project.ExternalCommand/Project.ExternalCommand.ico new file mode 100644 index 0000000..b48fbe8 Binary files /dev/null and b/src/Templates/Project.ExternalCommand/Project.ExternalCommand.ico differ diff --git a/src/Templates/Project.ExternalCommand/Project.ExternalCommand.vstemplate b/src/Templates/Project.ExternalCommand/Project.ExternalCommand.vstemplate new file mode 100644 index 0000000..9a48c66 --- /dev/null +++ b/src/Templates/Project.ExternalCommand/Project.ExternalCommand.vstemplate @@ -0,0 +1,32 @@ + + + + RevitDev - ExternalCommand Project + Template for a Revit 2014-2020 C# .NET, ExternalCommand Project + CSharp + + + true + RevitDev.ExternalCommand + true + Enabled + true + true + Project.ExternalCommand.ico + + + + + AssemblyInfo.cs + launchSettings.json + + + AddinTemplate.addin + + + HelloWorldCommand.cs + + + + + diff --git a/src/Templates/Project.ExternalCommand/Properties/AssemblyInfo.cs b/src/Templates/Project.ExternalCommand/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..3583521 --- /dev/null +++ b/src/Templates/Project.ExternalCommand/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +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("Project.ExternalCommand")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("HP Inc.")] +[assembly: AssemblyProduct("Project.ExternalCommand")] +[assembly: AssemblyCopyright("Copyright © HP Inc. 2019")] +[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("5f774587-1a80-44bd-ba2e-820cf974dfb2")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/Templates/Project.ExternalCommand/TemplateProperties/AssemblyInfo.cs b/src/Templates/Project.ExternalCommand/TemplateProperties/AssemblyInfo.cs new file mode 100644 index 0000000..a0edcb6 --- /dev/null +++ b/src/Templates/Project.ExternalCommand/TemplateProperties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +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("$projectname$")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("$registeredorganization$")] +[assembly: AssemblyProduct("$projectname$")] +[assembly: AssemblyCopyright("Copyright © $registeredorganization$ $year$")] +[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("$guid1$")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/Templates/Project.ExternalCommand/TemplateProperties/launchSettings.json b/src/Templates/Project.ExternalCommand/TemplateProperties/launchSettings.json new file mode 100644 index 0000000..5cab1f7 --- /dev/null +++ b/src/Templates/Project.ExternalCommand/TemplateProperties/launchSettings.json @@ -0,0 +1,46 @@ +{ + "profiles": { + "Revit 2020": { + "commandName": "Executable", + "executablePath": "%ProgramW6432%\\Autodesk\\Revit 2020\\Revit.exe", + "commandLineArgs": "", + "use64Bit": true + }, + "Revit 2019": { + "commandName": "Executable", + "executablePath": "%ProgramW6432%\\Autodesk\\Revit 2019\\Revit.exe", + "commandLineArgs": "", + "use64Bit": true + }, + "Revit 2018": { + "commandName": "Executable", + "executablePath": "%ProgramW6432%\\Autodesk\\Revit 2018\\Revit.exe", + "commandLineArgs": "", + "use64Bit": true + }, + "Revit 2017": { + "commandName": "Executable", + "executablePath": "%ProgramW6432%\\Autodesk\\Revit 2017\\Revit.exe", + "commandLineArgs": "", + "use64Bit": true + }, + "Revit 2016": { + "commandName": "Executable", + "executablePath": "%ProgramW6432%\\Autodesk\\Revit 2016\\Revit.exe", + "commandLineArgs": "", + "use64Bit": true + }, + "Revit 2015": { + "commandName": "Executable", + "executablePath": "%ProgramW6432%\\Autodesk\\Revit 2015\\Revit.exe", + "commandLineArgs": "", + "use64Bit": true + }, + "Revit 2014": { + "commandName": "Executable", + "executablePath": "%ProgramW6432%\\Autodesk\\Revit 2014\\Revit.exe", + "commandLineArgs": "", + "use64Bit": true + } + } +} \ No newline at end of file diff --git a/src/ZeroDocStateAvailability.cs b/src/ZeroDocStateAvailability.cs deleted file mode 100644 index 1e5693f..0000000 --- a/src/ZeroDocStateAvailability.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Autodesk.Revit.DB; -using Autodesk.Revit.UI; - -namespace RevitAddin -{ - public class ZeroDocStateAvailability : IExternalCommandAvailability - { - public bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories) - { - return true; - } - } -}