added Revit 2022 SDK minus except *rvt and *rfa

This commit is contained in:
Jeremy Tammik
2021-04-20 11:36:21 +02:00
parent 1133a82dc5
commit 7e327986e8
3034 changed files with 1245318 additions and 0 deletions
@@ -0,0 +1,77 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autodesk.Revit.UI;
using System.Reflection;
using System.IO;
using System.Windows.Media.Imaging;
namespace ExtensionRevitLauncher
{
/// <summary>
/// Implements the Revit add-in interface IExternalApplication. This class provides a simple
/// system to launch Extension modules from Revit. It adds the RibbonItem which is used to start
/// modules. The list of modules attached to the application is configured in extensions.xml file.
/// </summary>
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
[Autodesk.Revit.Attributes.Journaling(Autodesk.Revit.Attributes.JournalingMode.NoCommandData)]
public class ExtensionApp : IExternalApplication
{
/// <summary>
/// The file which contains all modules to be launched. It should be in the same directory as the current assembly.
/// </summary>
static string ExtensionsFile = "extensions.xml";
/// <summary>
/// The default image of all extensions.
/// </summary>
static string ExtensionsImage = "extension.png";
#region IExternalApplication Members
/// <summary>
/// Implement this method to execute some tasks when Autodesk Revit shuts down.
/// </summary>
/// <param name="application">A handle to the application being shut down.</param>
/// <returns>
/// Indicates if the external application completes its work successfully.
/// </returns>
public Result OnShutdown(UIControlledApplication application)
{
return Result.Succeeded;
}
/// <summary>
/// Implement this method to execute some tasks when Autodesk Revit starts.
/// </summary>
/// <param name="application">A handle to the application being started.</param>
/// <returns>
/// Indicates if the external application completes its work successfully.
/// </returns>
public Result OnStartup(UIControlledApplication application)
{
string dir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string path = Path.Combine(dir,ExtensionsFile);
List<ExtensionModuleData> modules = ExtensionXMLReader.ReadFile(path);
RibbonPanel ribbonSamplePanel = application.CreateRibbonPanel("Extension SDK");
SplitButtonData splitButtonData = new SplitButtonData("ExtensionSDK", "SDK");
SplitButton splitButton = ribbonSamplePanel.AddItem(splitButtonData) as SplitButton;
string imgPath = Path.Combine(dir, ExtensionsImage);
foreach (ExtensionModuleData module in modules)
{
if (System.IO.File.Exists(module.Path))
{
PushButton pushButton = splitButton.AddPushButton(new PushButtonData(module.Name, module.Description, module.Path, module.Namespace + ".DirectRevitAccess"));
string imgModulePath = (File.Exists(module.Img)) ? module.Img : imgPath;
pushButton.LargeImage = new BitmapImage(new Uri(imgModulePath));
}
}
return Result.Succeeded;
}
#endregion
}
}
@@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ExtensionRevitLauncher
{
/// <summary>
/// The class represents properties of the particular module.
/// </summary>
class ExtensionModuleData
{
/// <summary>
/// Gets or sets the name of the module.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
/// <summary>
/// Gets or sets the path to the module assembly.
/// </summary>
/// <value>The path.</value>
public string Path { get; set; }
/// <summary>
/// Gets or sets the main namespace of the module (in fact the namespace of the DirectAccess class).
/// </summary>
/// <value>The namespace.</value>
public string Namespace { get; set; }
/// <summary>
/// Gets or sets the image path.
/// </summary>
/// <value>The image path.</value>
public string Img { get; set; }
/// <summary>
/// Gets or sets the description of the module.
/// </summary>
/// <value>The description.</value>
public string Description { get; set; }
/// <summary>
/// Gets or sets the technology of the module.
/// </summary>
/// <value>The technology.</value>
public string Technology { get; set; }
}
}
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<RevitAddIns>
<AddIn Type="Application">
<Name>EXtensionRevitLauncher</Name>
<Assembly>P:\ExtensionRevitLauncher\ExtensionRevitLauncher\bin\Debug\ExtensionRevitLauncher.dll</Assembly>
<AddInId>1cd57a34-33d5-4d8f-bef4-3abff1e7f063</AddInId>
<FullClassName>ExtensionRevitLauncher.ExtensionApp</FullClassName>
<VendorId>ADSK</VendorId>
<VendorDescription>Autodesk, www.autodesk.com</VendorDescription>
</AddIn>
</RevitAddIns>
@@ -0,0 +1,94 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{5510615B-24B2-4298-869C-C87A5C6049EE}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ExtensionRevitLauncher</RootNamespace>
<AssemblyName>ExtensionRevitLauncher</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="PresentationCore">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
<Reference Include="RevitAPI">
<HintPath>C:\program files\Autodesk\Revit 2018\RevitAPI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="RevitAPIUI">
<HintPath>C:\program files\Autodesk\Revit 2018\RevitAPIUI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data.DataSetExtensions">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="ExtensionApp.cs" />
<Compile Include="ExtensionModuleData.cs" />
<Compile Include="ExtensionXMLReader.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="ExtensionRevitLauncher.addin" />
<Content Include="extensions.xml">
<SubType>Designer</SubType>
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>copy "$(ProjectDir)extensions.xml" "$(TargetDir)extensions.xml"
copy "$(ProjectDir)extension.png" "$(TargetDir)extension.png"
xcopy "$(ProjectDir)\*.addin" "R:\Autodesk\Revit\Addins\2018" /S /R /K /V /I /F /C /Y</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
@@ -0,0 +1,80 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
namespace ExtensionRevitLauncher
{
/// <summary>
/// Reads modules configuration files and returns the list of supported module.
/// </summary>
class ExtensionXMLReader
{
const string xmlExtensionModule = "Module";
const string xmlExtensionModules = "Modules";
const string xmlName = "name";
const string xmlPath = "path";
const string xmlNamespace = "namespace";
const string xmlImg = "img";
const string xmlDescription = "description";
const string xmlTechnology = "technology";
/// <summary>
/// Reads the modules configuration file.
/// </summary>
/// <param name="path">The path.</param>
/// <returns></returns>
public static List<ExtensionModuleData> ReadFile(string path)
{
List<ExtensionModuleData> modules = new List<ExtensionModuleData>();
XmlDocument xmlDocument = new XmlDocument();
if (System.IO.File.Exists(path))
{
xmlDocument.Load(path);
foreach (XmlNode nodeModules in xmlDocument.ChildNodes)
{
if (nodeModules.Name != xmlExtensionModules)
continue;
foreach (XmlNode nodeModule in nodeModules.ChildNodes)
{
if (nodeModule.Name == xmlExtensionModule)
{
ExtensionModuleData module = new ExtensionModuleData();
module.Namespace = ReadAttribute(nodeModule, xmlNamespace);
module.Description = ReadAttribute(nodeModule, xmlDescription);
module.Img = ReadAttribute(nodeModule, xmlImg);
module.Name = ReadAttribute(nodeModule, xmlName);
module.Path = ReadAttribute(nodeModule, xmlPath);
module.Technology = ReadAttribute(nodeModule, xmlTechnology);
modules.Add(module);
}
}
}
}
return modules;
}
/// <summary>
/// Reads the specified attribute.
/// </summary>
/// <param name="node">The node.</param>
/// <param name="attribute">The attribute.</param>
/// <returns></returns>
static string ReadAttribute(XmlNode node, string attribute)
{
XmlNode attNode = node.Attributes.GetNamedItem(attribute);
if (attNode != null)
return attNode.Value.ToString();
return "";
}
}
}
@@ -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("ExtensionRevitLauncher")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Autodesk, Inc.")]
[assembly: AssemblyProduct("ExtensionRevitLauncher")]
[assembly: AssemblyCopyright("Copyright © Autodesk, Inc. 2011")]
[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("7be643e9-8774-439e-8ab6-cea216733776")]
// 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")]
Binary file not shown.

