removed Revit 2021 SDK contents

This commit is contained in:
Jeremy Tammik
2021-04-20 11:25:53 +02:00
parent 68771b6636
commit 1133a82dc5
2969 changed files with 0 additions and 940446 deletions
Binary file not shown.
@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="AddInManager.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<userSettings>
<AddInManager.Properties.Settings>
<setting name="AppFolder" serializeAs="String">
<value>Revit Add-In Manager 2021</value>
</setting>
</AddInManager.Properties.Settings>
</userSettings>
</configuration>
Binary file not shown.
@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RevitAddIns>
<AddIn Type="Command">
<Assembly>[TARGETDIR]AddInManager.dll</Assembly>
<ClientId>8C0A9E25-B7C5-421c-A1AB-702F73FA551F</ClientId>
<FullClassName>AddInManager.CAddInManager</FullClassName>
<Text>Add-In Manager (Manual Mode)</Text>
<VisibilityMode>AlwaysVisible</VisibilityMode>
<LanguageType>Unknown</LanguageType>
<VendorId>ADSK</VendorId>
<VendorDescription>Autodesk, www.autodesk.com</VendorDescription>
</AddIn>
<AddIn Type="Command">
<Assembly>[TARGETDIR]AddInManager.dll</Assembly>
<ClientId>6FDB8EC7-CCD3-4fc0-ADB7-B459D298FB93</ClientId>
<FullClassName>AddInManager.CAddInManagerFaceless</FullClassName>
<Text>Add-In Manager (Manual Mode, Faceless)</Text>
<VisibilityMode>AlwaysVisible</VisibilityMode>
<LanguageType>Unknown</LanguageType>
<VendorId>ADSK</VendorId>
<VendorDescription>Autodesk, www.autodesk.com</VendorDescription>
</AddIn>
<AddIn Type="Command">
<Assembly>[TARGETDIR]AddInManager.dll</Assembly>
<ClientId>91A2419C-5FCA-491A-BAA3-29A497EC07C7</ClientId>
<FullClassName>AddInManager.CAddInManagerReadOnly</FullClassName>
<Text>Add-In Manager (ReadOnly Mode)</Text>
<VisibilityMode>AlwaysVisible</VisibilityMode>
<LanguageType>Unknown</LanguageType>
<VendorId>ADSK</VendorId>
<VendorDescription>Autodesk, www.autodesk.com</VendorDescription>
</AddIn>
</RevitAddIns>
@@ -1,22 +0,0 @@
Copyright (c) 2009, wyDay
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Binary file not shown.
Binary file not shown.
@@ -1,24 +0,0 @@
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
@@ -1,141 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<PropertyGroup>
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
None
</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
</PropertyGroup>
<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>C:\Program Files\Autodesk\Revit 2021\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>C:\Program Files\Autodesk\Revit 2021\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>
@@ -1,28 +0,0 @@
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.*")]
@@ -1,75 +0,0 @@
//------------------------------------------------------------------------------
// <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;
}
}
}
}
@@ -1,120 +0,0 @@
<?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>
@@ -1,31 +0,0 @@
//------------------------------------------------------------------------------
// <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;
}
}
}
}
@@ -1,7 +0,0 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
@@ -1,142 +0,0 @@
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");
}
}
}
@@ -1,79 +0,0 @@
//------------------------------------------------------------------------------
// <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();
}
}
}
}
}
@@ -1,24 +0,0 @@
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
@@ -1,156 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<PropertyGroup>
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
None
</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
</PropertyGroup>
<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>C:\Program Files\Autodesk\Revit 2021\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>C:\Program Files\Autodesk\Revit 2021\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>
@@ -1,36 +0,0 @@
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")>
@@ -1,61 +0,0 @@
'------------------------------------------------------------------------------
' <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
@@ -1,120 +0,0 @@
<?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>
@@ -1,38 +0,0 @@
'------------------------------------------------------------------------------
' <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
@@ -1,7 +0,0 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
@@ -1,80 +0,0 @@
'------------------------------------------------------------------------------
' <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
@@ -1,114 +0,0 @@
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
@@ -1,24 +0,0 @@
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
@@ -1,93 +0,0 @@
//
// (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
}
}
@@ -1,28 +0,0 @@
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.*")]
@@ -1,75 +0,0 @@
//------------------------------------------------------------------------------
// <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;
}
}
}
}
@@ -1,120 +0,0 @@
<?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>
@@ -1,31 +0,0 @@
//------------------------------------------------------------------------------
// <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;
}
}
}
}
@@ -1,7 +0,0 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
@@ -1,179 +0,0 @@
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);
}
}
}
}
}
@@ -1,248 +0,0 @@
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;
}
}
@@ -1,120 +0,0 @@
<?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>
@@ -1,177 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<PropertyGroup>
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
None
</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
</PropertyGroup>
<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>C:\Program Files\Autodesk\Revit 2021\RevitAPI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="RevitAPIUI">
<HintPath>C:\Program Files\Autodesk\Revit 2021\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>
@@ -1,419 +0,0 @@
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();
}
}
}
}
@@ -1,33 +0,0 @@
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();
}
}
}
@@ -1,79 +0,0 @@
//------------------------------------------------------------------------------
// <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.
@@ -1,22 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ContentGeneratorWPF", "ContentGeneratorWPF\ContentGeneratorWPF.csproj", "{F8801879-5494-40CD-833E-E497391037D1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F8801879-5494-40CD-833E-E497391037D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F8801879-5494-40CD-833E-E497391037D1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F8801879-5494-40CD-833E-E497391037D1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F8801879-5494-40CD-833E-E497391037D1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
@@ -1,136 +0,0 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{8F7B8416-87C0-40E4-8256-77A624DBA940}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>REX.Start</RootNamespace>
<AssemblyName>AREXStart</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>2.0</OldToolsVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="Autodesk.REX.Framework, Version=2018.0.0.0, Culture=neutral, PublicKeyToken=51e16e3b26b42eda, processorArchitecture=MSIL">
<SpecificVersion>True</SpecificVersion>
<HintPath>Autodesk.REX.Framework.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Design" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<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>
<DesignTime>True</DesignTime>
</Compile>
<None Include="app.config" />
<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>
</ItemGroup>
<ItemGroup>
<COMReference Include="stdole">
<Guid>{00020430-0000-0000-C000-000000000046}</Guid>
<VersionMajor>2</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
</COMReference>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
<Visible>False</Visible>
<ProductName>.NET Framework 2.0 %28x86%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
<Visible>False</Visible>
<ProductName>.NET Framework 3.0 %28x86%29</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\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>
-->
</Project>
@@ -1,52 +0,0 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Autodesk.REX.Framework;
namespace REX.Start
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
AppDomain currentDomain = AppDomain.CurrentDomain;
currentDomain.AssemblyResolve += new ResolveEventHandler(currentDomain_AssemblyResolve);
RunExtension(@"c:\my documents\visual studio 2015\Projects\ContentGeneratorWPF\ContentGeneratorWPF\bin\Debug\ContentGeneratorWPF.dll", "2018");
}
static System.Reflection.Assembly currentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
return Autodesk.REX.Framework.REXAssemblies.Resolve(sender, args, System.Reflection.Assembly.GetExecutingAssembly());
}
static void RunExtension(string FullPath, string VersionName)
{
REXApplicationInstance applicationInstance = new REXApplicationInstance();
if (applicationInstance.LoadExtension(FullPath, "REX.ContentGeneratorWPF.Application"))
{
REXContext context = new REXContext();
context.Control.Mode = REXMode.Dialog;
context.Control.ControlMode = REXControlMode.ModalDialog;
context.Product.Type = REXInterfaceType.Common;
context.Control.Parent = null;
REXEnvironment environment = new REXEnvironment(VersionName);
if (environment.LoadEngine(ref context))
{
if (applicationInstance.Extension.Create(ref context))
applicationInstance.Extension.Show();
}
}
}
}
}
@@ -1,33 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("AREXStart")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AREXStart")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("97ee349a-32da-4f6e-a2a0-c4b8cf3eff80")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -1,72 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.4952
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace StandaloneLauncher1.Properties
{
using System;
/// <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.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
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(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if (object.ReferenceEquals(resourceMan, null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("StandaloneLauncher1.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(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}
@@ -1,117 +0,0 @@
<?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.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: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" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</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" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -1,60 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.4952
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace StandaloneLauncher1.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string Assembly
{
get
{
return ((string)(this["Assembly"]));
}
set
{
this["Assembly"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string Namespace
{
get
{
return ((string)(this["Namespace"]));
}
set
{
this["Namespace"] = value;
}
}
}
}
@@ -1,12 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="StandaloneLauncher1.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="Assembly" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="Namespace" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>
@@ -1,18 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="REX.Start.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<userSettings>
<REX.Start.Properties.Settings>
<setting name="Assembly" serializeAs="String">
<value />
</setting>
<setting name="Namespace" serializeAs="String">
<value />
</setting>
</REX.Start.Properties.Settings>
</userSettings>
</configuration>
@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RevitAddIns>
<AddIn Type="Command">
<Assembly>P:\ContentGeneratorWPF\ContentGeneratorWPF\bin\Debug\ContentGeneratorWPF.dll</Assembly>
<ClientId>fa27b977-f7a1-4601-bce0-e5b93ba8a371</ClientId>
<FullClassName>REX.ContentGeneratorWPF.DirectRevitAccess</FullClassName>
<Text>ContentGeneratorWPF</Text>
<Description>ContentGeneratorWPF</Description>
<VendorId>ADSK</VendorId>
<VendorDescription>Autodesk, www.autodesk.com</VendorDescription>
</AddIn>
</RevitAddIns>
@@ -1,10 +0,0 @@
set SOURCE_PATH=
set DESTINATION_PATH=
if not exist "%DESTINATION_PATH%\ContentGeneratorWPF\ContentGeneratorWPF.dll" goto end
if not exist "%SOURCE_PATH%\ContentGeneratorWPF\ContentGeneratorWPF\bin\Debug\ContentGeneratorWPF.dll" goto end
copy "%SOURCE_PATH%\ContentGeneratorWPF\ContentGeneratorWPF\bin\Debug\ContentGeneratorWPF.dll" "%DESTINATION_PATH%\ContentGeneratorWPF\ContentGeneratorWPF.dll"
copy "%SOURCE_PATH%\ContentGeneratorWPF\ContentGeneratorWPF\bin\Debug\ContentGeneratorWPF.pdb" "%DESTINATION_PATH%\ContentGeneratorWPF\ContentGeneratorWPF.pdb"
:end
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<options product="REX" name="REX">
<option name="SDK" description="SDK" description_full="SDK" version="" domain="" date="">
<option name="ContentGeneratorWPF" description="ContentGeneratorWPF" description_full="ContentGeneratorWPF" version="0.5" domain="" date="" type="">
<data>
<data.run type="ASSEMBLY" path="ContentGeneratorWPF" file="ContentGeneratorWPF.dll" class="REX.ContentGeneratorWPF.Application" direct_revit_class="REX.ContentGeneratorWPF.DirectRevitAccess"/>
</data>
</option>
</option>
</options>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 940 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

@@ -1,52 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ROXML version="1.0">
<header>
<contents type="configuration" version="1.5"/>
<product type="component" category="library" technology=".net" name="REX" />
</header>
<settings>
<control>
<!--
version name
name = "", "2010", ....
-->
<version name="2012"/>
<!--
multi language architecture
suported = "true", "false"
-->
<languages supported="false"/>
<!--
user interface
supported = "true", "false"
-->
<userinterface supported="true" form="modal"/>
<!--
context settings
suported = "true", "false"
version = "", "2010", ....
optionlist = "subscription;..."
architecture = "x86", "x64"
parameters = "true", "false"
subname = "", some sub-product name
form = "modal" (""), "control", "non-modal"
-->
<context name="Civil3D" supported="false" form="non-modal" version="" optionlist="" architecture="" parameters="false"/>
<context name="Robot" supported="false" form="non-modal" version="" optionlist="" architecture="" parameters="false"/>
<context name="RCad" supported="false" form="non-modal" version="" optionlist="" architecture="" parameters="false"/>
<context name="Revit" subname="Structure" optionlist="" supported="true" version="" parameters="true"/>
<context name="Revit" subname="Architecture" optionlist="" supported="true" version="" parameters="true"/>
<context name="Revit" subname="MEP" optionlist="" supported="true" version="" parameters="true"/>
<context name="Revit" supported="true" form="modal" version="" optionlist="" architecture="" parameters="true"/>
</control>
</settings>
</ROXML>
@@ -1,346 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
None
</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
</PropertyGroup>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{F8801879-5494-40CD-833E-E497391037D1}</ProjectGuid>
<OutputType>library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>REX.ContentGeneratorWPF</RootNamespace>
<AssemblyName>ContentGeneratorWPF</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;TV2_0;TV1_5;REXUI;REXUIL2;REXEI;REVIT;$(AssemblyName)</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>
</DocumentationFile>
<PlatformTarget>AnyCPU</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;TV2_0;TV1_5;REXUI;REXUIL2;REXEI;REVIT;$(AssemblyName)</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Autodesk.Common.AResourcesControl, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff3304d4f320ee59, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>a:\references\Autodesk.Common.AResourcesControl.dll</HintPath>
</Reference>
<Reference Include="Autodesk.REX.Framework, Version=2018.0.0.0, Culture=neutral, PublicKeyToken=51e16e3b26b42eda, processorArchitecture=MSIL">
<SpecificVersion>True</SpecificVersion>
<HintPath>Autodesk.REX.Framework.dll</HintPath>
</Reference>
<Reference Include="Interop.ROHTMLLib">
<HintPath>C:\Program Files\Common Files\Autodesk Shared\Extensions 2018\Framework\Interop\Interop.ROHTMLLib.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="PresentationCore">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
<Reference Include="PresentationFramework">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
<Reference Include="RevitAPI">
<HintPath>C:\Program Files\Autodesk\Revit 2021\RevitAPI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="RevitAPIUI">
<HintPath>C:\Program Files\Autodesk\Revit 2021\RevitAPIUI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="REX.API">
<HintPath>C:\Program Files\Common Files\Autodesk Shared\Extensions 2018\Framework\Foundation\REX.API.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="REX.ContentGeneratorLT">
<HintPath>C:\Program Files\Common Files\Autodesk Shared\Extensions 2018\Framework\Components\AREXContentGenerator\REX.ContentGeneratorLT.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="REX.Controls">
<HintPath>C:\Program Files\Common Files\Autodesk Shared\Extensions 2018\Framework\Engine\REX.Controls.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="REX.Controls.WPF">
<HintPath>C:\Program Files\Common Files\Autodesk Shared\Extensions 2018\Framework\Engine\REX.Controls.WPF.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="REX.Foundation">
<HintPath>C:\Program Files\Common Files\Autodesk Shared\Extensions 2018\Framework\Foundation\REX.Foundation.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="REX.Foundation.WPF">
<HintPath>C:\Program Files\Common Files\Autodesk Shared\Extensions 2018\Framework\Foundation\REX.Foundation.WPF.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="REX.Geometry">
<HintPath>C:\Program Files\Common Files\Autodesk Shared\Extensions 2018\Framework\Foundation\REX.Geometry.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Runtime.Remoting" />
<Reference Include="System.Windows.Presentation">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Xaml" />
<Reference Include="System.Xml" />
<Reference Include="UIAutomationProvider">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Main\PropertyItem.cs" />
<Compile Include="Main\Triangle.cs" />
<Compile Include="Module\Application.cs" />
<Compile Include="Module\DirectAccess.cs" />
<Compile Include="Module\Foundation.cs" />
<Compile Include="Main\Data.cs" />
<Compile Include="Main\Revit\ExtensionRevit.cs" />
<Compile Include="Main\Extension.cs" />
<Compile Include="Main\Settings.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Resources\Dialogs\ContentGeneratorCreateControl.xaml.cs">
<DependentUpon>ContentGeneratorCreateControl.xaml</DependentUpon>
</Compile>
<Compile Include="Resources\Dialogs\ContentGeneratorReadControl.xaml.cs">
<DependentUpon>ContentGeneratorReadControl.xaml</DependentUpon>
</Compile>
<Compile Include="Resources\Dialogs\MainControl.xaml.cs">
<DependentUpon>MainControl.xaml</DependentUpon>
</Compile>
<Compile Include="Resources\Dialogs\MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Resources\Dialogs\PolygonViewer.xaml.cs">
<DependentUpon>PolygonViewer.xaml</DependentUpon>
</Compile>
<Compile Include="Resources\Dialogs\PropertiesControl.xaml.cs">
<DependentUpon>PropertiesControl.xaml</DependentUpon>
</Compile>
<Compile Include="Resources\Dialogs\PropertyControl.xaml.cs">
<DependentUpon>PropertyControl.xaml</DependentUpon>
</Compile>
<Compile Include="Resources\Dialogs\SelectedElementControl.xaml.cs">
<DependentUpon>SelectedElementControl.xaml</DependentUpon>
</Compile>
<Compile Include="Resources\Dialogs\UserControlView.xaml.cs">
<DependentUpon>UserControlView.xaml</DependentUpon>
</Compile>
<Compile Include="Resources\Strings\Texts.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Texts.resx</DependentUpon>
</Compile>
<Compile Include="Main\Results.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\Strings\Texts.resx">
<SubType>Designer</SubType>
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Texts.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Other\Images\TOOLBAR_help.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Other\Images\TOOLBAR_info.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Other\Images\bmp_I.png" />
<Resource Include="Resources\Other\Images\bmp_L.png" />
<Resource Include="Resources\Other\Images\bmp_RECT.png" />
<None Include="Additional\AREXStart\AREXStart.csproj" />
<None Include="Additional\AREXStart\app.config" />
<None Include="Additional\AREXStart\Program.cs" />
<None Include="Additional\AREXStart\Properties\AssemblyInfo.cs" />
<None Include="Additional\AREXStart\Properties\Resources.Designer.cs" />
<None Include="Additional\AREXStart\Properties\Settings.Designer.cs" />
<None Include="Additional\AREXStart\Properties\Resources.resx" />
<None Include="Additional\AREXStart\Properties\Settings.settings" />
<None Include="Additional\buildevents.bat" />
<EmbeddedResource Include="Resources\Other\Images\REX.ico" />
<Resource Include="Resources\Other\Images\REX_logo.png" />
<Resource Include="Resources\Other\Images\TOOLBAR_calculate.png" />
<Resource Include="Resources\Other\Images\TOOLBAR_close.png" />
<Resource Include="Resources\Other\Images\TOOLBAR_open.png" />
<Resource Include="Resources\Other\Images\TOOLBAR_print.png" />
<Resource Include="Resources\Other\Images\TOOLBAR_save.png" />
<Resource Include="Resources\Other\Images\TOOLBAR_save_as.png" />
<Content Include="Additional\ContentGeneratorWPF.addin" />
<Content Include="Configuration\REX.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Configuration\REX_small.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Configuration\REX_tooltip.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Configuration\REX_revit.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Configuration\settings.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="en-US\REX_revit.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="pl-PL\REX_revit.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Resource Include="Resources\Other\Images\TOOLBAR_rs.png" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
<Visible>False</Visible>
<ProductName>.NET Framework 2.0 %28x86%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
<Visible>False</Visible>
<ProductName>.NET Framework 3.0 %28x86%29</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<Page Include="Resources\Dialogs\ContentGeneratorCreateControl.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Resources\Dialogs\ContentGeneratorReadControl.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Resources\Dialogs\MainControl.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Resources\Dialogs\MainWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Resources\Dialogs\PolygonViewer.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Resources\Dialogs\PropertiesControl.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Resources\Dialogs\PropertyControl.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Resources\Dialogs\SelectedElementControl.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Resources\Dialogs\UserControlView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildBinPath)\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>
-->
<PropertyGroup>
<PostBuildEvent>
if not exist "q:\exe.$(ConfigurationName)" goto InstalledSDK
md "q:\exe.$(ConfigurationName)"
md "q:\exe.$(ConfigurationName)\Modules"
md "q:\exe.$(ConfigurationName)\Modules\$(ProjectName)"
del "q:\exe.$(ConfigurationName)\Modules\$(ProjectName)\$(TargetFileName)"
copy "$(TargetPath)" "q:\exe.$(ConfigurationName)\Modules\$(ProjectName)\$(TargetFileName)"
copy "$(TargetDir)Interop.*.dll" "q:\exe.$(ConfigurationName)\Modules\$(ProjectName)\"
goto END
:InstalledSDK
:END
if exist "$(ProjectDir)Additional\buildevents.bat" call "$(ProjectDir)Additional\buildevents.bat"
xcopy "$(ProjectDir)Additional\*.addin" "R:\Autodesk\Revit\Addins\2018" /S /R /K /V /I /F /C /Y
</PostBuildEvent>
</PropertyGroup>
</Project>
@@ -1,331 +0,0 @@
//
// (C) Copyright 2007-2011 by Autodesk, Inc. All rights reserved.
//
// 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 ITS 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.
/// <summary>
/// </summary>
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using Autodesk.REX.Framework;
using REX.Common;
namespace REX.ContentGeneratorWPF
{
[Serializable]
internal class DataSerializable : REXExtensionDataSerializable
{
/// <summary>
/// Initializes a new instance of the <see cref="DataSerializable"/> class.
/// </summary>
public DataSerializable()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="REXExtensionDataSerializable"/> class.
/// A required constructor by ISerializable to deserialize the object. It is important to implement
/// this required constructor. Note that no warning will be given if this constructor is absent and
/// an exception will be thrown if you attempt to deserialize this object.
/// It is a good idea to make the constructor protected unless the class was sealed, in which case
/// the constructor should be marked as private. Making the constructor protected ensures that users
/// cannot explicitly call this constructor while still allowing derived classes to call it. The same
/// logic applies if this class was sealed except that there will be no derived classes.
/// </summary>
/// <example>
/// <code>
/// protected REXExtensionDataSerializable(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext ctx)
/// {
/// strPrivate = info.GetString( "s1" );
/// strPublic = info.GetString( "s2" );
/// obMyClass = (SomeClass) info.GetValue( "ob", typeof(SomeClass) ); // deserializing an object
/// }
/// </code>
/// </example>
/// <param name="info">The info.</param>
/// <param name="ctx">The CTX.</param>
protected DataSerializable(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext ctx)
{
}
/// <summary>
/// A required method by ISerializable to serialize the object. Simply add variables to be serialized
/// as name/value pairs to SerializationInfo object. Here you decide which member variables to serialize.
/// Note that any name can be used to identify each serialized field
/// </summary>
/// <example>
/// <code>
/// public virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext ctx)
/// {
/// info.AddValue("s1", strPrivate);
/// info.AddValue("s2", strPublic);
/// into.AddValue("ob", obMyClass); // Serializing an object
/// }
/// </code>
/// </example>
/// <param name="info">The info.</param>
/// <param name="ctx">The CTX.</param>
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext ctx)
{
}
/// <summary>
/// Sets the data reference.
/// </summary>
/// <param name="data">The data.</param>
public void SetDataReference(Data data)
{
DataRef = data;
}
private Data DataRef;
}
/// <summary>
/// Main data class to store all data in REX base units.
/// </summary>
internal class Data : REXData
{
#region members
/// <summary>
/// Gets or sets the selected element.
/// </summary>
/// <value>The selected element.</value>
public Autodesk.Revit.DB.FamilyInstance SelectedElement { get; set; }
/// <summary>
/// Gets or sets the selected element properties.
/// </summary>
/// <value>The selected element properties.</value>
public List<Main.PropertyItem> SelectedElementProperties { get; set; }
/// <summary>
/// Gets or sets the selected elements geometry.
/// </summary>
/// <value>The selected elements geometry.</value>
public List<Main.Triangle> SelectedElementGeometry { get; set; }
/// <summary>
/// Gets or sets the database section representation.
/// </summary>
/// <value>The database section.</value>
public REX.ContentGenerator.Families.REXFamilyType_DBSection DatabaseSection { get; set; }
/// <summary>
/// Gets or sets the database records (where the DatabaseSection was found).
/// </summary>
/// <value>The database records.</value>
public List<REX.ContentGenerator.Families.REXDBDescription> DatabaseRecords { get; set; }
/// <summary>
/// Gets or sets the parametric section representation.
/// </summary>
/// <value>The parametric section.</value>
public REX.ContentGenerator.Families.REXFamilyType_ParamSection ParametricSection { get; set; }
/// <summary>
/// Gets or sets the section which will be applied to the selected element.
/// </summary>
/// <value>The new section.</value>
public REX.ContentGenerator.Families.REXFamilyType_Section NewSection { get; set; }
/// <summary>
/// Gets or sets the FamilySymbol which will be applied to the selected element (created based on NewSection).
/// </summary>
/// <value>The new family symbol.</value>
public Autodesk.Revit.DB.FamilySymbol NewFamilySymbol { get; set; }
#endregion
/// <summary>
/// Initializes a new instance of a <see cref="Data"/> class.
/// </summary>
/// <param name="Ext">The reference to REXExtension object.</param>
public Data(REXExtension Ext)
: base(Ext)
{
VersionCurrent = 1;
DataSerializableRef = new DataSerializable();
}
/// <summary>
/// Get the main extension.
/// </summary>
/// <value>The main extension.</value>
public Extension ThisMainExtension
{
get
{
return (Extension)ThisExtension;
}
}
/// <summary>
/// Called when set defaults.
/// </summary>
/// <param name="UnitsSystem">The units system.</param>
/// <example>
/// <code>
/// #region Structures
/// public double A;
/// public double B;
/// public double C;
/// #endregion
///
/// protected override void OnSetDefaults(REXUnitsSystemType UnitsSystem)
/// {
/// if (UnitsSystem == REXUnitsSystemType.Imperial)
/// {
/// A = 10;
/// B = 10;
/// C = 10;
/// }
/// else if (UnitsSystem == REXUnitsSystemType.Metric)
/// {
/// A = ThisExtension.Units.BaseFromInterface(20, REXUnits.EnumUnits.Dimensions_SectionDim);
/// B = ThisExtension.Units.BaseFromInterface(20, REXUnits.EnumUnits.Dimensions_ConnectionDim);
/// C = ThisExtension.Units.BaseFromInterface(20, REXUnits.EnumUnits.Forces_Force);
/// }
/// }
/// </code>
/// </example>
protected override void OnSetDefaults(REXUnitsSystemType UnitsSystem)
{
if (UnitsSystem == REXUnitsSystemType.Imperial)
{
}
else if (UnitsSystem == REXUnitsSystemType.Metric)
{
}
}
/// <summary>
/// Called when save data.
/// </summary>
/// <param name="Data">The data.</param>
/// <returns>Returns true if succeeded.</returns>
/// <example>
/// <code>
///protected override bool OnSave(ref BinaryWriter Data)
///{
/// if (Mode == DataMode.ModeFile)
/// {
/// }
/// if (Mode == DataMode.ModeProject)
/// {
/// }
/// if (Mode == DataMode.ModeObject)
/// {
/// }
///
/// Data.Write(A);
/// Data.Write(B);
/// Data.Write(C);
///
/// return true;
///}
/// </code>
/// </example>
protected override bool OnSave(ref BinaryWriter Data)
{
if (Mode == DataMode.ModeFile)
{
}
if (Mode == DataMode.ModeProject)
{
}
if (Mode == DataMode.ModeObject)
{
}
return true;
}
/// <summary>
/// Called when load data.
/// </summary>
/// <param name="Data">The data.</param>
/// <returns>Returns true if succeeded.</returns>
/// <example>
/// <code>
/// protected override bool OnLoad(ref BinaryReader Data)
/// {
/// if (Mode == DataMode.ModeFile)
/// {
/// }
/// if (Mode == DataMode.ModeProject)
/// {
/// }
/// if (Mode == DataMode.ModeObject)
/// {
/// }
///
/// if (VersionLoaded >= 1)
/// {
/// A = Data.ReadDouble();
/// B = Data.ReadDouble();
/// C = Data.ReadDouble();
/// }
///
/// return true;
/// }
/// </code>
/// </example>
protected override bool OnLoad(ref BinaryReader Data)
{
if (Mode == DataMode.ModeFile)
{
}
if (Mode == DataMode.ModeProject)
{
}
if (Mode == DataMode.ModeObject)
{
}
if (VersionLoaded >= 1)
{
}
return true;
}
/// <summary>
/// Called when save data.
/// </summary>
/// <param name="Data">The data.</param>
/// <returns>Returns true if succeeded.</returns>
protected override bool OnSave(ref Stream DataStream, ref System.Runtime.Serialization.IFormatter DataFormater)
{
if (DataSerializableRef != null)
DataFormater.Serialize(DataStream, DataSerializableRef);
return true;
}
/// <summary>
/// Called when load data.
/// </summary>
/// <param name="Data">The data.</param>
/// <returns>Returns true if succeeded.</returns>
protected override bool OnLoad(ref Stream DataStream, ref System.Runtime.Serialization.IFormatter DataFormater)
{
DataSerializableRef = (DataSerializable)DataFormater.Deserialize(DataStream);
return true;
}
internal DataSerializable DataSerializableRef;
}
}
@@ -1,594 +0,0 @@
//
// (C) Copyright 2007-2011 by Autodesk, Inc. All rights reserved.
//
// 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 ITS 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.Collections.Generic;
using System.Text;
using System.Windows;
using System.Threading;
using System.Reflection;
using REX.Common;
using Autodesk.REX.Framework;
namespace REX.ContentGeneratorWPF
{
/// <summary>
/// Main class for development.
/// </summary>
internal class Extension : REXExtension
{
/// <summary>
/// Initializes a new instance of the <see cref="Extension"/> class.
/// </summary>
/// <param name="App">The reference to REXApplication object.</param>
public Extension(REXApplication App)
: base(App)
{
DataRef = new Data(this);
ResultsRef = new Results(this);
}
/// <summary>
/// For standard funcionality fill following methods.
/// </summary>
#region Public overrided methods for develeopment
/// <summary>
/// Called when Initialize.
/// Creates dedicated extension class according main context.
/// </summary>
/// <returns>Returns true if succeeded.</returns>
public override bool OnInitialize()
{
if (ThisApplication.Context2.Product.Type == REXInterfaceType.Revit)
ExtensionRef = new Main.Revit.ExtensionRevit(this);
if (ExtensionRef != null)
{
if (!ExtensionRef.OnInitialize())
return false;
}
Converter = new REX.ContentGenerator.Converters.REXFamilyConverter();
return base.OnInitialize();
}
/// <summary>
/// Creates needed structures and verify needs.
/// </summary>
public override void OnCreate()
{
base.OnCreate();
// insert code here.
if (ExtensionRef != null)
ExtensionRef.OnCreate();
}
/// <summary>
/// Creates sub dialog.
/// </summary>
public override void OnCreateDialogs()
{
base.OnCreateDialogs();
SelectedElementControlRef = new REX.ContentGeneratorWPF.Resources.Dialogs.SelectedElementControl(this);
CGReadControlRef = new REX.ContentGeneratorWPF.Resources.ContentGeneratorReadControl(this);
CGCreateControlRef = new REX.ContentGeneratorWPF.Resources.Dialogs.ContentGeneratorCreateControl(this);
if (ExtensionRef != null)
ExtensionRef.OnCreateDialogs();
}
/// <summary>
/// Creates layout items and setups layout.
/// </summary>
public override void OnCreateLayout()
{
base.OnCreateLayout();
System.SetCaption();
global::System.Windows.Media.Imaging.BitmapImage logoImage = REXLibrary.GetResourceImage(GetType().Assembly, "Resources/Other/Images/REX_logo.png");
// UI.SetLogo(logoImage);
Layout.ConstOptions = (long)REXUI.SetupOptions.HSplitFixed
| (long)REXUI.SetupOptions.VSplitFixed
| (long)REXUI.SetupOptions.TabDialog
| (long)REXUI.SetupOptions.List
| (long)REXUI.SetupOptions.FormFixed;
Layout.AddLayout(new REXLayoutItem(REXLayoutItem.LayoutType.Layout, "Element", "", "Element", (long)0, SelectedElementControlRef, null, logoImage));
Layout.AddLayout(new REXLayoutItem(REXLayoutItem.LayoutType.Layout, "Recognition", "", "Recognition", (long)0, CGReadControlRef, null, logoImage));
Layout.AddLayout(new REXLayoutItem(REXLayoutItem.LayoutType.Layout, "Creation", "", "Creation", (long)0, CGCreateControlRef, null, logoImage));
// insert code here.
if (ExtensionRef != null)
ExtensionRef.OnCreateLayout();
SelectedElementControlRef.SetDialog();
CGReadControlRef.SetDialog();
CGCreateControlRef.SetDialog();
}
/// <summary>
/// Set data on dialogs.
/// </summary>
public override void OnSetDialogs()
{
base.OnSetDialogs();
// insert code here.
Layout.SelectLayout("L1");
if (ExtensionRef != null)
ExtensionRef.OnSetDialogs();
}
/// <summary>
/// Get data from dialogs and sets Data's strucutres.
/// </summary>
public override void OnSetData()
{
base.OnSetData();
CGCreateControlRef.SetData();
if (ExtensionRef != null)
ExtensionRef.OnSetData();
}
/// <summary>
/// Called when data are loaded.
/// </summary>
/// <returns>Returns true if succeeded.</returns>
public override bool OnDataLoad()
{
return true;
}
/// <summary>
/// Called when data loaded.
/// </summary>
/// <param name="Result">If set to <c>true</c> operation succeeded; Otherwise some errors found.</param>
public override void OnDataLoaded(bool Result)
{
}
/// <summary>
/// Called when data are saved.
/// </summary>
/// <returns>Returns true if succeeded.</returns>
public override bool OnDataSave()
{
return true;
}
/// <summary>
/// Called when data are saved.
/// </summary>
/// <param name="Result">If set to <c>true</c> operation succeeded; Otherwise some errors found.</param>
public override void OnDataSaved(bool Result)
{
}
/// <summary>
/// Called when data are cleared.
/// </summary>
/// <param name="Implemented">If returns <c>true</c> method was implemented.</param>
/// <returns>Returns result of clear operation.</returns>
public override bool OnClear(out bool Implemented)
{
Implemented = false;
return true;
}
/// <summary>
/// Called when template is loaded.
/// Only if <c>ExtensionContext.Control.StandardRunContext</c> is equals to <c>REXExtensionContext.REXStandardRunContext.OperationEditTemplate</c>.
/// </summary>
/// <param name="Result">If set to <c>true</c> operation succeeded; Otherwise some errors found.</param>
public override bool OnLoadTemplate()
{
return true;
}
/// <summary>
/// Called when template is saved.
/// </summary>
/// <param name="Result">If set to <c>true</c> operation succeeded; Otherwise some errors found.</param>
public override bool OnSaveTemplate()
{
return true;
}
/// <summary>
/// Checks status of module and shows some information for user if module can't excecute action.
/// </summary>
/// <returns>Returns true if module can do some action in OnRun method; otherwise false.</returns>
public override bool OnCanRun()
{
bool result = true;
if (ExtensionRef != null)
result &= ExtensionRef.OnCanRun();
// insert code here.
return result;
}
/// <summary>
/// Runs process calculations or other operations.
/// </summary>
public override void OnRun()
{
base.OnRun();
// insert code here.
if (ExtensionRef != null)
ExtensionRef.OnRun();
}
/// <summary>
/// Shows results.
/// </summary>
public override void OnShowResults()
{
base.OnShowResults();
// insert code here.
if (ExtensionRef != null)
ExtensionRef.OnShowResults();
}
/// <summary>
/// If returns true dialog will close after OK button is clicked.
/// </summary>
/// <param name="Type">The closing type. See <see cref="REXCanCloseType"/> enum.</param>
/// <returns>Returns true if module can be closed.</returns>
public override bool OnCanClose(REXCanCloseType Type)
{
bool result = true;
if (ExtensionRef != null)
result &= ExtensionRef.OnCanClose(Type);
return result;
}
/// <summary>
/// Called during closing module.
/// </summary>
public override void OnClose()
{
base.OnClose();
// insert code here.
if (ExtensionRef != null)
ExtensionRef.OnClose();
}
/// <summary>
/// Activates or deactivates layout - module can modify layout before or after activation.
/// </summary>
/// <param name="LItem">The layout item.</param>
/// <param name="Activate">If set to <c>true</c> activate.</param>
public override void OnActivateLayout(REXLayoutItem LItem, bool Activate)
{
base.OnActivateLayout(LItem, Activate);
// insert code here.
if (ExtensionRef != null)
ExtensionRef.OnActivateLayout(LItem, Activate);
}
/// <summary>
/// Called when an error is selected on errors list dialog.
/// Raises the <see cref="ErrorSelected"/> event.
/// </summary>
/// <param name="e">The <see cref="Autodesk.REX.Framework.REXErrorsEventArgs"/> instance containing the event data.</param>
public override void OnErrorSelected(REXErrorsEventArgs e)
{
base.OnErrorSelected(e);
// insert code here.
if (ExtensionRef != null)
ExtensionRef.OnErrorSelected(e);
}
/// <summary>
/// Called when preferences changed.
/// </summary>
public override void OnPreferencesChanged()
{
DFM.BeforeParamsChange();
base.OnPreferencesChanged();
// insert code here.
if (ExtensionRef != null)
ExtensionRef.OnPreferencesChanged();
DFM.AfterParamsChange();
}
/// <summary>
/// Get specified text from resources. Needed for obfuscated strings tables.
/// </summary>
/// <param name="Name">The name of string.</param>
/// <returns>Returns specified text.</returns>
public override string OnGetText(string Name)
{
if (Name == REXConst.ENG_ResModuleDescription)
return Resources.Strings.Texts.REX_ModuleDescription;
if (Name == REXConst.ENG_ResVersionInfo)
return Resources.Strings.Texts.REX_VersionInfo;
// insert code here.
if (ExtensionRef != null)
{
string result = ExtensionRef.OnGetText(Name);
if (!string.IsNullOrEmpty(result))
return result;
}
return Resources.Strings.Texts.ResourceManager.GetString(Name);
}
/// <summary>
/// Commands the specified command struct.
/// </summary>
/// <param name="CommandStruct">The command struct.</param>
/// <returns>Returns result of event operation.</returns>
public override object OnCommand(ref REXCommand CommandStruct)
{
object result = null;
if (ExtensionRef != null)
result = ExtensionRef.OnCommand(ref CommandStruct);
// insert code here.
if (result == null)
return base.OnCommand(ref CommandStruct);
else
return result;
}
/// <summary>
/// Called when event.
/// </summary>
/// <param name="EventStruct">The event struct.</param>
/// <returns>Returns result of event operation.</returns>
public override object OnEvent(ref REXEvent EventStruct)
{
object result = null;
if (ExtensionRef != null)
result = ExtensionRef.OnEvent(ref EventStruct);
// insert code here.
if (result == null)
return base.OnEvent(ref EventStruct);
else
return result;
}
/// <summary>
/// Commands the specified command struct.
/// </summary>
/// <param name="CommandStruct">The command struct.</param>
/// <returns>Returns result of event operation.</returns>
public override object Command(ref REXCommand CommandStruct)
{
// insert code here.
return base.Command(ref CommandStruct);
}
/// <summary>
/// Events the specified event struct.
/// </summary>
/// <param name="EventStruct">The event struct.</param>
/// <returns>Returns result of event operation.</returns>
public override object Event(ref REXEvent EventStruct)
{
// insert code here.
return base.Event(ref EventStruct);
}
#endregion
/// <summary>
/// For non standard funcionality fill following methods.
/// </summary>
#region Public overrided methods for develeopment
/// <summary>
/// Create all needed objects
/// </summary>
public override bool Create()
{
bool result = base.Create();
// insert code here.
return result;
}
/// <summary>
/// Creates all needed references and data.
/// </summary>
public override void Setup()
{
base.Setup();
// insert code here.
}
#endregion
#region Public overrided UI methods - Form and Control reference
/// <summary>
/// Get reference to main control which will be embedded on MainForm.
/// </summary>
/// <returns>Returns reference to MainControl object based on REXExtensionControl.</returns>
public Resources.Dialogs.MainControl MainControl()
{
if (object.ReferenceEquals(ControlRef, null))
ControlRef = new Resources.Dialogs.MainControl(this);
return ControlRef;
}
/// <summary>
/// Get reference to main form.
/// </summary>
/// <returns>Returns reference to MainForm object based on REXExtensionForm.</returns>
public override REXExtensionWindow GetWindow()
{
if (object.ReferenceEquals(WindowRef, null))
WindowRef = new Resources.Dialogs.MainWindow(this);
return (REXExtensionWindow)WindowRef;
}
/// <summary>
/// Get the main control. Internally calls <see cref="MainControl()"/> method.
/// </summary>
/// <returns>Returns reference to MainControl object based on REXExtensionControl.</returns>
public override REXExtensionControl GetControl()
{
return MainControl();
}
#endregion
#region Public overrided data and results
/// <summary>
/// Get the data.
/// </summary>
/// <value>The data.</value>
public Data Data
{
get
{
return DataRef;
}
}
/// <summary>
/// Get the results.
/// </summary>
/// <value>The results.</value>
public Results Results
{
get
{
return ResultsRef;
}
}
/// <summary>
/// Get the API.
/// </summary>
/// <returns>Returns reference to main API object.</returns>
public override Object GetAPI()
{
return null;
}
/// <summary>
/// Get the results.
/// </summary>
/// <returns>Returns reference to object based on REXResults object.</returns>
public override REXResults GetResults()
{
return ResultsRef;
}
/// <summary>
/// Gets the data.
/// </summary>
/// <returns>Returns reference to object based on REXData object.</returns>
public override REXData GetData()
{
return DataRef;
}
/// <summary>
/// Get the settings.
/// </summary>
/// <returns>Returns reference to object based on REXExtensionSettings object.</returns>
public override REXExtensionSettings GetSettings()
{
if (ExtensionSettingsRef == null)
ExtensionSettingsRef = new ExtensionSettings(this);
return ExtensionSettingsRef;
}
#endregion
//DOM-IGNORE-BEGIN
#region Private members
private Data DataRef;
private Results ResultsRef;
private Resources.Dialogs.MainWindow WindowRef;
private Resources.Dialogs.MainControl ControlRef;
private Resources.Dialogs.SelectedElementControl SelectedElementControlRef;
private REX.ContentGeneratorWPF.Resources.ContentGeneratorReadControl CGReadControlRef;
private REX.ContentGeneratorWPF.Resources.Dialogs.ContentGeneratorCreateControl CGCreateControlRef;
private ExtensionSettings ExtensionSettingsRef;
private IREXExtension ExtensionRef;
#endregion
#region public members
public REX.ContentGenerator.Converters.REXFamilyConverter Converter { get; set; }
#endregion
//DOM-IGNORE-END
}
}
@@ -1,44 +0,0 @@
//
// (C) Copyright 2007-2011 by Autodesk, Inc. All rights reserved.
//
// 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 ITS 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.Collections.Generic;
using System.Linq;
using System.Text;
namespace REX.ContentGeneratorWPF.Main
{
/// <summary>
/// Represents the property of any type characterized by Name and Value.
/// </summary>
public class PropertyItem
{
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
/// <summary>
/// Gets or sets the value.
/// </summary>
/// <value>The value.</value>
public string Value { get; set; }
}
}
@@ -1,288 +0,0 @@
//
// (C) Copyright 2007-2011 by Autodesk, Inc. All rights reserved.
//
// 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 ITS 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.
/// <summary>
/// </summary>
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.IO;
using Autodesk.REX.Framework;
using REX.Common;
namespace REX.ContentGeneratorWPF
{
[Serializable]
internal class ResultsSerializable : REXExtensionDataSerializable
{
/// <summary>
/// Initializes a new instance of the <see cref="ResultsSerializable"/> class.
/// </summary>
public ResultsSerializable()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="REXExtensionDataSerializable"/> class.
/// A required constructor by ISerializable to deserialize the object. It is important to implement
/// this required constructor. Note that no warning will be given if this constructor is absent and
/// an exception will be thrown if you attempt to deserialize this object.
/// It is a good idea to make the constructor protected unless the class was sealed, in which case
/// the constructor should be marked as private. Making the constructor protected ensures that users
/// cannot explicitly call this constructor while still allowing derived classes to call it. The same
/// logic applies if this class was sealed except that there will be no derived classes.
/// </summary>
/// <example>
/// <code>
/// protected REXExtensionDataSerializable(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext ctx)
/// {
/// strPrivate = info.GetString( "s1" );
/// strPublic = info.GetString( "s2" );
/// obMyClass = (SomeClass) info.GetValue( "ob", typeof(SomeClass) ); // deserializing an object
/// }
/// </code>
/// </example>
/// <param name="info">The info.</param>
/// <param name="ctx">The CTX.</param>
protected ResultsSerializable(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext ctx)
{
}
/// <summary>
/// A required method by ISerializable to serialize the object. Simply add variables to be serialized
/// as name/value pairs to SerializationInfo object. Here you decide which member variables to serialize.
/// Note that any name can be used to identify each serialized field
/// </summary>
/// <example>
/// <code>
/// public virtual void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext ctx)
/// {
/// info.AddValue("s1", strPrivate);
/// info.AddValue("s2", strPublic);
/// into.AddValue("ob", obMyClass); // Serializing an object
/// }
/// </code>
/// </example>
/// <param name="info">The info.</param>
/// <param name="ctx">The CTX.</param>
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext ctx)
{
}
/// <summary>
/// Sets the results reference.
/// </summary>
/// <param name="results">The results.</param>
internal void SetResultsReference(Results results)
{
ResultsRef = results;
}
private Results ResultsRef;
}
/// <summary>
/// Main data class to store all results in REX base units.
/// </summary>
internal class Results : REXResults
{
/// <summary>
/// Initializes a new instance of a <see cref="Results"/> class.
/// </summary>
/// <param name="Ext">The reference to REXExtension object.</param>
public Results(REXExtension Ext)
: base(Ext)
{
VersionCurrent = 1;
ResultsSerializableRef = new ResultsSerializable();
}
/// <summary>
/// Get the main extension.
/// </summary>
/// <value>The main extension.</value>
internal Extension ThisMainExtension
{
get
{
return (Extension)ThisExtension;
}
}
/// <summary>
/// Called when [set defaults].
/// </summary>
/// <param name="UnitsSystem">The units system.</param>
/// <summary>
/// Called when set defaults.
/// </summary>
/// <param name="UnitsSystem">The units system.</param>
/// <example>
/// <code>
/// #region Structures
/// public double C;
/// public double D;
/// #endregion
///
/// protected override void OnSetDefaults(REXUnitsSystemType UnitsSystem)
/// {
/// if (UnitsSystem == REXUnitsSystemType.Imperial)
/// {
/// C = 0;
/// D = 0;
/// }
/// else if (UnitsSystem == REXUnitsSystemType.Metric)
/// {
/// C = 0;
/// D = 0;
/// }
/// }
/// </code>
/// </example>
protected override void OnSetDefaults(REXUnitsSystemType UnitsSystem)
{
if (UnitsSystem == REXUnitsSystemType.Imperial)
{
}
else if (UnitsSystem == REXUnitsSystemType.Metric)
{
}
}
/// <summary>
/// Called when save data.
/// </summary>
/// <param name="Data">The data.</param>
/// <returns>Returns true if succeeded.</returns>
/// <example>
/// <code>
///protected override bool OnSave(ref BinaryWriter Data)
///{
/// if (Mode == DataMode.ModeFile)
/// {
/// }
/// if (Mode == DataMode.ModeProject)
/// {
/// }
/// if (Mode == DataMode.ModeObject)
/// {
/// }
///
/// Data.Write(C);
/// Data.Write(D);
///
/// return true;
///}
/// </code>
/// </example>
protected override bool OnSave(ref BinaryWriter Data)
{
if (Mode == DataMode.ModeFile)
{
}
if (Mode == DataMode.ModeProject)
{
}
if (Mode == DataMode.ModeObject)
{
}
return true;
}
/// <summary>
/// Called when load data.
/// </summary>
/// <param name="Data">The data.</param>
/// <returns>Returns true if succeeded.</returns>
/// <example>
/// <code>
/// protected override bool OnLoad(ref BinaryReader Data)
/// {
/// if (Mode == DataMode.ModeFile)
/// {
/// }
/// if (Mode == DataMode.ModeProject)
/// {
/// }
/// if (Mode == DataMode.ModeObject)
/// {
/// }
///
/// if (VersionLoaded >= 1)
/// {
/// C = Data.ReadDouble();
/// D = Data.ReadDouble();
/// }
///
/// return true;
/// }
/// </code>
/// </example>
protected override bool OnLoad(ref BinaryReader Data)
{
if (Mode == DataMode.ModeFile)
{
}
if (Mode == DataMode.ModeProject)
{
}
if (Mode == DataMode.ModeObject)
{
}
if (VersionLoaded >= 1)
{
}
return true;
}
/// <summary>
/// Called when save data.
/// </summary>
/// <param name="Data">The data.</param>
/// <returns>Returns true if succeeded.</returns>
protected override bool OnSave(ref Stream DataStream, ref System.Runtime.Serialization.IFormatter DataFormater)
{
if (ResultsSerializableRef != null)
DataFormater.Serialize(DataStream, ResultsSerializableRef);
return true;
}
/// <summary>
/// Called when load data.
/// </summary>
/// <param name="Data">The data.</param>
/// <returns>Returns true if succeeded.</returns>
protected override bool OnLoad(ref Stream DataStream, ref System.Runtime.Serialization.IFormatter DataFormater)
{
ResultsSerializableRef = (ResultsSerializable)DataFormater.Deserialize(DataStream);
return true;
}
internal ResultsSerializable ResultsSerializableRef;
}
}
@@ -1,335 +0,0 @@
//
// (C) Copyright 2007-2011 by Autodesk, Inc. All rights reserved.
//
// 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 ITS 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.Collections.Generic;
using System.Text;
using Autodesk.REX.Framework;
using REX.Common;
using Autodesk.Revit.DB;
using REX.ContentGenerator.Families;
namespace REX.ContentGeneratorWPF.Main.Revit
{
internal class ExtensionRevit : REX.Common.REXExtensionProduct
{
#region properties
/// <summary>
/// The instance of Revit family converter.
/// </summary>
REX.ContentGenerator.Converters.RVTFamilyConverter RVTConverter;
/// <summary>
/// Get the main extension.
/// </summary>
/// <value>The main extension.</value>
internal Extension ThisMainExtension
{
get
{
return (Extension)ThisExtension;
}
}
#endregion
#region<constructor>
public ExtensionRevit(REX.Common.REXExtension Ext)
: base(Ext)
{
RVTConverter = new REX.ContentGenerator.Converters.RVTFamilyConverter(ThisExtension.Revit.ActiveDocument, true);
}
#endregion
#region IREXExtension methods - filled
public override void OnCreate()
{
string error;
if (ReadSelectedElementFromRevit(out error))
{
ReadParamAndDBDescription();
}
else
{
ThisExtension.System.SystemBase.Errors.AddError("Error2", error, null);
}
}
public override void OnSetData()
{
if (ThisMainExtension.Data.NewSection == null)
{
ThisMainExtension.System.SystemBase.Errors.AddError("Error", "The section was not defined.", null);
}
}
public override void OnRun()
{
ThisMainExtension.Progress.Steps = 2;
ThisMainExtension.Progress.Position = 1;
ThisMainExtension.Progress.Header = "Element creation";
ThisMainExtension.Progress.Text = "...";
ThisMainExtension.Progress.Show(ThisMainExtension.GetWindowForParent());
CreateNewFamilySymbol();
if (ThisMainExtension.Data.NewFamilySymbol == null)
{
ThisExtension.System.SystemBase.Errors.AddError("Error", "Creation of the new family failed.", null);
}
else
{
if (!ApplyFamilySymbolToSelectedElement())
{
ThisExtension.System.SystemBase.Errors.AddError("Error", "Setting the new family to the selected element failed.", null);
}
else
{
ThisExtension.System.SystemBase.Errors.AddError("Error2", "The new family was applied to the selected element", null, REXErrorLevel.Info);
}
}
RVTConverter.Close();
ThisMainExtension.Progress.Hide();
}
#endregion
#region Private methods
/// <summary>
/// Reads the current selection of Revit.
/// </summary>
/// <param name="errorMessage">The error message.</param>
/// <returns>True if reading succeed; otherwise, false.</returns>
private bool ReadSelectedElementFromRevit(out string errorMessage)
{
errorMessage = string.Empty;
if (ThisExtension.Revit.ActiveUIDocument.Selection.GetElementIds().Count == 0)
{
errorMessage = "The selection is empty";
return false;
}
if (ThisExtension.Revit.ActiveUIDocument.Selection.GetElementIds().Count > 1)
{
errorMessage = "The selection contains more than one element";
return false;
}
IEnumerator<ElementId> enumerator = ThisExtension.Revit.ActiveUIDocument.Selection.GetElementIds().GetEnumerator();
enumerator.Reset();
enumerator.MoveNext();
Element el = ThisExtension.Revit.ActiveUIDocument.Document.GetElement(enumerator.Current);
FamilyInstance familyInstance = el as FamilyInstance;
if (familyInstance == null)
{
errorMessage = "Selected element is not a FamilyInstance";
return false;
}
if (familyInstance.StructuralType == Autodesk.Revit.DB.Structure.StructuralType.Beam ||
familyInstance.StructuralType == Autodesk.Revit.DB.Structure.StructuralType.Column ||
familyInstance.StructuralType == Autodesk.Revit.DB.Structure.StructuralType.Brace)
{
ThisMainExtension.Data.SelectedElement = familyInstance;
FillPropertiesOfSelectedElement();
FillGeometryOfSelectedElement();
return true;
}
else
{
errorMessage = "Selected element is not a beam nor a column";
return false;
}
}
/// <summary>
/// Fills the properties based on the selected element.
/// </summary>
private void FillPropertiesOfSelectedElement()
{
List<PropertyItem> properties = new List<PropertyItem>();
properties.Add(new PropertyItem() { Name = "Name", Value = ThisMainExtension.Data.SelectedElement.Name });
properties.Add(new PropertyItem() { Name = "Id", Value = ThisMainExtension.Data.SelectedElement.Id.IntegerValue.ToString() });
properties.Add(new PropertyItem() { Name = "Structural usage", Value = ThisMainExtension.Data.SelectedElement.StructuralUsage.ToString() });
properties.Add(new PropertyItem() { Name = "Structural type", Value = ThisMainExtension.Data.SelectedElement.StructuralType.ToString() });
properties.Add(new PropertyItem() { Name = "Structural material type", Value = ThisMainExtension.Data.SelectedElement.StructuralMaterialType.ToString() });
foreach (Parameter param in ThisMainExtension.Data.SelectedElement.Parameters)
{
string valueString = "";
if (param.StorageType == StorageType.Double)
valueString = param.AsValueString();
else if (param.StorageType == StorageType.String)
valueString = param.AsString();
else if (param.StorageType == StorageType.ElementId)
{
ElementId id = param.AsElementId();
Element elem = ThisMainExtension.Revit.ActiveDocument.GetElement(id);
if (elem != null)
valueString = elem.Name;
}
if (!string.IsNullOrEmpty(valueString))
properties.Add(new PropertyItem() { Name = param.Definition.Name, Value = valueString });
}
ThisMainExtension.Data.SelectedElementProperties = properties;
}
/// <summary>
/// Builds the geometry based on the selected element.
/// </summary>
private void FillGeometryOfSelectedElement()
{
List<Triangle> triangles = new List<Triangle>();
Options opt = ThisMainExtension.Revit.ActiveDocument.Application.Create.NewGeometryOptions();
opt.DetailLevel = ViewDetailLevel.Fine;
GeometryElement gel = ThisMainExtension.Data.SelectedElement.get_Geometry(opt);
foreach (GeometryObject geoObject in gel)
{
Solid s = geoObject as Solid;
if (null != s)
{
foreach (Face f in s.Faces)
{
Mesh m = f.Triangulate();
for (int i = 0; i < m.NumTriangles; i++)
{
MeshTriangle mt = m.get_Triangle(i);
XYZ pt1 = mt.get_Vertex(0);
XYZ pt2 = mt.get_Vertex(1);
XYZ pt3 = mt.get_Vertex(2);
triangles.Add(new Triangle(new REX.Common.Geometry.REXxyz(pt1.X, pt1.Y, pt1.Z),
new REX.Common.Geometry.REXxyz(pt2.X, pt2.Y, pt2.Z),
new REX.Common.Geometry.REXxyz(pt3.X, pt3.Y, pt3.Z)));
}
}
continue;
}
GeometryInstance inst = geoObject as GeometryInstance;
if (null != inst)
{
foreach (GeometryObject o in inst.SymbolGeometry)
{
s = o as Solid;
if (s != null)
{
foreach (Face f in s.Faces)
{
Mesh m = f.Triangulate();
m = m.get_Transformed(inst.Transform);
for (int i = 0; i < m.NumTriangles; i++)
{
MeshTriangle mt = m.get_Triangle(i);
XYZ pt1 = mt.get_Vertex(0);
XYZ pt2 = mt.get_Vertex(1);
XYZ pt3 = mt.get_Vertex(2);
triangles.Add(new Triangle(new REX.Common.Geometry.REXxyz(pt1.X, pt1.Y, pt1.Z),
new REX.Common.Geometry.REXxyz(pt2.X, pt2.Y, pt2.Z),
new REX.Common.Geometry.REXxyz(pt3.X, pt3.Y, pt3.Z)));
}
}
}
}
}
}
ThisMainExtension.Data.SelectedElementGeometry = triangles;
}
/// <summary>
/// Initializes the instances of database and parametric sections in Data based on the selected element.
/// </summary>
private void ReadParamAndDBDescription()
{
ThisMainExtension.Progress.Steps = 2;
ThisMainExtension.Progress.Position = 1;
ThisMainExtension.Progress.Header = "Element reading";
ThisMainExtension.Progress.Text = "...";
ThisMainExtension.Progress.Show(ThisMainExtension.GetWindowForParent());
ThisMainExtension.Data.DatabaseSection = RVTConverter.GetFamily(ThisMainExtension.Data.SelectedElement, ECategoryType.SECTION_DB) as REXFamilyType_DBSection;
ThisMainExtension.Data.ParametricSection = RVTConverter.GetFamily(ThisMainExtension.Data.SelectedElement, ECategoryType.SECTION_PARAM) as REXFamilyType_ParamSection;
if (ThisMainExtension.Data.DatabaseSection != null)
{
//Getting all records where the specified element exists.
ThisMainExtension.Data.DatabaseRecords = ThisMainExtension.Converter.GetDBList(ThisMainExtension.Data.DatabaseSection,
ThisMainExtension.Converter.GetDatabaseDirectory(REX.ContentGenerator.Families.ECategoryType.SECTION_DB), REX.ContentGenerator.Families.ECategoryType.SECTION_DB);
}
ThisMainExtension.Progress.Hide();
}
/// <summary>
/// Creates the new FamilySymbol.
/// </summary>
private void CreateNewFamilySymbol()
{
if (ThisMainExtension.Data.NewSection != null)
{
if (ThisMainExtension.Data.SelectedElement.StructuralType == Autodesk.Revit.DB.Structure.StructuralType.Column)
ThisMainExtension.Data.NewSection.ElementType = EElementType.COLUMN;
else
ThisMainExtension.Data.NewSection.ElementType = EElementType.BEAM;
ThisMainExtension.Data.NewSection.Material = EMaterial.STEEL;
ThisMainExtension.Data.NewFamilySymbol = RVTConverter.GetElement(ThisMainExtension.Data.NewSection) as Autodesk.Revit.DB.FamilySymbol;
}
}
/// <summary>
/// Applies the new FamilySymbol to the selected element.
/// </summary>
/// <returns></returns>
private bool ApplyFamilySymbolToSelectedElement()
{
try
{
ThisMainExtension.Data.SelectedElement.Symbol = ThisMainExtension.Data.NewFamilySymbol;
return true;
}
catch
{
}
return false;
}
#endregion
}
}
@@ -1,79 +0,0 @@
//
// (C) Copyright 2007-2011 by Autodesk, Inc. All rights reserved.
//
// 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 ITS 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.
/// <summary>
/// </summary>
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Threading;
using System.Reflection;
using REX.Common;
using Autodesk.REX.Framework;
namespace REX.ContentGeneratorWPF
{
/// <summary>
/// Allows parsing module settings located in Configuration/settings.xml file.
/// </summary>
internal class ExtensionSettings : REXExtensionSettings
{
/// <summary>
/// Initializes a new instance of the <see cref="ExtensionSettings"/> class.
/// </summary>
/// <param name="Ext">The reference to REXExtension object.</param>
public ExtensionSettings(REXExtension Ext)
: base(Ext)
{
}
/// <summary>
/// Gets the main extension.
/// </summary>
/// <value>The main extension.</value>
internal Extension ThisMainExtension
{
get
{
return (Extension)ThisExtension;
}
}
/// <summary>
/// Called when parsing Configuration / settings.xml
/// file. Concerns only tags which is not supported by the
/// class.
/// </summary>
/// <param name="Node">The XML node.</param>
/// <returns>
/// <c>true</c>If is successfully; otherwise, <c>false</c> -
/// reserved only for exceptions.
/// </returns>
public override bool OnParse(System.Xml.XmlNode Node)
{
return true;
}
}
}
@@ -1,68 +0,0 @@
//
// (C) Copyright 2007-2011 by Autodesk, Inc. All rights reserved.
//
// 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 ITS 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.Collections.Generic;
using System.Linq;
using System.Text;
using REX.Common.Geometry;
namespace REX.ContentGeneratorWPF.Main
{
/// <summary>
/// Represents the geometry of triangle.
/// </summary>
public class Triangle
{
/// <summary>
/// Gets or sets the first point.
/// </summary>
/// <value>The point.</value>
public REXxyz Pt1 { get; set; }
/// <summary>
/// Gets or sets the second point.
/// </summary>
/// <value>The point.</value>
public REXxyz Pt2 { get; set; }
/// <summary>
/// Gets or sets the third point.
/// </summary>
/// <value>The point.</value>
public REXxyz Pt3 { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="Triangle"/> class.
/// </summary>
public Triangle()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="Triangle"/> class.
/// </summary>
/// <param name="pt1">The first point.</param>
/// <param name="pt2">The second point.</param>
/// <param name="pt3">The third point.</param>
public Triangle(REXxyz pt1, REXxyz pt2, REXxyz pt3)
{
Pt1 = pt1;
Pt2 = pt2;
Pt3 = pt3;
}
}
}
@@ -1,136 +0,0 @@
//
// (C) Copyright 2007-2011 by Autodesk, Inc. All rights reserved.
//
// 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 ITS 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.
/// <summary>
/// </summary>
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Reflection;
using System.Runtime.InteropServices;
using Autodesk.REX.Framework;
using REX.Common;
namespace REX.ContentGeneratorWPF
{
/// <summary>
/// Main class for REX manager and interactions with system.
/// </summary>
public class Application : REXFoundationApplication
{
protected override void OnCreateApplication()
{
base.OnCreateApplication();
ApplicationRef = new FoundationApplication();
}
}
/// <summary>
/// Main class for REX manager and interactions with system
/// </summary>
/// <remarks></remarks>
public class FoundationApplication : REXApplication
{
/// <summary>
/// Initializes a new instance of the <see cref="Application"/> class.
/// Creates Extension class.
/// </summary>
public FoundationApplication()
{
AppExtension = new Extension(this);
}
/// <summary>
/// Called when create. Set ExtensionContext structure and enable or disable some functionalities.
/// </summary>
/// <returns>Returns true if succeeded.</returns>
/// <example>
/// <code>
///public override bool OnCreate()
///{
/// AppExtension.ExtensionContext.Control.LanguagesSupport = true; // switches off languages support.
/// AppExtension.ExtensionContext.Control.UserInterface = false; // module will work similar to run in context mode.
/// //...
/// return true;
///}
/// </code>
/// </example>
public override bool OnCreate()
{
// insert code here
return true;
}
/// <summary>
/// Get the extension.
/// </summary>
/// <returns>Returns reference to Extension object.</returns>
public override REXExtension GetExtension()
{
// insert code here
return AppExtension;
}
/// <summary>
/// Get the minimum required version of specified engine's component.
/// </summary>
/// <param name="Version">The version.</param>
/// <returns>Returns version string - "Major.Minor".</returns>
public override string GetVersion(REXVersionType Version)
{
switch (Version)
{
case REXVersionType.Common:
case REXVersionType.Controls:
case REXVersionType.Math:
return "1.0";
case REXVersionType.Engine:
return "2.3";
case REXVersionType.CommercialEngine:
return "2.3";
}
return "";
}
/// <summary>
/// Get the text. See <see cref="Extension.GetText()"/> method.
/// </summary>
/// <param name="Name">The name.</param>
/// <returns>Returns specified text.</returns>
public override string GetText(string Name)
{
return AppExtension.OnGetText(Name);
}
#region Private members
private Extension AppExtension;
#endregion
}
}
@@ -1,191 +0,0 @@
//
// (C) Copyright 2007-2016 by Autodesk, Inc. All rights reserved.
//
// 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 ITS 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.
/// <summary>
/// </summary>
using System;
using System.Collections.Generic;
using System.Text;
using Autodesk.REX.Framework;
#if (REVIT)
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
#endif
namespace REX.ContentGeneratorWPF
{
#if (REVIT)
/// <summary>
/// The class enables direct connection between Revit and extension.
/// </summary>
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
public class DirectRevitAccess : IExternalCommand
#else
/// <summary>
/// The class enables direct connection between application and extension.
/// </summary>
public class DirectAccess
#endif
{
#if (REVIT)
/// <summary>
/// Executes the extension.
/// </summary>
/// <param name="commandData">The command data.</param>
/// <param name="message">The message.</param>
/// <param name="elements">The elements.</param>
/// <returns>Returns execution result.</returns>
public Result Execute(Autodesk.Revit.UI.ExternalCommandData commandData, ref string message, ElementSet elements)
#else
/// <summary>
/// Executes the extension.
/// </summary>
public bool Run()
#endif
{
AppDomain currentDomain = AppDomain.CurrentDomain;
if (currentDomain != null)
currentDomain.AssemblyResolve += new ResolveEventHandler(currentDomain_AssemblyResolve);
#if (REVIT)
return Proxy.Execute(commandData, ref message, elements);
#else
return Proxy.Run();
#endif
}
System.Reflection.Assembly currentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
Autodesk.REX.Framework.REXConfiguration.Initialize(System.Reflection.Assembly.GetExecutingAssembly());
return Autodesk.REX.Framework.REXAssemblies.Resolve(sender, args, System.Reflection.Assembly.GetExecutingAssembly());
}
private static class Proxy
{
#if (REVIT)
public static Result Execute(Autodesk.Revit.UI.ExternalCommandData commandData, ref string message, ElementSet elements)
{
ExtensionDirectRevitAccess extensionDirectRevitAccess = new ExtensionDirectRevitAccess();
return extensionDirectRevitAccess.Execute(commandData, ref message, elements);
}
#else
public static bool Run()
{
ExtensionDirectAccess extensionDirectAccess = new ExtensionDirectAccess();
return extensionDirectAccess.Run();
}
#endif
}
}
#if (REVIT)
/// <summary>
/// The class enables direct connection between Revit and extension.
/// </summary>
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
public class ExtensionDirectRevitAccess : REX.Common.REXDirectRevitAccess, IExternalCommand
#else
/// <summary>
/// The class enables direct connection between application and extension.
/// </summary>
public class ExtensionDirectAccess
#endif
{
#if (REVIT)
/// <summary>
/// Executes the extension.
/// </summary>
/// <param name="commandData">The command data.</param>
/// <param name="message">The message.</param>
/// <param name="elements">The elements.</param>
/// <returns>Returns execution result.</returns>
public Result Execute(Autodesk.Revit.UI.ExternalCommandData commandData, ref string message, ElementSet elements)
#else
/// <summary>
/// Executes the extension.
/// </summary>
public bool Run()
#endif
{
try
{
AppRef = new Application();
REXContext context = new REXContext();
context.Control.Mode = REXMode.Dialog;
context.Control.ControlMode = REXControlMode.ModalDialog;
#if (REVIT)
PresetContext(ref commandData, ref message, ref elements, ref context);
#else
context.Product.Type = REXInterfaceType.None;
#endif
Transaction tran = new Transaction(commandData.Application.ActiveUIDocument.Document, "REX.ContentGeneratorWPF transaction");
tran.Start();
REXEnvironment Env = new REXEnvironment(REX.Common.REXConst.ENG_DedicatedVersionName);
if (Env.LoadEngine(ref context))
{
if (AppRef.Create(ref context))
{
AppRef.Show();
#if (REVIT)
}
}
tran.Commit();
if (context.Extension.Result == REXResultType.None || context.Extension.Result == REXResultType.Succeeded)
return Result.Succeeded;
else if (context.Extension.Result == REXResultType.Cancelled)
return Result.Cancelled;
else
return Result.Failed;
#else
return true;
}
}
return false;
#endif
}
catch (Exception ex)
{
#if (REVIT)
message = ex.Message;
return Result.Failed;
#else
return false;
#endif
}
}
private Application AppRef;
}
}
@@ -1,165 +0,0 @@
//
// (C) Copyright 2007-2011 by Autodesk, Inc. All rights reserved.
//
// 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 ITS 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.
/// <summary>
/// </summary>
using System;
using System.Collections.Generic;
using System.Text;
namespace REX.Common
{
/// <summary>
/// Foundation class for REX.Foundation usage.
/// </summary>
public class REXFoundationApplication : Autodesk.REX.Framework.IREXApplication2
{
protected Autodesk.REX.Framework.IREXApplication2 ApplicationRef;
/// <summary>
/// Initializes a new instance of the <see cref="REXApplication"/> class.
/// </summary>
public REXFoundationApplication()
{
AppDomain currentDomain = AppDomain.CurrentDomain;
currentDomain.AssemblyResolve += new ResolveEventHandler(currentDomain_AssemblyResolve);
OnCreateApplication();
}
protected virtual void OnCreateApplication()
{
}
/// <summary>
/// Handles the AssemblyResolve event of the currentDomain control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="args">The <see cref="System.ResolveEventArgs"/> instance containing the event data.</param>
/// <returns></returns>
System.Reflection.Assembly currentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
Autodesk.REX.Framework.REXConfiguration.Initialize(System.Reflection.Assembly.GetExecutingAssembly());
return Autodesk.REX.Framework.REXAssemblies.Resolve(sender, args, Autodesk.REX.Framework.REXConfiguration.Control.VersionName, System.Reflection.Assembly.GetExecutingAssembly());
}
#region IREXApplication2 Members
/// <summary>
/// Create module.
/// </summary>
/// <param name="AppContext">The application context.</param>
/// <returns>Returns true if succeeded.</returns>
public bool Create(ref Autodesk.REX.Framework.REXContext AppContext)
{
if (AppContext.Extension.Name == null || AppContext.Extension.Name == "")
AppContext.Extension.Name = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
return ApplicationRef.Create(ref AppContext);
}
/// <summary>
/// Creates and shows module as modal dialog.
/// </summary>
/// <param name="AppContext">The application context.</param>
/// <returns>Returns true if suceeded.</returns>
public bool Modal(ref Autodesk.REX.Framework.REXContext AppContext)
{
if (AppContext.Extension.Name == null || AppContext.Extension.Name == "")
AppContext.Extension.Name = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
return ApplicationRef.Modal(ref AppContext);
}
#endregion
#region IREXApplication Members
/// <summary>
/// Closes this instance.
/// </summary>
public void Close()
{
ApplicationRef.Close();
}
/// <summary>
/// Commands the specified command struct.
/// </summary>
/// <param name="CommandStruct">The command struct.</param>
/// <returns></returns>
public object Command(ref Autodesk.REX.Framework.REXCommand CommandStruct)
{
return ApplicationRef.Command(ref CommandStruct);
}
/// <summary>
/// Controls this instance.
/// </summary>
/// <returns></returns>
public object Control()
{
return ApplicationRef.Control();
}
/// <summary>
/// Creates and shows module as modal dialog.
/// </summary>
/// <param name="AppContext">The application context.</param>
/// <returns>Returns true if suceeded.</returns>
public bool Create(ref Autodesk.REX.Framework.REXApplicationContext AppContext)
{
return ApplicationRef.Create(ref AppContext);
}
/// <summary>
/// Called when event.
/// </summary>
/// <param name="EventStruct">The event structure.</param>
/// <returns>Returns result of event operation.</returns>
public object Event(ref Autodesk.REX.Framework.REXEvent EventStruct)
{
return ApplicationRef.Event(ref EventStruct);
}
/// <summary>
/// Creates and shows module as modal dialog.
/// </summary>
/// <param name="AppContext">The application context.</param>
/// <returns>Returns true if suceeded.</returns>
public bool Modal(ref Autodesk.REX.Framework.REXApplicationContext AppContext)
{
return ApplicationRef.Modal(ref AppContext);
}
/// <summary>
/// Shows this module.
/// </summary>
/// <returns>Returns true if succeeded.</returns>
public bool Show()
{
return ApplicationRef.Show();
}
#endregion
}
}
@@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// 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("ContentGeneratorWPF")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ContentGeneratorWPF")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("1ac8c585-bc98-4e45-9bb6-5ac81a98d286")]
// 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")]
[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -1,92 +0,0 @@
<rexf:REXExtensionControl x:Class="REX.ContentGeneratorWPF.Resources.Dialogs.ContentGeneratorCreateControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:rexf="clr-namespace:REX.Common;assembly=REX.Foundation.WPF"
xmlns:rexc="clr-namespace:REX.Controls.WPF;assembly=REX.Controls.WPF"
xmlns:local="clr-namespace:REX.ContentGeneratorWPF.Resources.Dialogs"
Height="454" Width="638">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="20"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<RadioButton Name="radioParametric" VerticalAlignment="Center" Grid.Column="0" Grid.Row="0" Content="Parametric" Checked="radioParametric_Checked" Unchecked="radioParametric_Checked" IsChecked="True"></RadioButton>
<RadioButton Name="radioDatabase" VerticalAlignment="Center" Grid.Column="1" Grid.Row="0" Content="Database" Checked="radioParametric_Checked" Unchecked="radioParametric_Checked" IsChecked="False"></RadioButton>
<Border Margin="2" Name="paramGroupBox" Grid.Column="0" Grid.Row="1" BorderThickness="1" BorderBrush="Gray">
<Grid Name="gridParam">
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="2*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<local:PolygonViewer x:Name="viewer" Grid.Column="0" Grid.Row="0"></local:PolygonViewer>
<Grid x:Name="gridParametric" Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel Grid.Row="1">
<Grid Height="74">
<TextBlock Margin="19,39.001,0,0" Name="textBlock1" Text="Type=" HorizontalAlignment="Left" Width="56" Height="16.12" VerticalAlignment="Top" />
<rexc:REXImageComboBox Name="comboParametricTypes" Margin="81,2,6,0" Height="69.12" VerticalAlignment="Top" SelectionChanged="comboParametricTypes_SelectionChanged"></rexc:REXImageComboBox>
</Grid>
<Grid Height="28">
<TextBlock HorizontalAlignment="Left" Margin="19,6,0,8" Name="textBlock2" Text="h=" Width="72" />
<rexc:REXUnitEditBox Margin="0,3,6,1" Name="editBoxH" Power="1" UnitType="Dimensions_SectionDim" RememberCorrect="True" HorizontalAlignment="Right" Width="142" OnDisableAction="eHIDE_FOREGROUND" LostKeyboardFocus="editBoxH_LostKeyboardFocus" />
</Grid>
<Grid Height="28">
<TextBlock Height="15" HorizontalAlignment="Left" Margin="19,6,0,8" Name="textBlock3" Text="b=" VerticalAlignment="Top" Width="72" />
<rexc:REXUnitEditBox Margin="0,2,6,2" Name="editBoxB" Power="1" UnitType="Dimensions_SectionDim" RememberCorrect="True" HorizontalAlignment="Right" Width="142" OnDisableAction="eHIDE_FOREGROUND" LostKeyboardFocus="editBoxH_LostKeyboardFocus"/>
</Grid>
<Grid Height="28">
<rexc:REXIndexLabel Height="15" HorizontalAlignment="Left" Margin="19,6,0,8" Name="textBlock4" Text="t{f}=" VerticalAlignment="Bottom" Width="72" />
<rexc:REXUnitEditBox Margin="0,2,6,2" Name="editBoxTW" Power="1" UnitType="Dimensions_SectionDim" RememberCorrect="True" HorizontalAlignment="Right" Width="142" OnDisableAction="eHIDE_FOREGROUND" LostKeyboardFocus="editBoxH_LostKeyboardFocus"/>
</Grid>
<Grid Height="28">
<rexc:REXIndexLabel HorizontalAlignment="Left" Margin="19,6,0,8" Name="textBlock5" Text="t{w}=" Width="72" Height="15" VerticalAlignment="Bottom" />
<rexc:REXUnitEditBox Margin="0,2,6,2" Name="editBoxTF" Power="1" UnitType="Dimensions_SectionDim" RememberCorrect="True" HorizontalAlignment="Right" Width="142" OnDisableAction="eHIDE_FOREGROUND" LostKeyboardFocus="editBoxH_LostKeyboardFocus"/>
</Grid>
<Grid Height="28">
<rexc:REXIndexLabel Height="15" HorizontalAlignment="Left" Margin="19,6,0,8" Name="rEXIndexLabel1" Text="A=" VerticalAlignment="Bottom" Width="72" />
<rexc:REXUnitEditBox Margin="0,2,6,2" Name="editBoxA" Power="2" RememberCorrect="True" UnitType="Dimensions_SectionDim" IsEnabled="False" BackgroundDisabledStandard="White" HorizontalAlignment="Right" Width="142" />
</Grid>
<Grid Height="28">
<rexc:REXIndexLabel Height="15" HorizontalAlignment="Left" Margin="19,6,0,8" Text="I{y}=" VerticalAlignment="Bottom" Width="72" />
<rexc:REXUnitEditBox Margin="0,2,6,2" Name="editBoxIy" Power="4" RememberCorrect="True" UnitType="Dimensions_SectionDim" IsEnabled="False" BackgroundDisabledStandard="White" HorizontalAlignment="Right" Width="142" />
</Grid>
<Grid Height="28">
<rexc:REXIndexLabel Height="15" HorizontalAlignment="Left" Margin="19,6,0,8" Text="I{z}=" VerticalAlignment="Bottom" Width="72" />
<rexc:REXUnitEditBox Margin="0,2,6,2" Name="editBoxIz" Power="4" RememberCorrect="True" UnitType="Dimensions_SectionDim" IsEnabled="False" BackgroundDisabledStandard="White" HorizontalAlignment="Right" Width="142" />
</Grid>
</StackPanel>
</Grid>
</Grid>
</Border>
<Border Margin="2" Name="dbGroupBox" Grid.Column="1" Grid.Row="1" BorderThickness="1" BorderBrush="Gray">
<Grid Name="gridDB" Visibility="Hidden">
<Grid.RowDefinitions>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Button Name="buttonDBSelect" Content="Select" Width="100" Height="24" VerticalAlignment="Center" HorizontalAlignment="Left" Click="buttonDBSelect_Click"></Button>
<TextBlock Name="textDBSelected" Margin="103,1,1,1" VerticalAlignment="Center" Height="20"></TextBlock>
<local:PropertiesControl x:Name="databasesProperties" Grid.Column="0" Grid.Row="1"></local:PropertiesControl>
</Grid>
</Border>
</Grid>
</rexf:REXExtensionControl>
@@ -1,358 +0,0 @@
//
// (C) Copyright 2007-2011 by Autodesk, Inc. All rights reserved.
//
// 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 ITS 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.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using REX.Common;
namespace REX.ContentGeneratorWPF.Resources.Dialogs
{
/// <summary>
/// Represents the control which allows the user to select a new type which will be applied to the selected element in Revit.
/// </summary>
public partial class ContentGeneratorCreateControl : REX.Common.REXExtensionControl
{
/// <summary>
/// Help flag to freeze events.
/// </summary>
bool Freeze = false;
/// <summary>
/// The parametric section.
/// </summary>
REX.ContentGenerator.Families.REXFamilyType_ParamSection ParametricSection;
/// <summary>
/// The database section.
/// </summary>
REX.ContentGenerator.Families.REXFamilyType_DBSection DatabaseSection;
/// <summary>
/// The object which manages the database browser dialog.
/// </summary>
REX.ContentGenerator.Dialog.REXContentDialogManager DBExplorerDialogManager;
/// <summary>
/// The settings of the database browser dialog.
/// </summary>
REX.ContentGenerator.Dialog.REXContentDialogSettings DBExplorerSettings;
/// <summary>
/// Gets the main extension.
/// </summary>
/// <value>The main extension.</value>
internal Extension ThisMainExtension
{
get
{
return (Extension)ThisExtension;
}
}
/// <summary>
/// Gets the parametric description.
/// </summary>
/// <value>The parametric description.</value>
REX.ContentGenerator.Families.REXSectionParamDescription ParametricDescription
{
get
{
return ParametricSection.Parameters;
}
}
/// <summary>
/// Initializes a new instance of the <see cref="ContentGeneratorCreateControl"/> class.
/// </summary>
public ContentGeneratorCreateControl()
{
InitializeComponent();
}
/// <summary>
/// Initializes a new instance of the <see cref="ContentGeneratorCreateControl"/> class.
/// </summary>
/// <param name="extension">The extension object.</param>
public ContentGeneratorCreateControl(REX.Common.REXExtension extension)
: base(extension)
{
InitializeComponent();
SetDefaultParamDescription();
}
/// <summary>
/// Initializes the dialog with current settings.
/// </summary>
public void SetDialog()
{
//combo box
comboParametricTypes.Items.Add(new REX.Controls.WPF.REXImageComboBoxItem()
{ Image = REXLibrary.GetResourceImage(GetType().Assembly,"Resources/Other/Images/bmp_I.png")
, Text = "I"});
comboParametricTypes.Items.Add(new REX.Controls.WPF.REXImageComboBoxItem() { Image = REXLibrary.GetResourceImage(GetType().Assembly, "Resources/Other/Images/bmp_L.png")
, Text = "Angle"});
comboParametricTypes.Items.Add(new REX.Controls.WPF.REXImageComboBoxItem() { Image = REXLibrary.GetResourceImage(GetType().Assembly, "Resources/Other/Images/bmp_RECT.png")
, Text = "Rectangle"});
//edit boxes
editBoxB.UnitEngine = ThisExtension.System.Units.UnitsBase;
editBoxH.UnitEngine = ThisExtension.System.Units.UnitsBase;
editBoxTF.UnitEngine = ThisExtension.System.Units.UnitsBase;
editBoxTW.UnitEngine = ThisExtension.System.Units.UnitsBase;
editBoxA.UnitEngine = ThisExtension.System.Units.UnitsBase;
editBoxIy.UnitEngine = ThisExtension.System.Units.UnitsBase;
editBoxIz.UnitEngine = ThisExtension.System.Units.UnitsBase;
editBoxB.RangeMinCheck = true;
editBoxB.SetBaseMinValue(0.001);//1mm
editBoxH.RangeMinCheck = true;
editBoxH.SetBaseMinValue(0.001);//1mm
editBoxTF.RangeMinCheck = true;
editBoxTF.SetBaseMinValue(0.001);//1mm
editBoxTW.RangeMinCheck = true;
editBoxTW.SetBaseMinValue(0.001);//1mm
UpdateParamControls();
UpdateParamViewer();
SetDBBrowser();
}
/// <summary>
/// Updates data based on current settings.
/// </summary>
public void SetData()
{
if (radioDatabase.IsChecked.Value)
ThisMainExtension.Data.NewSection = DatabaseSection;
else
ThisMainExtension.Data.NewSection = ParametricSection;
}
/// <summary>
/// Initializes the database browser.
/// </summary>
private void SetDBBrowser()
{
DBExplorerDialogManager = new REX.ContentGenerator.Dialog.REXContentDialogManager(ThisExtension.Context);
DBExplorerSettings = new REX.ContentGenerator.Dialog.REXContentDialogSettings();
REX.ContentGenerator.Dialog.REXContentDialogCategorySettings catSet = DBExplorerSettings.SectionDBSettings;
DBExplorerSettings.DialogMode = REX.ContentGenerator.Dialog.EContentDialogMode.Selection;
DBExplorerSettings.SetOneCategoryVisible(REX.ContentGenerator.Families.ECategoryType.SECTION_DB);
DBExplorerSettings.RegionalSettings = true;
catSet.SelectedElement = DatabaseSection;
DBExplorerSettings.Caption = "Selection";
DBExplorerSettings.ValidateTypes = false;
//In order to omit long initialization of the browser when it is first launched (after first button click)
//the browser is initialized when module starts. It doesn't make it faster but it is not so annoying for
//the final user.
DBExplorerDialogManager.SetApplicationInstance(DBExplorerSettings);
}
/// <summary>
/// Initializes the default parametric description.
/// </summary>
private void SetDefaultParamDescription()
{
ParametricSection = new REX.ContentGenerator.Families.REXFamilyType_ParamSection();
ParametricDescription.Dimensions.b = 0.3;//300mm
ParametricDescription.Dimensions.h = 0.3;//300mm
ParametricDescription.Dimensions.tw = 0.01;//10mm
ParametricDescription.Dimensions.tf = 0.01;//10mm
ParametricDescription.SectionType = REX.ContentGenerator.Families.ESectionType.I;
ParametricDescription.CalculataMainAxisAndCharacteristics();
}
/// <summary>
/// Updates the parametric controls.
/// </summary>
private void UpdateParamControls()
{
if (!Freeze)
{
Freeze = true;
if (ParametricDescription.SectionType == REX.ContentGenerator.Families.ESectionType.I)
comboParametricTypes.SelectedIndex = 0;
else if (ParametricDescription.SectionType == REX.ContentGenerator.Families.ESectionType.L)
comboParametricTypes.SelectedIndex = 1;
else if (ParametricDescription.SectionType == REX.ContentGenerator.Families.ESectionType.RECT)
comboParametricTypes.SelectedIndex = 2;
editBoxB.SetDataBaseValue(ParametricDescription.Dimensions.b);
editBoxH.SetDataBaseValue(ParametricDescription.Dimensions.h);
editBoxTF.SetDataBaseValue(ParametricDescription.Dimensions.tf);
editBoxTW.SetDataBaseValue(ParametricDescription.Dimensions.tw);
editBoxA.SetDataBaseValue(ParametricDescription.Characteristics.A);
editBoxIy.SetDataBaseValue(ParametricDescription.Characteristics.IY);
editBoxIz.SetDataBaseValue(ParametricDescription.Characteristics.IZ);
editBoxTF.IsEnabled = (ParametricDescription.SectionType != REX.ContentGenerator.Families.ESectionType.RECT);
editBoxTW.IsEnabled = (ParametricDescription.SectionType != REX.ContentGenerator.Families.ESectionType.RECT);
Freeze = false;
}
}
/// <summary>
/// Updates the parametric description.
/// </summary>
private void UpdateParamDescription()
{
ParametricDescription.Dimensions.b = editBoxB.GetDataBaseValue();
ParametricDescription.Dimensions.h = editBoxH.GetDataBaseValue();
ParametricDescription.Dimensions.tw = editBoxTW.GetDataBaseValue();
ParametricDescription.Dimensions.tf = editBoxTF.GetDataBaseValue();
switch(comboParametricTypes.SelectedIndex)
{
case 0:
ParametricDescription.SectionType = REX.ContentGenerator.Families.ESectionType.I;
break;
case 1:
ParametricDescription.SectionType = REX.ContentGenerator.Families.ESectionType.L;
break;
case 2:
ParametricDescription.SectionType = REX.ContentGenerator.Families.ESectionType.RECT;
break;
}
ParametricDescription.CalculataMainAxisAndCharacteristics();
}
/// <summary>
/// Updates the parametric viewer.
/// </summary>
private void UpdateParamViewer()
{
REX.ContentGenerator.Geometry.Contour_Section section = ParametricDescription.GetContour(true);
if (section.Shape.Count > 0)
{
List<REX.Common.Geometry.REXxyz> points = section.Shape[0].GetPointList(true);
viewer.DrawPolygon(points);
}
}
/// <summary>
/// Updates the database section properties.
/// </summary>
private void UpdateDatabaseSectionProperties()
{
if (DatabaseSection != null)
{
databasesProperties.ClearProperties();
foreach (System.Reflection.PropertyInfo pi in DatabaseSection.Parameters.Description)
{
object val = DatabaseSection.Parameters.Description.GetValue(pi.Name);
if (val != null && pi.Name != "Names")
databasesProperties.AddProperty(pi.Name, val.ToString());
}
foreach (System.Reflection.PropertyInfo pi in DatabaseSection.Parameters.Dimensions)
{
object val = DatabaseSection.Parameters.Dimensions.GetValue(pi.Name);
AddFieldToDatabaseProperty(pi, val);
}
foreach (System.Reflection.PropertyInfo pi in DatabaseSection.Parameters.Characteristics)
{
object val = DatabaseSection.Parameters.Characteristics.GetValue(pi.Name);
AddFieldToDatabaseProperty(pi, val);
}
}
}
/// <summary>
/// Adds the field to the database property list.
/// </summary>
/// <param name="pi">The pi.</param>
/// <param name="val">The val.</param>
private void AddFieldToDatabaseProperty(System.Reflection.PropertyInfo pi, object val)
{
REX.ContentGenerator.Converters.FieldParams fieldParams = ThisMainExtension.Converter.Settings.GetParamsForField(pi.Name, REX.ContentGenerator.Families.ECategoryType.SECTION_DB);
if (val != null && fieldParams != null)
{
double valDbl = Convert.ToDouble(val);
string txt = ThisMainExtension.System.Units.DisplayTextFromBase(valDbl, fieldParams.unitName, fieldParams.power, true);
databasesProperties.AddProperty(pi.Name, txt);
}
}
/// <summary>
/// Handles the LostKeyboardFocus event of the editBoxH control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.Windows.Input.KeyboardFocusChangedEventArgs"/> instance containing the event data.</param>
private void editBoxH_LostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
{
if (!Freeze)
{
UpdateParamDescription();
UpdateParamViewer();
}
}
/// <summary>
/// Handles the SelectionChanged event of the comboParametricTypes control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.Windows.Controls.SelectionChangedEventArgs"/> instance containing the event data.</param>
private void comboParametricTypes_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (!Freeze)
{
UpdateParamDescription();
UpdateParamControls();
UpdateParamViewer();
}
}
/// <summary>
/// Handles the Checked event of the radioParametric control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
private void radioParametric_Checked(object sender, RoutedEventArgs e)
{
if (paramGroupBox != null && dbGroupBox != null)
{
gridParam.Visibility = radioParametric.IsChecked.Value? Visibility.Visible:Visibility.Hidden;
gridDB.Visibility = radioDatabase.IsChecked.Value?Visibility.Visible:Visibility.Hidden;
}
}
/// <summary>
/// Handles the Click event of the buttonDBSelect control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
private void buttonDBSelect_Click(object sender, RoutedEventArgs e)
{
System.Windows.Interop.WindowInteropHelper helper = new System.Windows.Interop.WindowInteropHelper(ThisExtension.GetWindowForParent());
if (DBExplorerDialogManager.ShowContentDialogParentIntPtr(DBExplorerSettings, helper.Handle))
{
this.DatabaseSection = DBExplorerSettings.SectionDBSettings.SelectedElement as REX.ContentGenerator.Families.REXFamilyType_DBSection;
UpdateDatabaseSectionProperties();
}
}
}
}
@@ -1,46 +0,0 @@
<rexf:REXExtensionControl x:Class="REX.ContentGeneratorWPF.Resources.ContentGeneratorReadControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:rexf="clr-namespace:REX.Common;assembly=REX.Foundation.WPF"
xmlns:rexc="clr-namespace:REX.Controls.WPF;assembly=REX.Controls.WPF"
xmlns:local="clr-namespace:REX.ContentGeneratorWPF.Resources.Dialogs"
Height="414" Width="638">
<Grid>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<GroupBox Header="Parametric" Margin="2" Name="paramGroupBox1" Grid.Column="0" Grid.Row="0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<local:PolygonViewer x:Name="viewer" Grid.Column="0" Grid.Row="0"></local:PolygonViewer>
<local:PropertiesControl x:Name="parametricProperties" Grid.Column="0" Grid.Row="1"></local:PropertiesControl>
</Grid>
</GroupBox>
<GroupBox Header="Database" Margin="2" Name="dbGroupBox1" Grid.Column="1" Grid.Row="0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition Height="20"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<local:PropertiesControl x:Name="databasesProperties" Grid.Column="0" Grid.Row="0"></local:PropertiesControl>
<TextBlock Grid.Column="0" Grid.Row="1" >List of Databases:</TextBlock>
<ListBox x:Name="dabasesListBox" Margin="2" Grid.Column="0" Grid.Row="2">
</ListBox>
</Grid>
</GroupBox>
</Grid>
</rexf:REXExtensionControl>
@@ -1,195 +0,0 @@
//
// (C) Copyright 2007-2011 by Autodesk, Inc. All rights reserved.
//
// 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 ITS 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.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace REX.ContentGeneratorWPF.Resources
{
/// <summary>
/// Represents the control which allows user to observe what kind of shape he has selected. There are two
/// representations presented: database and parametric.
/// </summary>
public partial class ContentGeneratorReadControl : REX.Common.REXExtensionControl
{
/// <summary>
/// Gets the main extension.
/// </summary>
/// <value>The main extension.</value>
internal Extension ThisMainExtension
{
get
{
return (Extension)ThisExtension;
}
}
/// <summary>
/// Initializes a new instance of the <see cref="ContentGeneratorReadControl"/> class.
/// </summary>
public ContentGeneratorReadControl()
{
InitializeComponent();
}
/// <summary>
/// Initializes a new instance of the <see cref="ContentGeneratorReadControl"/> class.
/// </summary>
/// <param name="extension">The extension.</param>
public ContentGeneratorReadControl(REX.Common.REXExtension extension)
: base(extension)
{
InitializeComponent();
}
/// <summary>
/// Initializes the dialog with current settings.
/// </summary>
public void SetDialog()
{
SetParametricDescription();
SetDatabasesDescription();
}
/// <summary>
/// Initializes the parametric description.
/// </summary>
private void SetParametricDescription()
{
SetParametricViewer();
SetParametricProperties();
}
/// <summary>
/// Initializes the databases description.
/// </summary>
private void SetDatabasesDescription()
{
SetDatabasesProperties();
SetDatabasesList();
}
/// <summary>
/// Draws the parametric section on the viewer.
/// </summary>
private void SetParametricViewer()
{
if (ThisMainExtension.Data.ParametricSection != null)
{
REX.ContentGenerator.Geometry.Contour_Section section = ThisMainExtension.Data.ParametricSection.Parameters.GetContour(true);
if (section.Shape.Count > 0)
{
List<REX.Common.Geometry.REXxyz> points = section.Shape[0].GetPointList(true);
viewer.DrawPolygon(points);
}
}
}
/// <summary>
/// Fill the parametric property control with data.
/// </summary>
private void SetParametricProperties()
{
if (ThisMainExtension.Data.ParametricSection != null)
{
REX.ContentGenerator.Families.REXFamilyType_ParamSection section = ThisMainExtension.Data.ParametricSection;
parametricProperties.ClearProperties();
parametricProperties.AddProperty("Certified",section.Certified.ToString());
parametricProperties.AddProperty("Shape", section.Parameters.SectionType.ToString());
parametricProperties.AddProperty("Material",section.Material.ToString());
parametricProperties.AddProperty("Tapered",section.Parameters.Tapered.ToString());
string angle = ThisMainExtension.System.Units.DisplayTextFromBase(section.Parameters.Angle, Autodesk.REX.Framework.EUnitType.Dimensions_Angle,true);
parametricProperties.AddProperty("Angle",angle);
string add2name = "";
if (section.Parameters.Tapered)
{
parametricProperties.AddCategory("Dimensions on the start");
add2name = "Start ";
}
else
{
parametricProperties.AddCategory("Dimensions");
}
foreach (System.Reflection.PropertyInfo property in section.Parameters.Dimensions)
{
object valObj = property.GetValue(section.Parameters.Dimensions, null);
double val = (valObj != null)?Convert.ToDouble(valObj):0;
string valStr = ThisMainExtension.System.Units.DisplayTextFromBase(val, Autodesk.REX.Framework.EUnitType.Dimensions_SectionDim,true);
parametricProperties.AddProperty(add2name + property.Name, valStr);
}
if (section.Parameters.Tapered)
{
parametricProperties.AddCategory("Dimensions on the end");
add2name = "End ";
foreach (System.Reflection.PropertyInfo property in section.Parameters.DimensionsEnd)
{
object valObj = property.GetValue(section.Parameters.DimensionsEnd, null);
double val = (valObj != null) ? Convert.ToDouble(valObj) : 0;
string valStr = ThisMainExtension.System.Units.DisplayTextFromBase(val, Autodesk.REX.Framework.EUnitType.Dimensions_SectionDim, true);
parametricProperties.AddProperty(add2name + property.Name, valStr);
}
}
}
}
/// <summary>
/// Fill the parametric property control with data.
/// </summary>
private void SetDatabasesProperties()
{
if (ThisMainExtension.Data.DatabaseSection != null)
{
REX.ContentGenerator.Families.REXFamilyType_DBSection section = ThisMainExtension.Data.DatabaseSection;
databasesProperties.ClearProperties();
databasesProperties.AddProperty("Certified", section.Certified.ToString());
databasesProperties.AddProperty("Material", section.Material.ToString());
databasesProperties.AddProperty("Database", section.Parameters.DBName);
databasesProperties.AddProperty("Alias name", section.Parameters.Description.NAME_REVIT);
}
}
/// <summary>
/// Fills the databases list.
/// </summary>
private void SetDatabasesList()
{
if (ThisMainExtension.Data.DatabaseSection != null)
{
foreach (REX.ContentGenerator.Families.REXDBDescription dbdesc in ThisMainExtension.Data.DatabaseRecords)
{
dabasesListBox.Items.Add(dbdesc.DBName);
}
}
}
}
}
@@ -1,245 +0,0 @@
<rexf:REXExtensionMainControl x:Class="REX.ContentGeneratorWPF.Resources.Dialogs.MainControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:rexf="clr-namespace:REX.Common;assembly=REX.Foundation.WPF"
xmlns:rexc="clr-namespace:REX.Controls.WPF;assembly=REX.Controls.WPF"
Height="512" Width="720" SnapsToDevicePixels="True">
<rexf:REXExtensionMainControl.Resources>
<rexf:REXRoutedUICommand x:Key="CommandOpen" Name="Open"/>
<rexf:REXRoutedUICommand x:Key="CommandSave" Name="Save"/>
<rexf:REXRoutedUICommand x:Key="CommandSaveAs" Name="SaveAs"/>
<rexf:REXRoutedUICommand x:Key="CommandPreferences" Name="Preferences"/>
<rexf:REXRoutedUICommand x:Key="CommandPrint" Name="Print"/>
<rexf:REXRoutedUICommand x:Key="CommandClose" Name="Close"/>
<rexf:REXRoutedUICommand x:Key="CommandCalculate" Name="Calculate"/>
<rexf:REXRoutedUICommand x:Key="CommandHelp" Name="Help"/>
<rexf:REXRoutedUICommand x:Key="CommandAbout" Name="About"/>
</rexf:REXExtensionMainControl.Resources>
<rexf:REXExtensionMainControl.CommandBindings>
<CommandBinding Command="{StaticResource CommandOpen}" Executed="CommandBinding_Executed" CanExecute="CommandBinding_CanExecute"/>
<CommandBinding Command="{StaticResource CommandSave}" Executed="CommandBinding_Executed" CanExecute="CommandBinding_CanExecute"/>
<CommandBinding Command="{StaticResource CommandSaveAs}" Executed="CommandBinding_Executed" CanExecute="CommandBinding_CanExecute"/>
<CommandBinding Command="{StaticResource CommandPreferences}" Executed="CommandBinding_Executed" CanExecute="CommandBinding_CanExecute"/>
<CommandBinding Command="{StaticResource CommandPrint}" Executed="CommandBinding_Executed" CanExecute="CommandBinding_CanExecute"/>
<CommandBinding Command="{StaticResource CommandClose}" Executed="CommandBinding_Executed" CanExecute="CommandBinding_CanExecute"/>
<CommandBinding Command="{StaticResource CommandCalculate}" Executed="CommandBinding_Executed" CanExecute="CommandBinding_CanExecute"/>
<CommandBinding Command="{StaticResource CommandHelp}" Executed="CommandBinding_Executed" CanExecute="CommandBinding_CanExecute"/>
<CommandBinding Command="{StaticResource CommandAbout}" Executed="CommandBinding_Executed" CanExecute="CommandBinding_CanExecute"/>
</rexf:REXExtensionMainControl.CommandBindings>
<rexf:REXExtensionMainControl.InputBindings>
<KeyBinding Key="O" Modifiers="Control" Gesture="Ctrl+O" Command="{StaticResource CommandOpen}"/>
<KeyBinding Key="S" Modifiers="Control" Gesture="Ctrl+S" Command="{StaticResource CommandSave}"/>
<KeyBinding Key="P" Modifiers="Control" Gesture="Ctrl+P" Command="{StaticResource CommandPrint}"/>
<KeyBinding Key="F9" Modifiers="" Gesture="F9" Command="{StaticResource CommandCalculate}"/>
<KeyBinding Key="F1" Modifiers="" Gesture="F1" Command="{StaticResource CommandHelp}"/>
</rexf:REXExtensionMainControl.InputBindings>
<DockPanel LastChildFill="True">
<ToolBarPanel DockPanel.Dock="Top">
<StackPanel Orientation="Vertical">
<Menu Name="Menu" Style="{DynamicResource REXMenu}">
<MenuItem Name="MenuItemFile" Header="_File" StaysOpenOnClick="True">
<MenuItem Name="MenuItemOpen" Header="_Open ..." Command="{StaticResource CommandOpen}">
<MenuItem.Icon>
<Image Source="..\other\images\toolbar_open.png" Stretch="None"/>
</MenuItem.Icon>
</MenuItem>
<MenuItem Name="MenuItemSave" Header="_Save" Command="{StaticResource CommandSave}">
<MenuItem.Icon>
<Image Source="..\other\images\toolbar_save.png" Stretch="None"/>
</MenuItem.Icon>
</MenuItem>
<MenuItem Name="MenuItemSaveAs" Header="Save _As ..." Command="{StaticResource CommandSaveAs}">
<MenuItem.Icon>
<Image Source="..\other\images\toolbar_save_as.png" Stretch="None"/>
</MenuItem.Icon>
</MenuItem>
<Separator Name="MenuSeparatorPreferencesTop"/>
<MenuItem Name="MenuItemPreferences" Header="_Preferences ..." Command="{StaticResource CommandPreferences}">
<MenuItem.Icon>
<Image Source="..\other\images\toolbar_save_as.png" Stretch="None"/>
</MenuItem.Icon>
</MenuItem>
<Separator Name="MenuSeparatorPreferencesBottom"/>
<MenuItem Name="MenuItemPrint" Header="Print ..." Command="{StaticResource CommandPrint}">
<MenuItem.Icon>
<Image Source="..\other\images\toolbar_print.png" Stretch="None"/>
</MenuItem.Icon>
</MenuItem>
<Separator Name="MenuSeparatorCloseTop"/>
<MenuItem Name="MenuItemClose" Header="Close" Command="{StaticResource CommandClose}">
<MenuItem.Icon>
<Image Source="..\other\images\toolbar_close.png" Stretch="None"/>
</MenuItem.Icon>
</MenuItem>
</MenuItem>
<MenuItem Name="MenuItemCalculations" Header="_Calculations">
<MenuItem Name="MenuItemCalc" Header="_Calculate" Command="{StaticResource CommandCalculate}">
<MenuItem.Icon>
<Image Source="..\other\images\toolbar_calculate.png" Stretch="None"/>
</MenuItem.Icon>
</MenuItem>
</MenuItem>
<MenuItem Name="MenuItemHelp" Header="_Help">
<MenuItem Name="MenuItemHelpIndex" Header="_Help ..." Command="{StaticResource CommandHelp}">
<MenuItem.Icon>
<Image Source="..\other\images\toolbar_help.png" Stretch="None"/>
</MenuItem.Icon>
</MenuItem>
<Separator Name="ToolStripSeparatorBeforeAbout"/>
<MenuItem Name="MenuItemAbout" Header="_About ..." Command="{StaticResource CommandAbout}">
<MenuItem.Icon>
<Image Source="..\other\images\toolbar_info.png" Stretch="None"/>
</MenuItem.Icon>
</MenuItem>
</MenuItem>
</Menu>
<StackPanel Orientation="Horizontal">
<ToolBar ToolBarTray.IsLocked="True" Name="ToolMenu">
<Menu Style="{DynamicResource REXMenu}">
<MenuItem Name="ToolStripMenuItemFile" Header="_File" StaysOpenOnClick="True">
<MenuItem Name="ToolStripMenuItemOpen" Header="_Open ..." Command="{StaticResource CommandOpen}">
<MenuItem.Icon>
<Image Source="..\other\images\toolbar_open.png" Stretch="None" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Name="ToolStripMenuItemSave" Header="_Save" Command="{StaticResource CommandSave}">
<MenuItem.Icon>
<Image Source="..\other\images\toolbar_save.png" Stretch="None"/>
</MenuItem.Icon>
</MenuItem>
<MenuItem Name="ToolStripMenuItemSaveAs" Header="Save _As ..." Command="{StaticResource CommandSaveAs}">
<MenuItem.Icon>
<Image Source="..\other\images\toolbar_save_as.png" Stretch="None"/>
</MenuItem.Icon>
</MenuItem>
<Separator Name="ToolStripMenuSeparatorPreferencesTop"/>
<MenuItem Name="ToolStripMenuItemPreferences" Header="_Preferences ..." Command="{StaticResource CommandPreferences}">
<MenuItem.Icon>
<Image Source="..\other\images\toolbar_save_as.png" Stretch="None" />
</MenuItem.Icon>
</MenuItem>
<Separator Name="ToolStripMenuSeparatorPreferencesBottom"/>
<MenuItem Name="ToolStripMenuItemPrint" Header="Print ..." Command="{StaticResource CommandPrint}">
<MenuItem.Icon>
<Image Source="..\other\images\toolbar_print.png" Stretch="None"/>
</MenuItem.Icon>
</MenuItem>
<Separator Name="ToolStripMenuSeparatorCloseTop"/>
<MenuItem Name="ToolStripMenuItemClose" Header="Close" Command="{StaticResource CommandClose}">
<MenuItem.Icon>
<Image Source="..\other\images\toolbar_close.png" Stretch="None"/>
</MenuItem.Icon>
</MenuItem>
</MenuItem>
<MenuItem Name="ToolStripMenuItemCalculations" Header="_Calculations">
<MenuItem Name="ToolStripMenuItemCalc" Header="_Calculate" Command="{StaticResource CommandCalculate}">
<MenuItem.Icon>
<Image Source="..\other\images\toolbar_calculate.png" Stretch="None"/>
</MenuItem.Icon>
</MenuItem>
</MenuItem>
<MenuItem Name="ToolStripMenuItemHelp" Header="_Help">
<MenuItem Name="ToolStripMenuItemHelpIndex" Header="_Help ..." Command="{StaticResource CommandHelp}">
<MenuItem.Icon>
<Image Source="..\other\images\toolbar_help.png" Stretch="None"/>
</MenuItem.Icon>
</MenuItem>
<Separator Name="ToolStripMenuSeparatorBeforeAbout"/>
<MenuItem Name="ToolStripMenuItemAbout" Header="_About ..." Command="{StaticResource CommandAbout}">
<MenuItem.Icon>
<Image Source="..\other\images\toolbar_info.png" Stretch="None"/>
</MenuItem.Icon>
</MenuItem>
</MenuItem>
</Menu>
</ToolBar>
<ToolBar ToolBarTray.IsLocked="True" Name="ToolBar">
<Button Name="ToolStripButtonOpen" Command="{StaticResource CommandOpen}">
<Image Source="..\other\images\toolbar_open.png" Stretch="None"/>
<Button.ToolTip>
<Label>Open</Label>
</Button.ToolTip>
</Button>
<Button Name="ToolStripButtonSave" Command="{StaticResource CommandSave}">
<Image Source="..\other\images\toolbar_save.png" Stretch="None"/>
<Button.ToolTip>
<Label>Save</Label>
</Button.ToolTip>
</Button>
<Separator Name="ToolStripSeparatorPreferencesLeft"/>
<Button Name="ToolStripPreferences" Command="{StaticResource CommandCalculate}">
<Image Source="..\other\images\toolbar_rs.png" Stretch="None"/>
<Button.ToolTip>
<Label>Save As</Label>
</Button.ToolTip>
</Button>
<Separator Name="ToolStripSeparatorPreferencesRight"/>
<Button Name="ToolStripCalculate" Command="{StaticResource CommandCalculate}">
<Image Source="..\other\images\toolbar_calculate.png" Stretch="None"/>
<Button.ToolTip>
<Label>Calculate</Label>
</Button.ToolTip>
</Button>
<Separator Name="ToolStripSeparatorAC"/>
<Button Name="ToolStripButtonHelp" Command="{StaticResource CommandHelp}">
<Image Source="..\other\images\toolbar_help.png" Stretch="None"/>
<Button.ToolTip>
<Label>Help</Label>
</Button.ToolTip>
</Button>
</ToolBar>
</StackPanel>
</StackPanel>
</ToolBarPanel>
<Grid Name="HSplitGrid">
<Grid.RowDefinitions>
<RowDefinition Height="350*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<GridSplitter Name="HSplit" Grid.Row="0" Height="2" HorizontalAlignment="Stretch" VerticalAlignment="Bottom"/>
<Grid Name="HSplitGridTop" Grid.Row="0">
<DockPanel Name="VSplitGrid" LastChildFill="True" Grid.Row="0">
<Grid Name="VSplitGridLeft">
<rexc:REXToolbox Width="200" MinWidth="200" Name="Toolbox" BorderThickness="1" Background="{x:Static SystemColors.WindowBrush}" SelectedItemChanged="Toolbox_SelectedItemChanged" BorderBrush="{x:Static SystemColors.ControlDarkBrush}" ItemBorderThickness="1" IsItemsHost="False">
</rexc:REXToolbox>
</Grid>
<GridSplitter Name="VSplit" Width="2" HorizontalAlignment="Right" VerticalAlignment="Stretch"/>
<Grid Name="VSplitGridRight">
<Grid Name="DialogContainer" Visibility="Hidden">
</Grid>
<Grid Name="ViewContainer" Visibility="Hidden">
</Grid>
<Grid Name="NoteContainer" Visibility="Hidden">
</Grid>
<TabControl Name="TabControl" Visibility="Hidden" Background="Transparent">
<TabItem Name="TabDialog" Header="Properties" Visibility="Hidden" ></TabItem>
<TabItem Name="TabView" Header="View" Visibility="Hidden"></TabItem>
<TabItem Name="TabNote" Header="Note" Visibility="Hidden"></TabItem>
</TabControl>
</Grid>
</DockPanel>
</Grid>
<Grid Name="HSplitGridBottom" Grid.Row="1">
</Grid>
<StatusBar Name="Status" Grid.Row="2" Height="30">
<StatusBarItem HorizontalContentAlignment="Left">
<Label Name="StatusHeaderLabel"></Label>
</StatusBarItem>
<StatusBarItem HorizontalContentAlignment="Left">
<Label Name="StatusLabel"></Label>
</StatusBarItem>
<StatusBarItem HorizontalContentAlignment="Right">
<ProgressBar Name="StatusProgress" Width="100" Height="16" Grid.Column="1"/>
</StatusBarItem>
</StatusBar>
</Grid>
</DockPanel>
</rexf:REXExtensionMainControl>
@@ -1,96 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Autodesk.REX.Framework;
namespace REX.ContentGeneratorWPF.Resources.Dialogs
{
/// <summary>
/// Interaction logic for MainControl.xaml
/// </summary>
public partial class MainControl : REX.Common.REXExtensionMainControl
{
public MainControl()
{
InitializeComponent();
}
public MainControl(REX.Common.REXExtension extension)
: base(extension)
{
InitializeComponent();
}
protected override void OnRender(DrawingContext drawingContext)
{
base.OnRender(drawingContext);
}
private void Toolbox_SelectedItemChanged(object sender, REX.Controls.WPF.REXToolboxItem item)
{
base.Toolbox_SelectItem(sender, item);
}
private void CommandBinding_Executed(object sender, ExecutedRoutedEventArgs e)
{
if (e.Command is REX.Common.REXRoutedUICommand)
RunCommand((e.Command as REX.Common.REXRoutedUICommand).Name);
}
private void CommandBinding_CanExecute(object sender, CanExecuteRoutedEventArgs e)
{
if (e.Command is REX.Common.REXRoutedUICommand)
e.CanExecute = CanRunCommand((e.Command as REX.Common.REXRoutedUICommand).Name);
else
e.CanExecute = true;
}
private bool CanRunCommand(string Name)
{
return true;
}
private void RunCommand(string Name)
{
REXCommand Cmd = null;
switch (Name)
{
case "Open":
ThisExtension.System.LoadFromFile(true);
return;
case "Save":
ThisExtension.System.SaveToFile(false, true);
return;
case "SaveAs":
ThisExtension.System.SaveToFile(true);
return;
case "Calculate":
Cmd = new REXCommand(REXCommandType.Run);
break;
case "Help":
Cmd = new REXCommand(REXCommandType.Help);
break;
case "Close":
Cmd = new REXCommand(REXCommandType.Close);
break;
case "About":
Cmd = new REXCommand(REXCommandType.About);
break;
case "Preferences":
ThisExtension.ShowPreferencesDialog();
break;
}
if (Cmd != null)
ThisExtension.Command(ref Cmd);
}
}
}
@@ -1,26 +0,0 @@
<rexf:REXExtensionWindow x:Class="REX.ContentGeneratorWPF.Resources.Dialogs.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:rexf="clr-namespace:REX.Common;assembly=REX.Foundation.WPF"
Title="ContentGeneratorWPF" Height="527" Width="791" MinWidth="500" MinHeight="200" Background="{x:Static SystemColors.ControlBrush}" ShowInTaskbar="False" WindowStartupLocation="CenterOwner" SnapsToDevicePixels="True"
Closing="REXExtensionWindow_Closing">
<Grid>
<Grid Height="45" Name="Buttons" VerticalAlignment="Bottom">
<TextBlock Name="Help" Margin="6,13,0,9" HorizontalAlignment="Left" Width="111.5">
<Hyperlink Click="HyperlinkHelp_Click">
Help
</Hyperlink>
</TextBlock>
<TextBlock Name="About" Margin="132,13,0,9" HorizontalAlignment="Left" Width="146">
<Hyperlink Click="HyperlinkAbout_Click">
About
</Hyperlink>
</TextBlock>
<Button Margin="0,13,87,9" Name="ButtonApply" HorizontalAlignment="Right" Width="75" Click="ButtonApply_Click">OK</Button>
<Button Margin="0,13,6,9" Name="ButtonClose" HorizontalAlignment="Right" Width="75" Click="ButtonClose_Click">Cancel</Button>
<Image Margin="310,2,258,2" Name="Logo" Stretch="None" MinWidth="50" />
</Grid>
<Grid Name="MainPanel" Margin="0,0,0,43" />
</Grid>
</rexf:REXExtensionWindow>
@@ -1,68 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Autodesk.REX.Framework;
namespace REX.ContentGeneratorWPF.Resources.Dialogs
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : REX.Common.REXExtensionWindow
{
public MainWindow()
{
InitializeComponent();
}
public MainWindow(REX.Common.REXExtension extension)
: base(extension)
{
InitializeComponent();
}
private void ButtonApply_Click(object sender, RoutedEventArgs e)
{
REXCommand Cmd = new REXCommand(REXCommandType.OK);
ThisExtension.Command(ref Cmd);
}
private void ButtonClose_Click(object sender, RoutedEventArgs e)
{
REXCommand Cmd = new REXCommand(REXCommandType.Close);
Cmd.CommandObject = false;
ThisExtension.Command(ref Cmd);
}
private void REXExtensionWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
REXCommand Cmd = new REXCommand(REXCommandType.Close);
Cmd.CommandObject = true;
if (((bool)ThisExtension.Command(ref Cmd)) == true)
e.Cancel = false;
else
e.Cancel = true;
}
private void HyperlinkHelp_Click(object sender, RoutedEventArgs e)
{
REXCommand Cmd = new REXCommand(REXCommandType.Help);
ThisExtension.Command(ref Cmd);
}
private void HyperlinkAbout_Click(object sender, RoutedEventArgs e)
{
REXCommand Cmd = new REXCommand(REXCommandType.About);
ThisExtension.Command(ref Cmd);
}
}
}
@@ -1,22 +0,0 @@
<UserControl x:Class="REX.ContentGeneratorWPF.Resources.Dialogs.PolygonViewer"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<Grid>
<Border BorderThickness="1" BorderBrush="Gray" Background="White">
<Path Stroke="Black" StrokeThickness="1">
<Path.Fill>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
<GradientStop Color="White" Offset="0"/>
<GradientStop Color="Gray" Offset="1"/>
</LinearGradientBrush>
</Path.Fill>
<Path.Data>
<PathGeometry x:Name="pathGeometry" FillRule="Nonzero">
</PathGeometry>
</Path.Data>
</Path>
</Border>
</Grid>
</UserControl>
@@ -1,140 +0,0 @@
//
// (C) Copyright 2007-2011 by Autodesk, Inc. All rights reserved.
//
// 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 ITS 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.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using REX.Common.Geometry;
namespace REX.ContentGeneratorWPF.Resources.Dialogs
{
/// <summary>
/// Represents control which allows the user to draw polygons.
/// </summary>
public partial class PolygonViewer : UserControl
{
/// <summary>
/// The bounding box of the polygon.
/// </summary>
BoundingBoxREXxyz BoundBox;
/// <summary>
/// The shape of the polygon.
/// </summary>
List<REXxyz> Points;
/// <summary>
/// Initializes a new instance of the <see cref="PolygonViewer"/> class.
/// </summary>
public PolygonViewer()
{
InitializeComponent();
}
/// <summary>
/// Draws the specified polygon.
/// </summary>
/// <param name="points">The points.</param>
public void DrawPolygon(List<REXxyz> points)
{
Points = points;
SetBoundingBox();
DrawPolygon();
}
/// <summary>
/// Initializes the bounding box of the polygon.
/// </summary>
private void SetBoundingBox()
{
BoundBox = new BoundingBoxREXxyz();
foreach (REXxyz pt in Points)
BoundBox.AddPoint(pt);
}
/// <summary>
/// Draws the polygon based on the saved point list.
/// </summary>
private void DrawPolygon()
{
//In order to draw the whole drawing in the center of the viewer some additional
//calculation is required.
if (Points != null && BoundBox != null)
{
REXxyz dx = BoundBox.Max - BoundBox.Min;
PolyLineSegment polyline = new PolyLineSegment();
//The assumption is that there will be empty frame of 0.1*Max(width,height) around
//the drawing. To get the most extreme case the coefficients in x any y direction are
//calculated.
double coeffX = 0.8 * this.ActualWidth / dx.x;
double coeffY = 0.8 * this.ActualHeight / dx.y;
double coeff;
double xstart;
double ystart;
if (coeffX < coeffY)
{
coeff = coeffX;
xstart = 0.1 * this.ActualWidth;
ystart = 0.1 * this.ActualHeight + (0.8*this.ActualHeight -(coeffX * dx.y)) / 2;
}
else
{
coeff = coeffY;
ystart = 0.1 * this.ActualHeight;
xstart = 0.1 * this.ActualWidth + (0.8 * this.ActualWidth - (coeffY * dx.x)) / 2;
}
for (int i = 0; i < Points.Count; i++ )
{
REXxyz pt = Points[i];
polyline.Points.Add(new Point(xstart + (pt.x - BoundBox.Min.x) * coeff,this.ActualHeight - (ystart + (pt.y - BoundBox.Min.y) * coeff)));
}
pathGeometry.Figures.Clear();
REXxyz startPt = Points[0];
PathFigure pathFigure = new PathFigure(new Point(xstart + (startPt.x - BoundBox.Min.x) * coeff,this.ActualHeight - (ystart + (startPt.y - BoundBox.Min.y) * coeff)),new List<PathSegment>(){polyline},true);
pathFigure.Segments.Add(polyline);
pathGeometry.Figures.Add(pathFigure);
}
}
/// <summary>
/// Raises the <see cref="E:System.Windows.FrameworkElement.SizeChanged"/> event, using the specified information as part of the eventual event data.
/// </summary>
/// <param name="sizeInfo">Details of the old and new size involved in the change.</param>
protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)
{
base.OnRenderSizeChanged(sizeInfo);
DrawPolygon();
}
}
}
@@ -1,14 +0,0 @@
<UserControl x:Class="REX.ContentGeneratorWPF.Resources.Dialogs.PropertiesControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<Grid>
<Border BorderThickness="1" BorderBrush="Gray">
<ScrollViewer VerticalScrollBarVisibility="Auto" >
<StackPanel Name="stackPanel1">
</StackPanel>
</ScrollViewer>
</Border>
</Grid>
</UserControl>
@@ -1,90 +0,0 @@
//
// (C) Copyright 2007-2011 by Autodesk, Inc. All rights reserved.
//
// 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 ITS 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.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using REX.ContentGeneratorWPF.Main;
namespace REX.ContentGeneratorWPF.Resources.Dialogs
{
/// <summary>
/// Represents the control which allows the user to present the list of properties.
/// </summary>
public partial class PropertiesControl : UserControl
{
/// <summary>
/// Initializes a new instance of the <see cref="PropertiesControl"/> class.
/// </summary>
public PropertiesControl()
{
InitializeComponent();
}
/// <summary>
/// Adds the property to the list.
/// </summary>
/// <param name="item">The item.</param>
public void AddProperty(PropertyItem item)
{
stackPanel1.Children.Add(new PropertyControl(item));
}
/// <summary>
/// Adds the property to the list.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="value">The value.</param>
public void AddProperty(string name, string value)
{
stackPanel1.Children.Add(new PropertyControl(name, value));
}
/// <summary>
/// Adds the category to the list.
/// </summary>
/// <param name="name">The name.</param>
public void AddCategory(string name)
{
TextBlock block = new TextBlock();
block.FontWeight = FontWeights.Bold;
block.Text = name;
block.Margin = new Thickness(3,6,3,3);
stackPanel1.Children.Add(block);
Separator separator = new Separator();
stackPanel1.Children.Add(separator);
}
/// <summary>
/// Clears the property list.
/// </summary>
public void ClearProperties()
{
stackPanel1.Children.Clear();
}
}
}
@@ -1,20 +0,0 @@
<UserControl x:Class="REX.ContentGeneratorWPF.Resources.Dialogs.PropertyControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<DockPanel>
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Margin="2" Grid.Row="0" Grid.Column="0" Text="{Binding Name}" Padding="2"/>
<Border Margin="2" BorderThickness="1" BorderBrush="Gray" Grid.Row="0" Grid.Column="1">
<TextBlock Background="White" Padding="2" Text="{Binding Value}"/>
</Border>
</Grid>
</DockPanel>
</UserControl>
@@ -1,66 +0,0 @@
//
// (C) Copyright 2007-2011 by Autodesk, Inc. All rights reserved.
//
// 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 ITS 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.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using REX.ContentGeneratorWPF.Main;
namespace REX.ContentGeneratorWPF.Resources.Dialogs
{
/// <summary>
/// Interaction logic for PropertyControl.xaml
/// </summary>
public partial class PropertyControl : UserControl
{
public PropertyItem PropertyItem { get; private set; }
public PropertyControl(PropertyItem item)
{
InitializeComponent();
PropertyItem = item;
DataContext = PropertyItem;
}
public PropertyControl(string name, string value)
{
InitializeComponent();
PropertyItem = new PropertyItem() { Name = name, Value = value };
DataContext = PropertyItem;
}
public PropertyControl()
{
InitializeComponent();
PropertyItem = new PropertyItem();
DataContext = PropertyItem;
}
}
}
@@ -1,19 +0,0 @@
<rexf:REXExtensionControl x:Class="REX.ContentGeneratorWPF.Resources.Dialogs.SelectedElementControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:rexf="clr-namespace:REX.Common;assembly=REX.Foundation.WPF"
xmlns:rexc="clr-namespace:REX.Controls.WPF;assembly=REX.Controls.WPF"
xmlns:local="clr-namespace:REX.ContentGeneratorWPF.Resources.Dialogs"
Height="315" Width="431">
<Grid>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<local:PropertiesControl x:Name="propertiesControl" Grid.Column="0" Grid.Row="0"></local:PropertiesControl>
<local:UserControlView x:Name="viewer" Grid.Column="1" Grid.Row="0"></local:UserControlView>
</Grid>
</rexf:REXExtensionControl>
@@ -1,82 +0,0 @@
//
// (C) Copyright 2007-2011 by Autodesk, Inc. All rights reserved.
//
// 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 ITS 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.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace REX.ContentGeneratorWPF.Resources.Dialogs
{
/// <summary>
/// Represents the control which allows the user to see the properties of the selected element.
/// </summary>
public partial class SelectedElementControl : REX.Common.REXExtensionControl
{
/// <summary>
/// Gets the main extension.
/// </summary>
/// <value>The main extension.</value>
internal Extension ThisMainExtension
{
get
{
return (Extension)ThisExtension;
}
}
/// <summary>
/// Initializes a new instance of the <see cref="SelectedElementControl"/> class.
/// </summary>
public SelectedElementControl()
{
InitializeComponent();
}
/// <summary>
/// Initializes a new instance of the <see cref="SelectedElementControl"/> class.
/// </summary>
/// <param name="extension">The extension.</param>
public SelectedElementControl(REX.Common.REXExtension extension)
: base(extension)
{
InitializeComponent();
}
/// <summary>
/// Initializes the dialog with current settings.
/// </summary>
public void SetDialog()
{
propertiesControl.ClearProperties();
foreach (Main.PropertyItem item in ThisMainExtension.Data.SelectedElementProperties)
propertiesControl.AddProperty(item);
viewer.DrawGeometry(ThisMainExtension.Data.SelectedElementGeometry);
}
}
}
@@ -1,53 +0,0 @@
<rexf:REXExtensionControl x:Class="REX.ContentGeneratorWPF.Resources.Dialogs.UserControlView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:rexf="clr-namespace:REX.Common;assembly=REX.Foundation.WPF"
xmlns:rexc="clr-namespace:REX.Controls.WPF;assembly=REX.Controls.WPF">
<UserControl.Triggers>
<EventTrigger RoutedEvent="UserControl.Loaded" >
<BeginStoryboard>
<Storyboard Name="storyBoardZ">
<DoubleAnimation
Storyboard.TargetName="rotationZ"
Storyboard.TargetProperty="Angle"
From="0" To="360" Duration="0:0:15" RepeatBehavior="Forever"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</UserControl.Triggers>
<Grid Background="White">
<Border BorderThickness="1" BorderBrush="Gray">
<Viewport3D x:Name="viewport">
<ModelVisual3D x:Name="model">
<ModelVisual3D.Content>
<Model3DGroup x:Name="group">
<GeometryModel3D>
<GeometryModel3D.Transform>
<RotateTransform3D>
<RotateTransform3D.Rotation>
<AxisAngleRotation3D x:Name="rotationZ"
Angle="0" Axis="0,0,1"/>
</RotateTransform3D.Rotation>
</RotateTransform3D>
</GeometryModel3D.Transform>
<GeometryModel3D.Geometry>
<MeshGeometry3D x:Name="geometry"/>
</GeometryModel3D.Geometry>
<GeometryModel3D.Material>
<DiffuseMaterial Brush="Gray" />
</GeometryModel3D.Material>
</GeometryModel3D>
<Model3DGroup>
<DirectionalLight x:Name="directionLight" Color="White" Direction="2,0,0" />
<DirectionalLight x:Name="directionLight2" Color="White" Direction="2,0,0" />
</Model3DGroup>
</Model3DGroup>
</ModelVisual3D.Content>
</ModelVisual3D>
<Viewport3D.Camera>
<OrthographicCamera x:Name="camera" Position="50,50,-100" UpDirection="1,1,0" LookDirection="-0,-0,1" />
</Viewport3D.Camera>
</Viewport3D>
</Border>
</Grid>
</rexf:REXExtensionControl>
@@ -1,177 +0,0 @@
//
// (C) Copyright 2007-2011 by Autodesk, Inc. All rights reserved.
//
// 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 ITS 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.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using REX.Common.Geometry;
using System.Windows.Media.Media3D;
namespace REX.ContentGeneratorWPF.Resources.Dialogs
{
/// <summary>
/// Interaction logic for SubControl.xaml
/// </summary>
public partial class UserControlView : REX.Common.REXExtensionControl
{
/// <summary>
/// Represents the bounding box of the whole element.
/// </summary>
BoundingBoxREXxyz BoundBox;
/// <summary>
/// The current geometry.
/// </summary>
List<Main.Triangle> Triangles;
/// <summary>
/// Initializes a new instance of the <see cref="UserControlView"/> class.
/// </summary>
public UserControlView()
{
InitializeComponent();
}
/// <summary>
/// Initializes a new instance of the <see cref="UserControlView"/> class.
/// </summary>
/// <param name="extension">The extension.</param>
public UserControlView(REX.Common.REXExtension extension)
: base(extension)
{
InitializeComponent();
}
/// <summary>
/// Draws the specified geometry described by the list of triangles.
/// </summary>
/// <param name="triangles">The triangles.</param>
public void DrawGeometry(List<Main.Triangle> triangles)
{
Triangles = triangles;
SetBoundingBox();
DrawTriangles();
SetCameraPosition();
}
/// <summary>
/// Sets the bounding box based on the current list of triangles.
/// </summary>
void SetBoundingBox()
{
BoundingBoxREXxyz boundBox = new BoundingBoxREXxyz();
foreach (Main.Triangle tr in Triangles)
{
boundBox.AddPoint(tr.Pt1);
boundBox.AddPoint(tr.Pt2);
boundBox.AddPoint(tr.Pt3);
}
BoundBox = boundBox;
}
/// <summary>
/// Draws all triangles.
/// </summary>
void DrawTriangles()
{
geometry.TriangleIndices.Clear();
geometry.Positions.Clear();
foreach (Main.Triangle triangle in Triangles)
DrawTriangle(triangle, geometry);
}
/// <summary>
/// Draws the specified triangle.
/// </summary>
/// <param name="triangle">The triangle.</param>
/// <param name="geometry">The geometry.</param>
void DrawTriangle(Main.Triangle triangle, MeshGeometry3D geometry)
{
int count = geometry.Positions.Count;
REXxyz centerBoundBox = BoundBox.GetCenter();
//All points are translated in this way to obtain the center of the bounding box in (0,0,0).
geometry.Positions.Add(GetPoint3D(triangle.Pt1 - centerBoundBox));
geometry.Positions.Add(GetPoint3D(triangle.Pt2 - centerBoundBox));
geometry.Positions.Add(GetPoint3D(triangle.Pt3 - centerBoundBox));
geometry.TriangleIndices.Add(count);
geometry.TriangleIndices.Add(count+1);
geometry.TriangleIndices.Add(count+2);
}
/// <summary>
/// Sets the camera position.
/// </summary>
void SetCameraPosition()
{
//The 0,0,0 point is the center of the scene.
//Animation rotates the object about Z axis.
REXxyz boundBoxDX = BoundBox.Max - BoundBox.Min;
REXxyz centerBox = BoundBox.GetCenter();
//The start LookDirection is calculated based on the center and the maximum point
//of the bounding box.
REXxyz dx = centerBox - BoundBox.Max;
//The camera used in this sample is an OrthographicCamera and to be sure that all
//content is visible on the viewer the appropriate width is calculated based on
//the diagonal of the bounding box
double width = dx.GetLength() * 2.2;
//In order to have better view of the element some modification of the LookDirection
//is required
//for horizontal elements - to see them more from the top
if (boundBoxDX.x > boundBoxDX.z || boundBoxDX.y > boundBoxDX.z)
{
dx.z *= 10;
}
else//for vertical elements - to see them more from the side
{
dx.z /= 10;
}
REXxyz dxUnit = dx.GetUnitVector();
//The position of the camera is calculated based on the center of the bounding box
//(which is in 0,0,0) and some default distance - here 100
camera.Position = new Point3D( - dxUnit.x * 100, - dxUnit.y * 100, - dxUnit.z * 100);
camera.LookDirection = new Vector3D(dxUnit.x, dxUnit.y, dxUnit.z);
directionLight.Direction = camera.LookDirection;
directionLight2.Direction = new Vector3D(dxUnit.x, dxUnit.y, 0);
REXxyz upDir = dxUnit.CrossProduct(new REXxyz(0, 0, 1)).CrossProduct(new REXxyz(dxUnit));
camera.UpDirection = new Vector3D(upDir.x, upDir.y, upDir.z);
camera.Width = width;
}
Point3D GetPoint3D(REXxyz pt)
{
return new Point3D(pt.x, pt.y, pt.z);
}
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 421 KiB

Some files were not shown because too many files have changed in this diff Show More