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
+8
View File
@@ -0,0 +1,8 @@
# This is a Revit family parameter file.
# allows to edit manually.
# make sure the "ParamGroup" and "ParamType" values are correct.
*ParamName ParamGroup ParamType IsInstance
FamilyParam1 autodesk.revit.group:text-1.0.0 autodesk.spec:spec.string-1.0.0 false
FamilyParam2 autodesk.revit.group:text-1.0.0 autodesk.spec:spec.string-1.0.0 true
@@ -0,0 +1,24 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
# SharpDevelop 4.2.0.8783
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GetTimeElapsed_CSharp", "GetTimeElapsed_CSharp\GetTimeElapsed_CSharp.csproj", "{998BE5CB-BDF4-479E-9893-CED9C3302444}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
RevitVSTA|Any CPU = RevitVSTA|Any CPU
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{998BE5CB-BDF4-479E-9893-CED9C3302444}.RevitVSTA|Any CPU.ActiveCfg = RevitVSTA|Any CPU
{998BE5CB-BDF4-479E-9893-CED9C3302444}.RevitVSTA|Any CPU.Build.0 = RevitVSTA|Any CPU
{998BE5CB-BDF4-479E-9893-CED9C3302444}.Debug|Any CPU.Build.0 = Debug|Any CPU
{998BE5CB-BDF4-479E-9893-CED9C3302444}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{998BE5CB-BDF4-479E-9893-CED9C3302444}.Release|Any CPU.Build.0 = Release|Any CPU
{998BE5CB-BDF4-479E-9893-CED9C3302444}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
@@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- This section defines project-level properties.
Project Type Guids - Must include {A860303F-1F3F-4691-B57E-529FC101A107};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} for a C# VSTA project.
Configuration - Specifies whether the default configuration is Release or Debug.
Platform - Specifies what CPU the output of this project can run on.
ProductVersion - The version of Visual Studio.
SchemaVersion - The project file schema version.
OutputType - Must be "Library" for VSTA.
AppDesignerFolder - The folder for application properties.
RootNamespace - In C#, this specifies the namespace given to new files.
In Visual Basic, all objects are wrapped in this namespace at runtime.
AssemblyName - Name of the output assembly.
TargetFrameworkVersion - The version of the .NET Framework this project targets.
-->
<PropertyGroup>
<ProjectTypeGuids>{A860303F-1F3F-4691-B57E-529FC101A107};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<Configuration Condition=" '$(Configuration)' == '' ">RevitVSTA</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>GetTimeElapsed_CSharp</RootNamespace>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<ProjectGuid>{998BE5CB-BDF4-479E-9893-CED9C3302444}</ProjectGuid>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
</PropertyGroup>
<!-- This section defines properties that are set when the "RevitVSTA" configuration is
selected.
DebugType - If full enables a debugger to be attached to a running program.
If pdbonly allows source code debugging when the program is started in the debugger but will only
display assembler when the running program is attached to the debugger.
If none debugging is disabled.
DebugSymbols - If true, create symbols (.pdb). If false, do not create symbols.
Optimize - If true, optimize the build output. If false, do not optimize.
OutputPath - Output path of the project relative to the project file.
EnableUnmanagedDebugging - If true, starting the debugger will attach both managed and unmanaged debuggers.
DefineConstants - Constants defined for the preprocessor.
Warning Level - Warning level for the compiler.
-->
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'RevitVSTA|AnyCPU' ">
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
<Optimize>True</Optimize>
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
<DefineConstants>TRACE</DefineConstants>
<OutputPath>..\..\Addin\</OutputPath>
<AssemblyName>GetTimeElapsed_CSharp</AssemblyName>
</PropertyGroup>
<!-- This sections specifies references for the project. -->
<ItemGroup>
<Reference Include="RevitAPIUI, Version=2011.0.0.0, Culture=neutral, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\RevitAPIUI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.AddIn">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="RevitAPI">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\RevitAPI.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
<!-- This section defines the user source files that are part of the
project.
Compile - Specifies a source file to compile.
EmbeddedResource - Specifies a .resx file for embedded resources.
None - Specifies a file that is not to be passed to the compiler (for instance,
a text file or XML file).
-->
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="ThisApplication.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="ThisApplication.designer.cs">
<DependentUpon>ThisApplication.cs</DependentUpon>
</Compile>
</ItemGroup>
<!-- Include the build rules for a C# project.-->
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- 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>
-->
<!-- This section defines VSTA properties that describe the host-changable project properties. -->
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{A860303F-1F3F-4691-B57E-529FC101A107}">
<ProjectProperties HostName="VSTAHostName" HostPackage="{C1B21C64-9E6F-4923-A89D-9F958503C1CE}" ApplicationType="usd" Language="cs" TemplatesPath="" />
<Host Name="Architecture2010" GeneratedCodeNamespace="GetTimeElapsed_CSharp">
<HostItem Name="ThisApplication" Code="ThisApplication.cs" CanonicalName="ThisApplication" DisplayName="ThisApplication" Blueprint="ThisApplication.Designer.xml" GeneratedCode="ThisApplication.designer.cs" />
</Host>
<ProjectClient>
<HostIdentifier>MEP2011</HostIdentifier>
<InProcHost>{f2d1070d-feff-4610-9403-9476ff28253d}</InProcHost>
</ProjectClient>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
</Project>
@@ -0,0 +1,28 @@
using System.Reflection;
using System.Runtime.CompilerServices;
//
// 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("GetTimeElapsed_CSharp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Autodesk, Inc.")]
[assembly: AssemblyProduct("GetTimeElapsed_CSharp")]
[assembly: AssemblyCopyright("Copyright @ Autodesk, Inc. 2008")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//
// 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 Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.*")]
@@ -0,0 +1,75 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
[assembly: global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "GetTimeElapsed_CSharp.Properties.Resources.get_ResourceManager():System.Resources.Resou" +
"rceManager")]
[assembly: global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "GetTimeElapsed_CSharp.Properties.Resources.get_Culture():System.Globalization.CultureIn" +
"fo")]
[assembly: global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "GetTimeElapsed_CSharp.Properties.Resources.set_Culture(System.Globalization.CultureInfo" +
"):Void")]
namespace GetTimeElapsed_CSharp.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("GetTimeElapsed_CSharp.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,31 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
[assembly: global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "GetTimeElapsed_CSharp.Properties.Settings.get_Default():GetTimeElapsed_CSharp.Properties.Sett" +
"ings")]
namespace GetTimeElapsed_CSharp.Properties
{
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
private static Settings defaultInstance = new Settings();
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}
@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
@@ -0,0 +1,142 @@
using System;
using System.IO;
using System.Diagnostics;
using System.Collections.Generic;
using Autodesk;
using Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Events;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Events;
namespace GetTimeElapsed_CSharp
{
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
[Autodesk.Revit.DB.Macros.AddInId("B8A5B512-EBA0-4A38-8F6C-E2254840C978")]
public partial class ThisApplication
{
Dictionary<Document, DateTime> m_dicLastSaved = new Dictionary<Document, DateTime>();
private void Module_Startup(object sender, EventArgs e)
{
InitializeDicLastSaved();
this.Application.DocumentSaved += new EventHandler<DocumentSavedEventArgs>(ThisApplication_DocumentSaved);
this.Application.DocumentOpened += new EventHandler<DocumentOpenedEventArgs>(ThisApplication_DocumentOpened);
this.Application.DocumentCreated += new EventHandler<DocumentCreatedEventArgs>(ThisApplication_DocumentCreated);
this.Application.DocumentClosing += new EventHandler<DocumentClosingEventArgs>(ThisApplication_DocumentClosing);
}
private void Module_Shutdown(object sender, EventArgs e)
{
this.Application.DocumentSaved -= new EventHandler<DocumentSavedEventArgs>(ThisApplication_DocumentSaved);
this.Application.DocumentOpened -= new EventHandler<DocumentOpenedEventArgs>(ThisApplication_DocumentOpened);
this.Application.DocumentCreated -= new EventHandler<DocumentCreatedEventArgs>(ThisApplication_DocumentCreated);
this.Application.DocumentClosing -= new EventHandler<DocumentClosingEventArgs>(ThisApplication_DocumentClosing);
}
#region Revit Macros generated code
private void InternalStartup()
{
this.Startup += new System.EventHandler(Module_Startup);
this.Shutdown += new System.EventHandler(Module_Shutdown);
}
#endregion
/// <summary>
/// Initialize
/// </summary>
private void InitializeDicLastSaved()
{
foreach (Document document in this.Application.Documents)
{
m_dicLastSaved.Add(document, DateTime.MaxValue);
}
}
/// <summary>
/// DocumentCreated event, add the created document into m_dicLastSaved
/// </summary>
/// <param name="sender">sender</param>
/// <param name="args">DocumentCreatedEventArgs</param>
void ThisApplication_DocumentCreated(object sender, DocumentCreatedEventArgs args)
{
m_dicLastSaved.Add(args.Document, DateTime.MaxValue);
}
/// <summary>
/// DocumentClosing event, remove the closing document from m_dicLastSaved
/// </summary>
/// <param name="sender">sender</param>
/// <param name="args">DocumentClosingEventArgs</param>
void ThisApplication_DocumentClosing(object sender, DocumentClosingEventArgs args)
{
m_dicLastSaved.Remove(args.Document);
}
/// <summary>
/// DocumentOpened event, add the opened document into m_dicLastSaved
/// </summary>
/// <param name="sender">sender</param>
/// <param name="args">DocumentOpenedEventArgs</param>
void ThisApplication_DocumentOpened(object sender, DocumentOpenedEventArgs args)
{
m_dicLastSaved.Add(args.Document, DateTime.MaxValue);
}
/// <summary>
/// DocumentSaved event, record the current DataTime for the saved document
/// </summary>
/// <param name="sender">sender</param>
/// <param name="args">DocumentSavedEventArgs</param>
void ThisApplication_DocumentSaved(object sender , DocumentSavedEventArgs args)
{
this.m_dicLastSaved[args.Document] = DateTime.Now;
}
/// <summary>
/// FormatTimeSpan
/// </summary>
/// <param name="elapse">TimeSpan</param>
/// <returns>the string of TimeSpan</returns>
private String FormatTimeSpan(TimeSpan elapse)
{
String elapseStr = elapse.ToString();
int lastIndexOfDot = elapseStr.LastIndexOf('.');
return elapseStr.Substring(0, lastIndexOfDot);
}
/// <summary>
/// GetTimeElapsedSinceLastSave
/// </summary>
public void GetTimeElapsedSinceLastSave()
{
String text = String.Format("{0,-30}{1,-30}",
"Document Full Name",
"Elapse Time Since Last Save(day.hh:mm:ss)")
+ "\n";
foreach (KeyValuePair<Document, DateTime> pair in m_dicLastSaved)
{
String strElapsed = String.Empty;
if (pair.Value == DateTime.MaxValue)
{
strElapsed = "Never";
}
else
{
strElapsed = FormatTimeSpan(DateTime.Now - pair.Value);
}
String fileName = System.IO.Path.GetFileName(pair.Key.PathName);
if (String.IsNullOrEmpty(fileName))
{
fileName = "*New*";
}
text += String.Format("{0,-30}{1,-30}", fileName, strElapsed) + "\n";
}
System.Windows.Forms.MessageBox.Show(text, "Macro GetTimeElapsedSinceLastSave");
}
}
}
@@ -0,0 +1,79 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.3603
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace GetTimeElapsed_CSharp {
///
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Applications.ProgrammingModel.dll", "9.0.0.0")]
public sealed partial class ThisApplication : Autodesk.Revit.UI.Macros.ApplicationEntryPoint {
public event System.EventHandler Startup;
public event System.EventHandler Shutdown;
///
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
private void OnStartup() {
Globals.ThisApplication = this;
}
///
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
protected override void FinishInitialization() {
base.FinishInitialization();
this.OnStartup();
this.InternalStartup();
if ((this.Startup != null)) {
this.Startup(this, System.EventArgs.Empty);
}
}
///
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
protected override void OnShutdown() {
if ((this.Shutdown != null)) {
this.Shutdown(this, System.EventArgs.Empty);
}
base.OnShutdown();
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
protected override string PrimaryCookie {
get {
return "ThisApplication";
}
}
}
///
public sealed partial class Globals {
private static ThisApplication _ThisApplication;
internal static ThisApplication ThisApplication {
get {
return _ThisApplication;
}
set {
if ((_ThisApplication == null)) {
_ThisApplication = value;
}
else {
throw new System.NotSupportedException();
}
}
}
}
}
@@ -0,0 +1,24 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
# SharpDevelop 4.2.0.8783
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "GetTimeElapsed_VBNet", "GetTimeElapsed_VBNet\GetTimeElapsed_VBNet.vbproj", "{C1499A1C-B9A0-4C5F-AC2E-E6F7C0B787D9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
RevitVSTA|Any CPU = RevitVSTA|Any CPU
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C1499A1C-B9A0-4C5F-AC2E-E6F7C0B787D9}.RevitVSTA|Any CPU.ActiveCfg = RevitVSTA|Any CPU
{C1499A1C-B9A0-4C5F-AC2E-E6F7C0B787D9}.RevitVSTA|Any CPU.Build.0 = RevitVSTA|Any CPU
{C1499A1C-B9A0-4C5F-AC2E-E6F7C0B787D9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C1499A1C-B9A0-4C5F-AC2E-E6F7C0B787D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C1499A1C-B9A0-4C5F-AC2E-E6F7C0B787D9}.Release|Any CPU.Build.0 = Release|Any CPU
{C1499A1C-B9A0-4C5F-AC2E-E6F7C0B787D9}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
@@ -0,0 +1,150 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- This section defines project-level properties.
Project Type Guids - Must include {A860303F-1F3F-4691-B57E-529FC101A107};{F184B08F-C81C-45F6-A57F-5ABD9991F28F} for a VB.NET VSTA project.
Configuration - Specifies whether the default configuration is Release or Debug.
Platform - Specifies what CPU the output of this project can run on.
ProductVersion - The version of Visual Studio.
SchemaVersion - The project file schema version.
OutputType - Must be "Library" for VSTA.
RootNamespace - In C#, this specifies the namespace given to new files.
In Visual Basic, all objects are wrapped in this namespace at runtime.
AssemblyName - Name of the output assembly.
TargetFrameworkVersion - The version of the .NET Framework this project targets.
-->
<PropertyGroup>
<ProjectTypeGuids>{A860303F-1F3F-4691-B57E-529FC101A107};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
<Configuration Condition=" '$(Configuration)' == '' ">RevitVSTA</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<OutputType>Library</OutputType>
<RootNamespace>GetTimeElapsed_VBNet</RootNamespace>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<OptionExplicit>On</OptionExplicit>
<OptionCompare>Binary</OptionCompare>
<OptionStrict>Off</OptionStrict>
<OptionInfer>On</OptionInfer>
<ProjectGuid>{C1499A1C-B9A0-4C5F-AC2E-E6F7C0B787D9}</ProjectGuid>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
</PropertyGroup>
<!-- This section defines properties that are set when the "RevitVSTA" configuration is
selected.
DebugType - If full enables a debugger to be attached to a running program.
If pdbonly allows source code debugging when the program is started in the debugger but will only
display assembler when the running program is attached to the debugger.
If none debugging is disabled.
DebugSymbols - If true, create symbols (.pdb). If false, do not create symbols.
Optimize - If true, optimize the build output. If false, do not optimize.
OutputPath - Output path of the project relative to the project file.
DefineDebug - If true, defines the DEBUG. If false, DEBUG is not defined.
DefineTrace - If true, defines the TRACE. If false, TRACE is not defined.
NoWarn - Listed warning numbers will be ignored.
-->
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'RevitVSTA|AnyCPU' ">
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
<Optimize>True</Optimize>
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
<DefineConstants>TRACE=1</DefineConstants>
<OutputPath>..\..\Addin\</OutputPath>
<AssemblyName>GetTimeElapsed_VBNet</AssemblyName>
</PropertyGroup>
<!-- This sections specifies references for the project. -->
<ItemGroup>
<Reference Include="RevitAPIUI, Version=2011.0.0.0, Culture=neutral, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\RevitAPIUI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.AddIn">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="RevitAPI">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\RevitAPI.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
<!-- Visual Basic supports Importing namespaces (equivalent to using statements in C#).-->
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
</ItemGroup>
<!-- This section defines the user source files that are part of the
project.
Compile - Specifies a source file to compile.
EmbeddedResource - Specifies a .resx file for embedded resources.
None - Specifies a file that is not to be passed to the compiler (for instance,
a text file or XML file).
-->
<ItemGroup>
<Compile Include="My Project\AssemblyInfo.vb" />
<EmbeddedResource Include="My Project\Resources.resx">
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
<CustomToolNamespace>My.Resources</CustomToolNamespace>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="My Project\Resources.Designer.vb">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="My Project\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<CustomToolNamespace>My</CustomToolNamespace>
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
</None>
<Compile Include="My Project\Settings.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="ThisApplication.designer.vb">
<DependentUpon>ThisApplication.vb</DependentUpon>
</Compile>
<Compile Include="ThisApplication.vb">
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<!-- Include the build rules for a VB project.-->
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<!-- 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>
-->
<!-- This section defines VSTA properties that describe the host-changable project properties. -->
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{A860303F-1F3F-4691-B57E-529FC101A107}">
<ProjectProperties HostName="VSTAHostName" HostPackage="{C1B21C64-9E6F-4923-A89D-9F958503C1CE}" ApplicationType="usd" Language="vb" TemplatesPath="" />
<Host Name="Architecture2011">
<HostItem Name="ThisApplication" Code="ThisApplication.vb" CanonicalName="ThisApplication" DisplayName="ThisApplication" Blueprint="ThisApplication.Designer.xml" GeneratedCode="ThisApplication.designer.vb" />
</Host>
<ProjectClient>
<HostIdentifier>MEP2011</HostIdentifier>
<InProcHost>{f2d1070d-feff-4610-9403-9476ff28253d}</InProcHost>
</ProjectClient>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
</Project>
@@ -0,0 +1,36 @@
Imports System
Imports System.Reflection
Imports 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.
' Review the values of the assembly attributes
<Assembly: AssemblyTitle("GetTimeElapsed_VBNet")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("Autodesk, Inc.")>
<Assembly: AssemblyProduct("GetTimeElapsed_VBNet")>
<Assembly: AssemblyCopyright("Copyright @ Autodesk, Inc. 2009")>
<Assembly: AssemblyTrademark("")>
<Assembly: CLSCompliant(True)>
<Assembly: ComVisible(False)>
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("850d7483-e379-4018-bdb0-612c14540596")>
' 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")>
@@ -0,0 +1,61 @@
'------------------------------------------------------------------------------
' <autogenerated>
' This code was generated by a tool.
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </autogenerated>
'------------------------------------------------------------------------------
Option Strict Off
Option Explicit On
Namespace My.Resources
'''<summary>
''' A strongly-typed resource class, for looking up localized strings, etc.
'''</summary>
'This class was auto-generated by the Strongly Typed Resource Builder
'class via a tool like ResGen or Visual Studio.NET.
'To add or remove a member, edit your .ResX file then rerun ResGen
'with the /str option, or rebuild your VS project.
Class MyResources
Private Shared _resMgr As System.Resources.ResourceManager
Private Shared _resCulture As System.Globalization.CultureInfo
Friend Sub New()
MyBase.New
End Sub
'''<summary>
''' Returns the cached ResourceManager instance used by this class.
'''</summary>
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _
Public Shared ReadOnly Property ResourceManager() As System.Resources.ResourceManager
Get
If (_resMgr Is Nothing) Then
Dim temp As System.Resources.ResourceManager = New System.Resources.ResourceManager("My.Resources.MyResources", GetType(MyResources).Assembly)
_resMgr = temp
End If
Return _resMgr
End Get
End Property
'''<summary>
''' Overrides the current thread's CurrentUICulture property for all
''' resource lookups using this strongly typed resource class.
'''</summary>
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _
Public Shared Property Culture() As System.Globalization.CultureInfo
Get
Return _resCulture
End Get
Set
_resCulture = value
End Set
End Property
End Class
End Namespace
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,38 @@
'------------------------------------------------------------------------------
' <autogenerated>
' This code was generated by a tool.
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </autogenerated>
'------------------------------------------------------------------------------
Option Strict Off
Option Explicit On
Partial Friend NotInheritable Class MySettings
Inherits System.Configuration.ApplicationSettingsBase
Private Shared m_Value As MySettings
Private Shared m_SyncObject As Object = New Object
<System.Diagnostics.DebuggerNonUserCode()> _
Public Shared ReadOnly Property Value() As MySettings
Get
If (MySettings.m_Value Is Nothing) Then
System.Threading.Monitor.Enter(MySettings.m_SyncObject)
If (MySettings.m_Value Is Nothing) Then
Try
MySettings.m_Value = New MySettings
Finally
System.Threading.Monitor.Exit(MySettings.m_SyncObject)
End Try
End If
End If
Return MySettings.m_Value
End Get
End Property
End Class
@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
@@ -0,0 +1,80 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:2.0.50727.3603
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict Off
Option Explicit On
'''
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Applications.ProgrammingModel.dll", "9.0.0.0"), _
Global.System.CLSCompliantAttribute(false)> _
Partial Public NotInheritable Class ThisApplication
Inherits Autodesk.Revit.UI.Macros.ApplicationEntryPoint
Public Event Startup As System.EventHandler
Public Event Shutdown As System.EventHandler
'''
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Never)> _
Private Sub OnStartup()
Globals.ThisApplication = Me
End Sub
'''
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Never)> _
Protected Overrides Sub FinishInitialization()
MyBase.FinishInitialization
Me.OnStartup
If (Not (Me.StartupEvent) Is Nothing) Then
RaiseEvent Startup(Me, System.EventArgs.Empty)
End If
End Sub
'''
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Never)> _
Protected Overrides Sub OnShutdown()
If (Not (Me.ShutdownEvent) Is Nothing) Then
RaiseEvent Shutdown(Me, System.EventArgs.Empty)
End If
MyBase.OnShutdown
End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Never)> _
Protected Overrides ReadOnly Property PrimaryCookie() As String
Get
Return "ThisApplication"
End Get
End Property
End Class
'''
Partial Public NotInheritable Class Globals
Private Shared _ThisApplication As ThisApplication
Friend Shared Property ThisApplication() As ThisApplication
Get
Return _ThisApplication
End Get
Set
If (_ThisApplication Is Nothing) Then
_ThisApplication = value
Else
Throw New System.NotSupportedException
End If
End Set
End Property
End Class
@@ -0,0 +1,114 @@
Imports System
Imports System.IO
Imports System.Diagnostics
Imports System.Collections.Generic
Imports Autodesk
Imports Autodesk.Revit
Imports Autodesk.Revit.DB
Imports Autodesk.Revit.DB.Events
Imports Autodesk.Revit.UI
Imports Autodesk.Revit.UI.Events
<Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)> _
<Autodesk.Revit.DB.Macros.AddInIdAttribute("A2616C96-88D8-4C9D-B4EF-E84147DEE20B")> _
Partial Public Class ThisApplication
Private m_dicLastSaved As New Dictionary(Of Document, DateTime)()
Private Sub Module_Startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup
InitializeDicLastSaved()
AddHandler Me.Application.DocumentSaved, AddressOf ThisApplication_DocumentSaved
AddHandler Me.Application.DocumentOpened, AddressOf ThisApplication_DocumentOpened
AddHandler Me.Application.DocumentCreated, AddressOf ThisApplication_DocumentCreated
AddHandler Me.Application.DocumentClosing, AddressOf ThisApplication_DocumentClosing
End Sub
Private Sub Module_Shutdown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shutdown
RemoveHandler Me.Application.DocumentSaved, AddressOf ThisApplication_DocumentSaved
RemoveHandler Me.Application.DocumentOpened, AddressOf ThisApplication_DocumentOpened
RemoveHandler Me.Application.DocumentCreated, AddressOf ThisApplication_DocumentCreated
RemoveHandler Me.Application.DocumentClosing, AddressOf ThisApplication_DocumentClosing
End Sub
''' <summary>
''' Initialize
''' </summary>
Private Sub InitializeDicLastSaved()
For Each document As Document In Me.Application.Documents
m_dicLastSaved.Add(document, DateTime.MaxValue)
Next
End Sub
''' <summary>
''' DocumentCreated event, add the created document into m_dicLastSaved
''' </summary>
''' <param name="sender">sender</param>
''' <param name="args">DocumentCreatedEventArgs</param>
Private Sub ThisApplication_DocumentCreated(ByVal sender As Object, ByVal args As Autodesk.Revit.DB.Events.DocumentCreatedEventArgs)
m_dicLastSaved.Add(args.Document, DateTime.MaxValue)
End Sub
''' <summary>
''' DocumentClosing event, remove the closing document from m_dicLastSaved
''' </summary>
''' <param name="sender">sender</param>
''' <param name="args">DocumentClosingEventArgs</param>
Private Sub ThisApplication_DocumentClosing(ByVal sender As Object, ByVal args As Autodesk.Revit.DB.Events.DocumentClosingEventArgs)
m_dicLastSaved.Remove(args.Document)
End Sub
''' <summary>
''' DocumentOpened event, add the opened document into m_dicLastSaved
''' </summary>
''' <param name="sender">sender</param>
''' <param name="args">DocumentOpenedEventArgs</param>
Private Sub ThisApplication_DocumentOpened(ByVal sender As Object, ByVal args As Autodesk.Revit.DB.Events.DocumentOpenedEventArgs)
m_dicLastSaved.Add(args.Document, DateTime.MaxValue)
End Sub
''' <summary>
''' DocumentSaved event, record the current DataTime for the saved document
''' </summary>
''' <param name="sender">sender</param>
''' <param name="args">DocumentSavedEventArgs</param>
Private Sub ThisApplication_DocumentSaved(ByVal sender As Object, ByVal args As Autodesk.Revit.DB.Events.DocumentSavedEventArgs)
Me.m_dicLastSaved(args.Document) = DateTime.Now
End Sub
''' <summary>
''' FormatTimeSpan
''' </summary>
''' <param name="elapse">TimeSpan</param>
''' <returns>the string of TimeSpan</returns>
Private Function FormatTimeSpan(ByVal elapse As TimeSpan) As [String]
Dim elapseStr As [String] = elapse.ToString()
Dim lastIndexOfDot As Integer = elapseStr.LastIndexOf("."c)
Return elapseStr.Substring(0, lastIndexOfDot)
End Function
''' <summary>
''' GetTimeElapsedSinceLastSave
''' </summary>
Public Sub GetTimeElapsedSinceLastSave()
Dim text As [String] = [String].Format("{0,-30}{1,-30}", "Document Full Name", "Elapse Time Since Last Save(day.hh:mm:ss)") & vbLf
For Each pair As KeyValuePair(Of Document, DateTime) In m_dicLastSaved
Dim strElapsed As [String] = [String].Empty
If pair.Value = DateTime.MaxValue Then
strElapsed = "Never"
Else
strElapsed = FormatTimeSpan(DateTime.Now - pair.Value)
End If
Dim fileName As [String] = System.IO.Path.GetFileName(pair.Key.PathName)
If [String].IsNullOrEmpty(fileName) Then
fileName = "*New*"
End If
text += [String].Format("{0,-30}{1,-30}", fileName, strElapsed) & vbLf
Next
System.Windows.Forms.MessageBox.Show(text, "Macro GetTimeElapsedSinceLastSave")
End Sub
End Class
Binary file not shown.
Binary file not shown.
Binary file not shown.
+24
View File
@@ -0,0 +1,24 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
# SharpDevelop 4.2.0.8783
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Rooms", "Rooms\Rooms.csproj", "{BD8C08EF-CDCD-4D0A-AAA5-903B62FA1BF3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
RevitVSTA|Any CPU = RevitVSTA|Any CPU
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BD8C08EF-CDCD-4D0A-AAA5-903B62FA1BF3}.RevitVSTA|Any CPU.ActiveCfg = RevitVSTA|Any CPU
{BD8C08EF-CDCD-4D0A-AAA5-903B62FA1BF3}.RevitVSTA|Any CPU.Build.0 = RevitVSTA|Any CPU
{BD8C08EF-CDCD-4D0A-AAA5-903B62FA1BF3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BD8C08EF-CDCD-4D0A-AAA5-903B62FA1BF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BD8C08EF-CDCD-4D0A-AAA5-903B62FA1BF3}.Release|Any CPU.Build.0 = Release|Any CPU
{BD8C08EF-CDCD-4D0A-AAA5-903B62FA1BF3}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
@@ -0,0 +1,93 @@
//
// (C) Copyright 2003-2007 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Windows.Forms;
using Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Structure;
namespace Rooms
{
/// <summary>
/// Get some properties of a slab , such as Level, Type name, Span direction,
/// Material name, Thickness, and Young Modulus for the slab's Material.
/// </summary>
public class SamplesRoom
{
/// <summary>
/// Ctor without parameter is not allowed
/// </summary>
private SamplesRoom()
{
// no code here
}
/// <summary>
/// Default constructor of StructuralLayerFunction
/// </summary>
public SamplesRoom(ThisApplication hostApp)
{
// Init for varialbes
// this application handler
m_revit = hostApp;
}
/// <summary>
/// Run sample Rooms
/// </summary>
public void Run()
{
if (null == m_revit.ActiveUIDocument)
{
MessageBox.Show("No openning document.");
return;
}
Transaction trans = new Transaction(m_revit.ActiveUIDocument.Document, "RoomInfo");
trans.Start();
try
{
//create a new instance of class Data
RoomsData data = new RoomsData(m_revit);
//create a form to display the room information
using (roomsInformationForm infoForm = new roomsInformationForm(data))
{
infoForm.ShowDialog();
}
}
catch (Exception ex)
{
// If there are something wrong, give error information
trans.RollBack();
MessageBox.Show(ex.Message);
}
trans.Commit();
}
#region Class member variable
ThisApplication m_revit;
#endregion
}
}
@@ -0,0 +1,28 @@
using System.Reflection;
using System.Runtime.CompilerServices;
//
// 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("Rooms")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Autodesk, Inc.")]
[assembly: AssemblyProduct("Rooms")]
[assembly: AssemblyCopyright("Copyright @ Autodesk, Inc. 2008")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//
// 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 Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.*")]
@@ -0,0 +1,75 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
[assembly: global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Rooms.Properties.Resources.get_ResourceManager():System.Resources.Resou" +
"rceManager")]
[assembly: global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Rooms.Properties.Resources.get_Culture():System.Globalization.CultureIn" +
"fo")]
[assembly: global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Rooms.Properties.Resources.set_Culture(System.Globalization.CultureInfo" +
"):Void")]
namespace Rooms.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Rooms.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,31 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
[assembly: global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Rooms.Properties.Settings.get_Default():Rooms.Properties.Sett" +
"ings")]
namespace Rooms.Properties
{
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
private static Settings defaultInstance = new Settings();
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}
@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
@@ -0,0 +1,179 @@
using System;
using System.Data;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Collections.ObjectModel;
using System.Windows.Forms;
using Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Architecture;
namespace Rooms
{
/// <summary>
/// UI to display the rooms information
/// </summary>
public partial class roomsInformationForm : System.Windows.Forms.Form
{
RoomsData m_data;
/// <summary>
/// constructor
/// </summary>
public roomsInformationForm()
{
InitializeComponent();
}
/// <summary>
/// Overload the constructor
/// </summary>
/// <param name="data">an instanc of Data class</param>
public roomsInformationForm(RoomsData data)
{
m_data = data;
InitializeComponent();
}
/// <summary>
/// add rooms of list roomsWithTag to the listview
/// </summary>
private void DisplayRooms(ReadOnlyCollection<Room> roomList, bool isHaveTag)
{
String propertyValue = null; //value of department
String departmentName = null; //department name
Double areaValue = 0.0; //room area
//add rooms to the listview
foreach (Room tmpRoom in roomList)
{
int idValue = tmpRoom.Id.IntegerValue;
string roomId = idValue.ToString();
//create a list view Item
ListViewItem tmpItem = new ListViewItem(roomId);
tmpItem.SubItems.Add(tmpRoom.Name); //display room name.
tmpItem.SubItems.Add(tmpRoom.Number); //display room number.
tmpItem.SubItems.Add(tmpRoom.Level.Name); //display the level
//get department name from Department property
departmentName = m_data.GetProperty(tmpRoom, BuiltInParameter.ROOM_DEPARTMENT);
tmpItem.SubItems.Add(departmentName);
//get property value
propertyValue = m_data.GetProperty(tmpRoom, BuiltInParameter.ROOM_AREA);
//get the area value
areaValue = Double.Parse(propertyValue);
tmpItem.SubItems.Add(propertyValue + " SF");
//display whether the room with tag or not
if (isHaveTag)
{
tmpItem.SubItems.Add("Yes");
}
else
{
tmpItem.SubItems.Add("No");
}
//add the item to the listview
roomsListView.Items.Add(tmpItem);
//add the area to the department
m_data.CalculateDepartmentArea(departmentName, areaValue);
}
}
/// <summary>
/// when the form was loaded, display the room information
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void RoomInfoForm_Load(object sender, EventArgs e)
{
roomsListView.Items.Clear();
//add rooms in the list roomsWithoutTag to the listview
this.DisplayRooms(m_data.RoomsWithoutTag, false);
//add rooms in the list roomsWithTag to the listview
this.DisplayRooms(m_data.RoomsWithTag, true);
//display the amount of the rooms
String numberOfRooms = "The number of rooms: " + m_data.Rooms.Count.ToString();
allRoomLabel.Text = numberOfRooms;
//display the amount of the rooms without tags
String roomsWithoutTag = "The number of rooms without tags: " +
m_data.RoomsWithoutTag.Count.ToString();
tagLabel.Text = roomsWithoutTag;
// if all the rooms have tags ,the button will be set to disable
if (0 == m_data.RoomsWithoutTag.Count)
{
addTagsButton.Enabled = false;
}
//display the total area of each department
this.DisplayDartmentsInfo();
}
/// <summary>
/// create room tags for the rooms without tags
/// </summary>
private void addTagButton_Click(object sender, EventArgs e)
{
//close the form
m_data.CreateTags();
MessageBox.Show("Add tags to rooms successfully", "Macro Sample", MessageBoxButtons.OK, MessageBoxIcon.Information);
this.Close();
}
/// <summary>
/// reorder room number
/// </summary>
private void reorderButton_Click(object sender, EventArgs e)
{
m_data.ReorderRooms();
MessageBox.Show("Reoder rooms successfully", "Macro Sample", MessageBoxButtons.OK, MessageBoxIcon.Information);
this.Close();
}
/// <summary>
/// display total room informations for each department
/// </summary>
private void DisplayDartmentsInfo()
{
for (int i = 0; i < m_data.DepartmentInfos.Count; i++)
{
//create a listview item
ListViewItem tmpItem = new ListViewItem(m_data.DepartmentInfos[i].DepartmentName);
tmpItem.SubItems.Add(m_data.DepartmentInfos[i].DepartmentAreaValue.ToString() + " SF");
departmentsListView.Items.Add(tmpItem);
}
}
/// <summary>
/// export the total area of each department to a Excel file
/// </summary>
private void exportButton_Click(object sender, EventArgs e)
{
//create a save file dialog
using (SaveFileDialog sfdlg = new SaveFileDialog())
{
sfdlg.Title = "Export area of department to Excel file";
sfdlg.Filter = "CSV(command delimited)(*.csv)|*.csv";
sfdlg.RestoreDirectory = true;
if (DialogResult.OK == sfdlg.ShowDialog())
{
m_data.ExportFile(sfdlg.FileName);
}
}
}
}
}
@@ -0,0 +1,248 @@
namespace Rooms
{
partial class roomsInformationForm
{
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.allRoomLabel = new System.Windows.Forms.Label();
this.addTagsButton = new System.Windows.Forms.Button();
this.closeButton = new System.Windows.Forms.Button();
this.roomsGroupBox = new System.Windows.Forms.GroupBox();
this.roomsListView = new System.Windows.Forms.ListView();
this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
this.columnHeader4 = new System.Windows.Forms.ColumnHeader();
this.columnHeader2 = new System.Windows.Forms.ColumnHeader();
this.columnHeader3 = new System.Windows.Forms.ColumnHeader();
this.columnHeader8 = new System.Windows.Forms.ColumnHeader();
this.columnHeader9 = new System.Windows.Forms.ColumnHeader();
this.columnHeader10 = new System.Windows.Forms.ColumnHeader();
this.tagLabel = new System.Windows.Forms.Label();
this.reorderButton = new System.Windows.Forms.Button();
this.exportButton = new System.Windows.Forms.Button();
this.departmentGroupBox = new System.Windows.Forms.GroupBox();
this.departmentsListView = new System.Windows.Forms.ListView();
this.columnHeader6 = new System.Windows.Forms.ColumnHeader();
this.columnHeader7 = new System.Windows.Forms.ColumnHeader();
this.roomsGroupBox.SuspendLayout();
this.departmentGroupBox.SuspendLayout();
this.SuspendLayout();
//
// allRoomLabel
//
this.allRoomLabel.AutoSize = true;
this.allRoomLabel.Location = new System.Drawing.Point(272, 349);
this.allRoomLabel.Name = "allRoomLabel";
this.allRoomLabel.Size = new System.Drawing.Size(112, 13);
this.allRoomLabel.TabIndex = 9;
this.allRoomLabel.Text = "amountOfRoomsLabel";
//
// addTagsButton
//
this.addTagsButton.Location = new System.Drawing.Point(431, 412);
this.addTagsButton.Name = "addTagsButton";
this.addTagsButton.Size = new System.Drawing.Size(75, 23);
this.addTagsButton.TabIndex = 1;
this.addTagsButton.Text = "&Add Tags";
this.addTagsButton.UseVisualStyleBackColor = true;
this.addTagsButton.Click += new System.EventHandler(this.addTagButton_Click);
//
// closeButton
//
this.closeButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.closeButton.Location = new System.Drawing.Point(431, 499);
this.closeButton.Name = "closeButton";
this.closeButton.Size = new System.Drawing.Size(75, 23);
this.closeButton.TabIndex = 4;
this.closeButton.Text = "&Close";
this.closeButton.UseVisualStyleBackColor = true;
//
// roomsGroupBox
//
this.roomsGroupBox.Controls.Add(this.roomsListView);
this.roomsGroupBox.Location = new System.Drawing.Point(2, 12);
this.roomsGroupBox.Name = "roomsGroupBox";
this.roomsGroupBox.Size = new System.Drawing.Size(515, 303);
this.roomsGroupBox.TabIndex = 7;
this.roomsGroupBox.TabStop = false;
this.roomsGroupBox.Text = "Rooms information";
//
// roomsListView
//
this.roomsListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1,
this.columnHeader4,
this.columnHeader2,
this.columnHeader3,
this.columnHeader8,
this.columnHeader9,
this.columnHeader10});
this.roomsListView.FullRowSelect = true;
this.roomsListView.GridLines = true;
this.roomsListView.Location = new System.Drawing.Point(5, 19);
this.roomsListView.MultiSelect = false;
this.roomsListView.Name = "roomsListView";
this.roomsListView.Size = new System.Drawing.Size(504, 275);
this.roomsListView.Sorting = System.Windows.Forms.SortOrder.Ascending;
this.roomsListView.TabIndex = 5;
this.roomsListView.UseCompatibleStateImageBehavior = false;
this.roomsListView.View = System.Windows.Forms.View.Details;
//
// columnHeader1
//
this.columnHeader1.Text = "ID";
this.columnHeader1.Width = 80;
//
// columnHeader4
//
this.columnHeader4.Text = "Name";
//
// columnHeader2
//
this.columnHeader2.Text = "Number";
this.columnHeader2.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// columnHeader3
//
this.columnHeader3.Text = "level";
this.columnHeader3.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// columnHeader8
//
this.columnHeader8.Text = "Department";
this.columnHeader8.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
this.columnHeader8.Width = 80;
//
// columnHeader9
//
this.columnHeader9.Text = "Area";
this.columnHeader9.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
this.columnHeader9.Width = 80;
//
// columnHeader10
//
this.columnHeader10.Text = "Have tag";
this.columnHeader10.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// tagLabel
//
this.tagLabel.AutoSize = true;
this.tagLabel.Location = new System.Drawing.Point(272, 379);
this.tagLabel.Name = "tagLabel";
this.tagLabel.Size = new System.Drawing.Size(168, 13);
this.tagLabel.TabIndex = 10;
this.tagLabel.Text = "amountOfRoomsWithoutTagLabel";
//
// reorderButton
//
this.reorderButton.Location = new System.Drawing.Point(431, 441);
this.reorderButton.Name = "reorderButton";
this.reorderButton.Size = new System.Drawing.Size(75, 23);
this.reorderButton.TabIndex = 2;
this.reorderButton.Text = "&Reorder";
this.reorderButton.UseVisualStyleBackColor = true;
this.reorderButton.Click += new System.EventHandler(this.reorderButton_Click);
//
// exportButton
//
this.exportButton.Location = new System.Drawing.Point(431, 470);
this.exportButton.Name = "exportButton";
this.exportButton.Size = new System.Drawing.Size(75, 23);
this.exportButton.TabIndex = 3;
this.exportButton.Text = "&Export";
this.exportButton.UseVisualStyleBackColor = true;
this.exportButton.Click += new System.EventHandler(this.exportButton_Click);
//
// departmentGroupBox
//
this.departmentGroupBox.Controls.Add(this.departmentsListView);
this.departmentGroupBox.Location = new System.Drawing.Point(2, 330);
this.departmentGroupBox.Name = "departmentGroupBox";
this.departmentGroupBox.Size = new System.Drawing.Size(264, 201);
this.departmentGroupBox.TabIndex = 8;
this.departmentGroupBox.TabStop = false;
this.departmentGroupBox.Text = "Area of departments";
//
// departmentsListView
//
this.departmentsListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader6,
this.columnHeader7});
this.departmentsListView.FullRowSelect = true;
this.departmentsListView.GridLines = true;
this.departmentsListView.Location = new System.Drawing.Point(6, 19);
this.departmentsListView.Name = "departmentsListView";
this.departmentsListView.Size = new System.Drawing.Size(252, 174);
this.departmentsListView.Sorting = System.Windows.Forms.SortOrder.Ascending;
this.departmentsListView.TabIndex = 6;
this.departmentsListView.UseCompatibleStateImageBehavior = false;
this.departmentsListView.View = System.Windows.Forms.View.Details;
//
// columnHeader6
//
this.columnHeader6.Text = "Department";
this.columnHeader6.Width = 120;
//
// columnHeader7
//
this.columnHeader7.Text = "Total Area";
this.columnHeader7.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
this.columnHeader7.Width = 120;
//
// roomsInformationForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.closeButton;
this.ClientSize = new System.Drawing.Size(518, 536);
this.Controls.Add(this.departmentGroupBox);
this.Controls.Add(this.exportButton);
this.Controls.Add(this.reorderButton);
this.Controls.Add(this.tagLabel);
this.Controls.Add(this.roomsGroupBox);
this.Controls.Add(this.closeButton);
this.Controls.Add(this.addTagsButton);
this.Controls.Add(this.allRoomLabel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "roomsInformationForm";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Room Information";
this.Load += new System.EventHandler(this.RoomInfoForm_Load);
this.roomsGroupBox.ResumeLayout(false);
this.departmentGroupBox.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label allRoomLabel;
private System.Windows.Forms.Button addTagsButton;
private System.Windows.Forms.Button closeButton;
private System.Windows.Forms.GroupBox roomsGroupBox;
private System.Windows.Forms.ListView roomsListView;
private System.Windows.Forms.ColumnHeader columnHeader1;
private System.Windows.Forms.ColumnHeader columnHeader4;
private System.Windows.Forms.ColumnHeader columnHeader2;
private System.Windows.Forms.ColumnHeader columnHeader3;
private System.Windows.Forms.Label tagLabel;
private System.Windows.Forms.Button reorderButton;
private System.Windows.Forms.ColumnHeader columnHeader8;
private System.Windows.Forms.ColumnHeader columnHeader9;
private System.Windows.Forms.Button exportButton;
private System.Windows.Forms.ColumnHeader columnHeader10;
private System.Windows.Forms.GroupBox departmentGroupBox;
private System.Windows.Forms.ListView departmentsListView;
private System.Windows.Forms.ColumnHeader columnHeader6;
private System.Windows.Forms.ColumnHeader columnHeader7;
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,171 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- This section defines project-level properties.
Project Type Guids - Must include {A860303F-1F3F-4691-B57E-529FC101A107};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} for a C# VSTA project.
Configuration - Specifies whether the default configuration is Release or Debug.
Platform - Specifies what CPU the output of this project can run on.
ProductVersion - The version of Visual Studio.
SchemaVersion - The project file schema version.
OutputType - Must be "Library" for VSTA.
AppDesignerFolder - The folder for application properties.
RootNamespace - In C#, this specifies the namespace given to new files.
In Visual Basic, all objects are wrapped in this namespace at runtime.
AssemblyName - Name of the output assembly.
TargetFrameworkVersion - The version of the .NET Framework this project targets.
-->
<PropertyGroup>
<ProjectTypeGuids>{A860303F-1F3F-4691-B57E-529FC101A107};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<Configuration Condition=" '$(Configuration)' == '' ">RevitVSTA</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Rooms</RootNamespace>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<ProjectGuid>{BD8C08EF-CDCD-4D0A-AAA5-903B62FA1BF3}</ProjectGuid>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<SignAssembly>False</SignAssembly>
<DelaySign>False</DelaySign>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<NoStdLib>False</NoStdLib>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<!-- This section defines properties that are set when the "RevitVSTA" configuration is
selected.
DebugType - If full enables a debugger to be attached to a running program.
If pdbonly allows source code debugging when the program is started in the debugger but will only
display assembler when the running program is attached to the debugger.
If none debugging is disabled.
DebugSymbols - If true, create symbols (.pdb). If false, do not create symbols.
Optimize - If true, optimize the build output. If false, do not optimize.
OutputPath - Output path of the project relative to the project file.
EnableUnmanagedDebugging - If true, starting the debugger will attach both managed and unmanaged debuggers.
DefineConstants - Constants defined for the preprocessor.
Warning Level - Warning level for the compiler.
-->
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'RevitVSTA|AnyCPU' ">
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
<RegisterForComInterop>False</RegisterForComInterop>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
<BaseAddress>4194304</BaseAddress>
<PlatformTarget>AnyCPU</PlatformTarget>
<FileAlignment>4096</FileAlignment>
<Optimize>True</Optimize>
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
<DefineConstants>TRACE</DefineConstants>
<OutputPath>..\..\Addin\</OutputPath>
<AssemblyName>Rooms</AssemblyName>
</PropertyGroup>
<!-- This sections specifies references for the project. -->
<ItemGroup>
<Reference Include="RevitAPI">
<HintPath>..\..\..\..\..\RevitAPI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="RevitAPIUI">
<HintPath>..\..\..\..\..\RevitAPIUI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.AddIn">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<!-- This section defines the user source files that are part of the
project.
Compile - Specifies a source file to compile.
EmbeddedResource - Specifies a .resx file for embedded resources.
None - Specifies a file that is not to be passed to the compiler (for instance,
a text file or XML file).
-->
<ItemGroup>
<Compile Include="Command.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="RoomInfoForm.resx">
<DependentUpon>RoomInfoForm.cs</DependentUpon>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="RoomInfoForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="RoomInfoForm.designer.cs">
<DependentUpon>RoomInfoForm.cs</DependentUpon>
</Compile>
<Compile Include="RoomsData.cs" />
<Compile Include="ThisApplication.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="ThisApplication.designer.cs">
<DependentUpon>ThisApplication.cs</DependentUpon>
</Compile>
<None Include="Xml1.xml" />
</ItemGroup>
<ItemGroup>
<None Include="Window1.xaml">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Include="Window2.xaml">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</None>
</ItemGroup>
<!-- Include the build rules for a C# project.-->
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- 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>
-->
<!-- This section defines VSTA properties that describe the host-changable project properties. -->
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{A860303F-1F3F-4691-B57E-529FC101A107}">
<ProjectProperties HostName="VSTAHostName" HostPackage="{C1B21C64-9E6F-4923-A89D-9F958503C1CE}" ApplicationType="usd" Language="cs" TemplatesPath="" />
<Host Name="Architecture2010" GeneratedCodeNamespace="Rooms">
<HostItem Name="ThisApplication" Code="ThisApplication.cs" CanonicalName="ThisApplication" DisplayName="ThisApplication" Blueprint="ThisApplication.Designer.xml" GeneratedCode="ThisApplication.designer.cs" />
</Host>
<ProjectClient>
<HostIdentifier>MEP2011</HostIdentifier>
<InProcHost>{f2d1070d-feff-4610-9403-9476ff28253d}</InProcHost>
</ProjectClient>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
</Project>
@@ -0,0 +1,419 @@
using System;
using System.Text;
using System.Diagnostics;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using Autodesk.Revit.DB.Architecture;
namespace Rooms
{
/// <summary>
/// Iterates through the rooms in the project and get the information of all the rooms
/// </summary>
public class RoomsData
{
ThisApplication m_thisApp;
List<Room> m_rooms = new List<Room>(); //a list to store all rooms in the project
List<RoomTag> m_roomTags = new List<RoomTag>(); //a list to store all room tags in the project
List<Room> m_roomsWithTag = new List<Room>(); //a list to store all rooms with tag
List<Room> m_roomsWithoutTag = new List<Room>(); //a list to store all rooms without tag
List<DepartmentInfo> m_departmentInfos = new List<DepartmentInfo>(); //a list to store department
/// <summary>
/// a class to stor the value of property Area and Department
/// </summary>
public struct DepartmentInfo
{
String m_departmentName;
double m_departmentAreaValue;
/// <summary>
/// constructor
/// </summary>
public DepartmentInfo(String departmentName, double areaValue)
{
m_departmentName = departmentName;
m_departmentAreaValue = areaValue;
}
/// <summary>
/// the name of department
/// </summary>
public String DepartmentName
{
get
{
return m_departmentName;
}
}
/// <summary>
/// the total area of the rooms in department
/// </summary>
public double DepartmentAreaValue
{
get
{
return m_departmentAreaValue;
}
}
}
/// <summary>
/// a list of all department
/// </summary>
public ReadOnlyCollection<DepartmentInfo> DepartmentInfos
{
get
{
return new ReadOnlyCollection<DepartmentInfo>(m_departmentInfos);
}
}
/// <summary>
/// a list of all the rooms in the project
/// </summary>
public ReadOnlyCollection<Room> Rooms
{
get
{
return new ReadOnlyCollection<Room>(m_rooms);
}
}
/// <summary>
/// a list of all the room tags in the project
/// </summary>
public ReadOnlyCollection<RoomTag> RoomTags
{
get
{
return new ReadOnlyCollection<RoomTag>(m_roomTags);
}
}
/// <summary>
/// a list of the rooms that had tag
/// </summary>
public ReadOnlyCollection<Room> RoomsWithTag
{
get
{
return new ReadOnlyCollection<Room>(m_roomsWithTag);
}
}
/// <summary>
/// a list of the rooms without tags
/// </summary>
public ReadOnlyCollection<Room> RoomsWithoutTag
{
get
{
return new ReadOnlyCollection<Room>(m_roomsWithoutTag);
}
}
/// <summary>
///constructor
/// </summary>
public RoomsData(ThisApplication application)
{
m_thisApp = application;
ElementFilter filterRoom = new ElementClassFilter(typeof(SpatialElement));
FilteredElementCollector roomCollector = new FilteredElementCollector(m_thisApp.ActiveUIDocument.Document);
roomCollector.WherePasses(filterRoom);
foreach (Autodesk.Revit.DB.Element ee in roomCollector)
{
Room tmpRoom = ee as Room;
if (null != tmpRoom)
{
m_rooms.Add(tmpRoom);
continue;
}
}
ElementFilter filterRoomTag = new ElementClassFilter(typeof(SpatialElementTag));
FilteredElementCollector roomTagCollector = new FilteredElementCollector(m_thisApp.ActiveUIDocument.Document);
roomTagCollector.WherePasses(filterRoomTag);
foreach (Autodesk.Revit.DB.Element ee in roomTagCollector)
{
// find the room tags
RoomTag tmpTag = ee as RoomTag;
if (null != tmpTag)
{
m_roomTags.Add(tmpTag);
continue;
}
}
//find out the rooms that without tag
ClassifyRooms();
}
/// <summary>
/// find out the rooms that without tag
/// </summary>
private void ClassifyRooms()
{
//copy the all the elements in list Rooms to list RoomsWithoutTag
m_roomsWithoutTag.AddRange(m_rooms);
//get the room id from room tag via room property
//if find the room id in list RoomWithoutTag,
//add it to the list RoomWithTag and delete it from list RoomWithoutTag
foreach (RoomTag tmpTag in m_roomTags)
{
int idValue = tmpTag.Room.Id.IntegerValue;
m_roomsWithTag.Add(tmpTag.Room);
//search the id for list RoomWithoutTag
foreach (Room tmpRoom in m_rooms)
{
if (idValue == tmpRoom.Id.IntegerValue)
{
m_roomsWithoutTag.Remove(tmpRoom);
}
}
}
}
/// <summary>
/// create the room tag for the rooms without tags
/// </summary>
public void CreateTags()
{
foreach (Room tmpRoom in m_roomsWithoutTag)
{
//get the location point of the room
LocationPoint locPoint = tmpRoom.Location as LocationPoint;
if(null != locPoint)
{
//create a instance of UV class
double u = locPoint.Point.X;
double v = locPoint.Point.Y;
UV point = m_thisApp.Application.Create.NewUV(u, v);
//create room tag
m_thisApp.ActiveUIDocument.Document.Create.NewRoomTag(new LinkElementId(tmpRoom.Id), point, null);
}
}
}
/// <summary>
/// sort all the rooms by ascending order according their coordinate
/// </summary>
private void SortRooms()
{
LocationPoint tmpPoint = null;
LocationPoint roomPoint = null;
Room listRoom = null;
int result = 0;
int flag = 0;
int amount = m_rooms.Count;
//sort the rooms according their location point
for (int i = 0; i < amount - 1; i++)
{
Room tmpRoom = m_rooms[i];
tmpPoint = tmpRoom.Location as LocationPoint;
if(null == tmpPoint)
continue;
for (int j = i + 1; j < amount; j++)
{
listRoom = m_rooms[j];
roomPoint = listRoom.Location as LocationPoint;
if(null == roomPoint)
continue;
//rooms in different level
if (tmpPoint.Point.Z > roomPoint.Point.Z)
{
tmpRoom = listRoom;
result = j;
//if tmpRoom was changed,set flag to 1
flag = 1;
}
//the two rooms in the same level
else if (tmpPoint.Point.Z == roomPoint.Point.Z)
{
if (tmpPoint.Point.X > roomPoint.Point.X)
{
tmpRoom = listRoom;
result = j;
flag = 1;
}
else if (tmpPoint.Point.X == roomPoint.Point.X &&
tmpPoint.Point.Y > roomPoint.Point.Y)
{
tmpRoom = listRoom;
result = j;
flag = 1;
}
}
}
//if flag equals 1 ,move the room to the front of list
if (1 == flag)
{
Room tempRoom = m_rooms[i];
m_rooms[i] = m_rooms[result];
m_rooms[result] = tempRoom;
flag = 0;
}
}
}
/// <summary>
/// reorder all the rooms' number
/// </summary>
/// <param name="roomlist">a list of rooms</param>
public void ReorderRooms()
{
//sort all the rooms by ascending order according their coordinate
this.SortRooms();
//to avoid revit display the warning message,
//change the rooms' name to a temp name
foreach (Room tmpRoom in m_rooms)
{
tmpRoom.Number += "XXX";
}
//set the rooms number to a new order
for (int i = 1; i <= m_rooms.Count; i++)
{
m_rooms[i - 1].Number = i.ToString();
}
}
/// <summary>
/// get the room property and Department property according the property name
/// </summary>
/// <param name="room">a instance of room class</param>
/// <param name="propertyName">the property name</param>
/// <param name="proValue">the value of property</param>
public String GetProperty(Room room, BuiltInParameter paramEnum)
{
String propertyValue = null; //the value of parameter
//get the parameter via the parameterId
Parameter param = room.get_Parameter(paramEnum);
//get the parameter's storage type
StorageType storageType = param.StorageType;
switch (storageType)
{
case StorageType.Integer:
int iVal = param.AsInteger();
propertyValue = iVal.ToString();
break;
case StorageType.String:
String stringVal = param.AsString();
propertyValue = stringVal;
break;
case StorageType.Double:
Double dVal = param.AsDouble();
dVal = Math.Round(dVal, 2);
propertyValue = dVal.ToString();
break;
default:
break;
}
return propertyValue;
}
/// <summary>
/// calculate the area of rooms for each department
/// </summary>
/// <param name="deparName">the department name</param>
/// <param name="areaValue">the value of room area</param>
public void CalculateDepartmentArea(String deparName, Double areaValue)
{
//if the array list is empty add a new instance of DepartmentArea to the list
if (0 == m_departmentInfos.Count)
{
//create a new instance of DepartmentArea struct and insert it to the list
DepartmentInfo tmpDep = new DepartmentInfo(deparName, areaValue);
m_departmentInfos.Add(tmpDep);
}
else
{
int flag = 0;
//find whether the department exist in the project
for (int i = 0; i < m_departmentInfos.Count; i++)
{
if (deparName == m_departmentInfos[i].DepartmentName)
{
double tempValue = m_departmentInfos[i].DepartmentAreaValue + areaValue;
DepartmentInfo tempInstance = new DepartmentInfo(deparName, tempValue);
m_departmentInfos[i] = tempInstance;
flag = 1;
}
}
//if found a new department,
//create a new instance of DepartmentArea struct and insert it to the list
if (0 == flag)
{
DepartmentInfo tmpDep = new DepartmentInfo(deparName, areaValue);
m_departmentInfos.Add(tmpDep);
}
}
}
/// <summary>
/// export data into an Excel file
/// </summary>
/// <param name="fileName"></param>
public void ExportFile(String fileName)
{
//store all the information that to be exported
String allData = "";
//get the project title
String projectTitle = m_thisApp.ActiveUIDocument.Document.Title; //the name of the project
allData += "Total Rooms area of " + projectTitle + "\n";
allData += "Department" + "," + "Area" + "\n";
foreach (DepartmentInfo tmp in m_departmentInfos)
{
allData += tmp.DepartmentName + "," + tmp.DepartmentAreaValue + " SF\n";
}
//save the information into a Excel file
if (allData.Length > 0)
{
System.IO.StreamWriter exportinfo = new System.IO.StreamWriter(fileName);
exportinfo.WriteLine(allData);
exportinfo.Close();
}
}
}
}
@@ -0,0 +1,33 @@
using System;
namespace Rooms
{
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
[Autodesk.Revit.DB.Macros.AddInIdAttribute("51FFA7F2-0DA4-4D7B-8D7E-FED1897D4F8D")]
public partial class ThisApplication
{
private void Module_Startup(object sender, EventArgs e)
{
}
private void Module_Shutdown(object sender, EventArgs e)
{
}
#region Revit Macros generated code
private void InternalStartup()
{
this.Startup += new System.EventHandler(Module_Startup);
this.Shutdown += new System.EventHandler(Module_Shutdown);
}
#endregion
public void GetAllRoomsInformation()
{
SamplesRoom sampleRoom = new SamplesRoom(this);
sampleRoom.Run();
}
}
}
@@ -0,0 +1,79 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.3603
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Rooms {
///
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Applications.ProgrammingModel.dll", "9.0.0.0")]
public sealed partial class ThisApplication : Autodesk.Revit.UI.Macros.ApplicationEntryPoint {
public event System.EventHandler Startup;
public event System.EventHandler Shutdown;
///
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
private void OnStartup() {
Globals.ThisApplication = this;
}
///
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
protected override void FinishInitialization() {
base.FinishInitialization();
this.OnStartup();
this.InternalStartup();
if ((this.Startup != null)) {
this.Startup(this, System.EventArgs.Empty);
}
}
///
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
protected override void OnShutdown() {
if ((this.Shutdown != null)) {
this.Shutdown(this, System.EventArgs.Empty);
}
base.OnShutdown();
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
protected override string PrimaryCookie {
get {
return "ThisApplication";
}
}
}
///
public sealed partial class Globals {
private static ThisApplication _ThisApplication;
internal static ThisApplication ThisApplication {
get {
return _ThisApplication;
}
set {
if ((_ThisApplication == null)) {
_ThisApplication = value;
}
else {
throw new System.NotSupportedException();
}
}
}
}
}
Binary file not shown.