After

Width:  |  Height:  |  Size: 729 B

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Modules>
<Module name="PyramidGenerator" path="P:\PyramidGenerator\PyramidGenerator\bin\Debug\PyramidGenerator.dll" namespace="REX.PyramidGenerator" description="Pyramid"/>
<Module name="ContentGenerator" path="P:\ContentGeneratorWPF\ContentGeneratorWPF\bin\Debug\ContentGeneratorWPF.dll" namespace="REX.ContentGeneratorWPF" description="Content Generator"/>
<Module name="ElementReportHTML" path="P:\ElementReportHTML\ElementReportHTML\bin\Debug\ElementReportHTML.dll" namespace="REX.ElementReportHTML" description="Element Report"/>
<Module name="Unit" path="P:\Unit\Unit\bin\Debug\Unit.dll" namespace="REX.Unit" description="Unit" />
<Module name="FrameGenerator" path="P:\FrameGenerator\FrameGenerator\bin\Debug\FrameGenerator.dll" namespace="REX.FrameGenerator" description="Frame Generator" />
<Module name="Serialization" path="P:\Serialization\Serialization\bin\Debug\Serialization.dll" namespace="REX.Serialization" description="Serialization" />
<Module name="DRevitFreezeDrawing" path="P:\DRevitFreezeDrawing\DRevitFreezeDrawing\bin\Debug\DRevitFreezeDrawing.dll" namespace="REX.DRevitFreezeDrawing" description="Freeze Drawing" />
</Modules>