added Revit 2022 SDK minus except *rvt and *rfa

This commit is contained in:
Jeremy Tammik
2021-04-20 11:36:21 +02:00
parent 1133a82dc5
commit 7e327986e8
3034 changed files with 1245318 additions and 0 deletions
@@ -0,0 +1,55 @@
'
' (C) Copyright 2003-2019 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.
'
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("")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("")>
<Assembly: AssemblyCopyright("")>
<Assembly: AssemblyTrademark("")>
<Assembly: CLSCompliant(True)>
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("229DE7B9-C5AC-44ED-BB4C-66457079725C")>
' 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.*")>
@@ -0,0 +1,68 @@
'
' (C) Copyright 2003-2019 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.
'
Option Explicit On
Imports System
Imports System.Windows
Imports Autodesk.Revit
Imports Autodesk.Revit.DB
Imports Autodesk.Revit.UI
''' <summary>
''' Implements the Revit add-in interface IExternalCommand
''' </summary>
''' <remarks></remarks>
<Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)> _
<Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)> _
<Autodesk.Revit.Attributes.Journaling(Autodesk.Revit.Attributes.JournalingMode.NoCommandData)> _
Public Class RevitViewer
Implements IExternalCommand
''' <summary>
''' Implement this method as an external command for Revit.
''' </summary>
''' <param name="commandData">An object that is passed to the external application
''' which contains data related to the command,
''' such as the application object and active view.</param>
''' <param name="message">A message that can be set by the external application
''' which will be displayed if a failure or cancellation is returned by
''' the external command.</param>
''' <param name="elements">A set of elements to which the external application
''' can add elements that are to be highlighted in case of failure or cancellation.</param>
''' <returns>Return the status of the external command.
''' A result of Succeeded means that the API external method functioned as expected.
''' Cancelled can be used to signify that the user cancelled the external operation
''' at some point. Failure should be returned if the application is unable to proceed with
''' the operation.</returns>
Public Function Execute(ByVal commandData As ExternalCommandData, ByRef message As String, ByVal elements As Autodesk.Revit.DB.ElementSet) As Autodesk.Revit.UI.Result Implements IExternalCommand.Execute
MsgBox("This is a utility DLL for use with ElementViewer and RoomViewer Samples and cannot be run as a command")
Return Autodesk.Revit.UI.Result.Succeeded
End Function
End Class
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<RevitAddIns>
<AddIn Type="Command">
<Assembly>RevitViewer.dll</Assembly>
<ClientId>aca40010-f295-4a7e-a042-218fc21c363f</ClientId>
<FullClassName>Revit.SDK.Samples.RevitViewer.VB.NET.RevitViewer</FullClassName>
<Text>Revit Viewer</Text>
<Description>View geometry information.</Description>
<VisibilityMode>AlwaysVisible</VisibilityMode>
<VendorId>ADSK</VendorId>
<VendorDescription>Autodesk, www.autodesk.com</VendorDescription>
</AddIn>
</RevitAddIns>
@@ -0,0 +1,164 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectType>Local</ProjectType>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{F2A04D84-B791-4738-A226-D38CDD8EBF87}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon>
</ApplicationIcon>
<AssemblyKeyContainerName>
</AssemblyKeyContainerName>
<AssemblyName>RevitViewer</AssemblyName>
<AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile>
<AssemblyOriginatorKeyMode>None</AssemblyOriginatorKeyMode>
<DefaultClientScript>JScript</DefaultClientScript>
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
<OutputType>Library</OutputType>
<OptionCompare>Binary</OptionCompare>
<OptionExplicit>On</OptionExplicit>
<OptionStrict>Off</OptionStrict>
<RootNamespace>Revit.SDK.Samples.RevitViewer.VB.NET</RootNamespace>
<StartupObject>
</StartupObject>
<FileUpgradeFlags>
</FileUpgradeFlags>
<MyType>Windows</MyType>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>bin\</OutputPath>
<DocumentationFile>RevitViewer.xml</DocumentationFile>
<BaseAddress>285212672</BaseAddress>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>
</DefineConstants>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<DebugSymbols>true</DebugSymbols>
<Optimize>false</Optimize>
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningLevel>1</WarningLevel>
<NoWarn>42016,42017,42018,42019,42032</NoWarn>
<DebugType>full</DebugType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>bin\</OutputPath>
<DocumentationFile>RevitViewer.xml</DocumentationFile>
<BaseAddress>285212672</BaseAddress>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>
</DefineConstants>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<DebugSymbols>false</DebugSymbols>
<Optimize>true</Optimize>
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningLevel>1</WarningLevel>
<NoWarn>42016,42017,42018,42019,42032</NoWarn>
<DebugType>none</DebugType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Debug\</OutputPath>
<BaseAddress>285212672</BaseAddress>
<DocumentationFile>RevitViewer.xml</DocumentationFile>
<WarningLevel>1</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<NoWarn>42016,42017,42018,42019,42032</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Release\</OutputPath>
<BaseAddress>285212672</BaseAddress>
<DocumentationFile>RevitViewer.xml</DocumentationFile>
<Optimize>true</Optimize>
<WarningLevel>1</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<NoWarn>42016,42017,42018,42019,42032</NoWarn>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System">
<Name>System</Name>
</Reference>
<Reference Include="System.Data">
<Name>System.Data</Name>
</Reference>
<Reference Include="System.Drawing">
<Name>System.Drawing</Name>
</Reference>
<Reference Include="System.Windows.Forms">
<Name>System.Windows.Forms</Name>
</Reference>
<Reference Include="System.Xml">
<Name>System.XML</Name>
</Reference>
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Data" />
<Import Include="System.Diagnostics" />
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.vb">
<SubType>Code</SubType>
</Compile>
<Compile Include="Main.vb">
<SubType>Code</SubType>
</Compile>
<Compile Include="Viewer\Line.vb">
<SubType>Code</SubType>
</Compile>
<Compile Include="Viewer\Point.vb">
<SubType>Code</SubType>
</Compile>
<Compile Include="Viewer\ViewerWindow.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="Viewer\Wireframe.vb">
<SubType>Code</SubType>
</Compile>
<EmbeddedResource Include="Viewer\ViewerWindow.resx">
<DependentUpon>ViewerWindow.vb</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Folder Include="My Project\" />
</ItemGroup>
<Import Project="$(SolutionDir)VSProps\SDKSamples.VB.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>set FILEFORSAMPLEREG="$(SolutionDir)..\..\..\..\Regression\API\SDKSamples\UpdateSampleDllForRegression.pl"
if exist %25FILEFORSAMPLEREG%25 perl %25FILEFORSAMPLEREG%25 $(ProjectExt) "$(ProjectPath)" "$(TargetPath)" "$(SolutionDir)"</PostBuildEvent>
</PropertyGroup>
<PropertyGroup>
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
</PropertyGroup>
</Project>
@@ -0,0 +1,32 @@
'
' (C) Copyright 2003-2019 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.
'
''' <summary>
''' Wrapped line object.
''' </summary>
''' <remarks></remarks>
Public Class Line
Public startPoint As New Point
Public endPoint As New Point
End Class
@@ -0,0 +1,33 @@
'
' (C) Copyright 2003-2019 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.
'
''' <summary>
''' Wrpped point object.
''' </summary>
''' <remarks></remarks>
Public Class Point
Public X As Double
Public Y As Double
Public Z As Double
End Class
@@ -0,0 +1,229 @@
<?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=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>
<metadata name="ViewerToolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="PanLeftButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAF9JREFUOE+1kkEK
ACAIBHu6T/NnxVZKeNKVgg6BMy3qGL+Oqk7aDZgWGEwJXrgsiHDmLSKnT5niWAN4CzqwJUCM8vUEd9Zl
AT71HnQkcdliEmoZXwklAGQSWmCSliAFL7hz6VPbzT4vAAAAAElFTkSuQmCC
</value>
</data>
<data name="PanUpButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAGRJREFUOE/tk1EK
ACEIRDu6R/Nmuw0kuKaWbJ8JfsV7kMO0lgwzP/0ZWx/ASlCTCGwEexINO4JcYuFA4Es8OBF8JRG8EMTf
+XVEBH4FB29ARFKmWqmQAmDZ0ci9LiBGDRvJVOsXyl7pUzDC0JsAAAAASUVORK5CYII=
</value>
</data>
<data name="PanRightButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAF1JREFUOE+90tEJ
ACAIBFBHdzQ3qywMKQjuhAL/uqdYIj+OmbVSHwdKSAA0koELUdU5Hlp7Jw6UkABoJANjLH8urAKAg6uR
iAN0GPhdZxMguq5mAA5ngAoHQIefwQ4yo+3TwQ+rEQAAAABJRU5ErkJggg==
</value>
</data>
<data name="PanDownButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAG5JREFUOE/tk9EJ
ACEMQ3WzjtbRuplaOCFo6l39PkGEYJ/BtLWQZWaN6SJSmb5pqtocgntcolAKdABCnuI8wCFQ/ANuUvj8
iTM2di4pxKlEkANg76GEg7ijVwhx8D4OCLnqRH9iQtJzgP4gxtB2Bx7Mwpp8HAKfAAAAAElFTkSuQmCC
</value>
</data>
<data name="RotateDownButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAG5JREFUOE/tk9EJ
ACEMQ3WzjtbRuplaOCFo6l39PkGEYJ/BtLWQZWaN6SJSmb5pqtocgntcolAKdABCnuI8wCFQ/ANuUvj8
iTM2di4pxKlEkANg76GEg7ijVwhx8D4OCLnqRH9iQtJzgP4gxtB2Bx7Mwpp8HAKfAAAAAElFTkSuQmCC
</value>
</data>
<data name="RotateRightButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAF1JREFUOE+90tEJ
ACAIBFBHdzQ3qywMKQjuhAL/uqdYIj+OmbVSHwdKSAA0koELUdU5Hlp7Jw6UkABoJANjLH8urAKAg6uR
iAN0GPhdZxMguq5mAA5ngAoHQIefwQ4yo+3TwQ+rEQAAAABJRU5ErkJggg==
</value>
</data>
<data name="RotateLeftButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAF9JREFUOE+1kkEK
ACAIBHu6T/NnxVZKeNKVgg6BMy3qGL+Oqk7aDZgWGEwJXrgsiHDmLSKnT5niWAN4CzqwJUCM8vUEd9Zl
AT71HnQkcdliEmoZXwklAGQSWmCSliAFL7hz6VPbzT4vAAAAAElFTkSuQmCC
</value>
</data>
<data name="RotateUpButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAGRJREFUOE/tk1EK
ACEIRDu6R/Nmuw0kuKaWbJ8JfsV7kMO0lgwzP/0ZWx/ASlCTCGwEexINO4JcYuFA4Es8OBF8JRG8EMTf
+XVEBH4FB29ARFKmWqmQAmDZ0ci9LiBGDRvJVOsXyl7pUzDC0JsAAAAASUVORK5CYII=
</value>
</data>
<data name="ZoomInButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAGRJREFUOE/tk1EK
ACEIRDu6R/Nmuw0kuKaWbJ8JfsV7kMO0lgwzP/0ZWx/ASlCTCGwEexINO4JcYuFA4Es8OBF8JRG8EMTf
+XVEBH4FB29ARFKmWqmQAmDZ0ci9LiBGDRvJVOsXyl7pUzDC0JsAAAAASUVORK5CYII=
</value>
</data>
<data name="ZoomOutButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAG5JREFUOE/tk9EJ
ACEMQ3WzjtbRuplaOCFo6l39PkGEYJ/BtLWQZWaN6SJSmb5pqtocgntcolAKdABCnuI8wCFQ/ANuUvj8
iTM2di4pxKlEkANg76GEg7ijVwhx8D4OCLnqRH9iQtJzgP4gxtB2Bx7Mwpp8HAKfAAAAAElFTkSuQmCC
</value>
</data>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>114</value>
</metadata>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAIAICAQAAAAAADoAgAAJgAAABAQEAAAAAAAKAEAAA4DAAAoAAAAIAAAAEAAAAABAAQAAAAAAIAC
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAgAAAAICAAIAAAACAAIAAgIAAAICAgADAwMAAAAD/AAD/
AAAA//8A/wAAAP8A/wD//wAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAREAAAAAAAAAAAAAAAAAABEREAAAAAAAAAAAAAA
AAAEREREAAAAAAAAAAAAAAAARERERAAAAAAAAAAAAAAABERERIQAAAAAAAAAAAAAAEREREj0AAAAAAAA
AAAAAARERESPhEREREREQAAAAABERERI+PREREREREQAAAAEREREj4+EREREREREQAAARERESPj49ERE
REREREQABERERI+Pj4REREREREREQAxEREj4+Pj4+Pj4+Pj4+EAAxESPj4+Pj4+Pj4+Pj49AAAxI+Pj4
+Pj4+Pj4+Pj4QAAAxI+Pj4+Pj4+Pj4+Pj0AAAAxI+Pj4+Pj4+Pj4+PhAAAAAxI+Pj4REREREREREwAAA
AAxI+Pj0AAAAAAAAAAAAAAAAxI+PhAAAAAAAAAAAAAAAAAxI+PQAAAAAAAAAAAAAAAAAxI+EAAAAAAAA
AAAAAAAAAAxI9AAAAAAAAAAAAAAAAAAAxIQAAAAAAAAAAAAAAAAAAAxEAAAAAAAAAAAAAAAAAAAAxAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////
//////////f////j////wf///4D///8A///+AP///AD///gAAB/wAAAP4AAAB8AAAAOAAAABgAAAAcAA
AAHgAAAB8AAAAfgAAAH8AAAB/gD///8A////gP///8D////g////8P////j////8////////////////
//8oAAAAEAAAACAAAAABAAQAAAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAgAAAAICAAIAA
AACAAIAAgIAAAICAgADAwMAAAAD/AAD/AAAA//8A/wAAAP8A/wD//wAA////AAAAAAAAAAAAAAAEQAAA
AAAAAEREAAAAAAAEREQAAAAAAERE9ERERAAERE+EREREQERE+PRERERERE+Pj4+Pj4QE+Pj4+Pj49ABP
j4+Pj4+EAAT49EREREQAAE+EAAAAAAAABPQAAAAAAAAARAAAAAAAAAAEAAAAAAAAAAAAAAAA//8AAPn/
AADw/wAA4P8AAMADAACAAQAAAAAAAAAAAACAAAAAwAAAAOAAAADw/wAA+P8AAPz/AAD+/wAA//8AAA==
</value>
</data>
</root>
@@ -0,0 +1,560 @@
'
' (C) Copyright 2003-2019 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.
'
Imports System.Windows.Forms
Public Class ViewerWindow
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents RenderPane As System.Windows.Forms.PictureBox
Friend WithEvents ViewerToolTip As System.Windows.Forms.ToolTip
Friend WithEvents PanLeftButton As System.Windows.Forms.Button
Friend WithEvents PanUpButton As System.Windows.Forms.Button
Friend WithEvents PanRightButton As System.Windows.Forms.Button
Friend WithEvents PanDownButton As System.Windows.Forms.Button
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents RotateDownButton As System.Windows.Forms.Button
Friend WithEvents RotateRightButton As System.Windows.Forms.Button
Friend WithEvents RotateLeftButton As System.Windows.Forms.Button
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents RotateUpButton As System.Windows.Forms.Button
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents ZoomInButton As System.Windows.Forms.Button
Friend WithEvents ZoomOutButton As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(ViewerWindow))
Me.RenderPane = New System.Windows.Forms.PictureBox
Me.ViewerToolTip = New System.Windows.Forms.ToolTip(Me.components)
Me.PanLeftButton = New System.Windows.Forms.Button
Me.PanUpButton = New System.Windows.Forms.Button
Me.PanRightButton = New System.Windows.Forms.Button
Me.PanDownButton = New System.Windows.Forms.Button
Me.Label1 = New System.Windows.Forms.Label
Me.RotateDownButton = New System.Windows.Forms.Button
Me.RotateRightButton = New System.Windows.Forms.Button
Me.RotateLeftButton = New System.Windows.Forms.Button
Me.Label2 = New System.Windows.Forms.Label
Me.RotateUpButton = New System.Windows.Forms.Button
Me.Label3 = New System.Windows.Forms.Label
Me.ZoomInButton = New System.Windows.Forms.Button
Me.ZoomOutButton = New System.Windows.Forms.Button
CType(Me.RenderPane, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'RenderPane
'
Me.RenderPane.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.RenderPane.BackColor = System.Drawing.Color.Black
Me.RenderPane.Location = New System.Drawing.Point(9, 9)
Me.RenderPane.Name = "RenderPane"
Me.RenderPane.Size = New System.Drawing.Size(454, 310)
Me.RenderPane.TabIndex = 0
Me.RenderPane.TabStop = False
Me.ViewerToolTip.SetToolTip(Me.RenderPane, "Use the arrow keys to move + Ctrl=Rotate Shift=Zoom")
'
'ViewerToolTip
'
Me.ViewerToolTip.ShowAlways = True
'
'PanLeftButton
'
Me.PanLeftButton.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.PanLeftButton.Image = CType(resources.GetObject("PanLeftButton.Image"), System.Drawing.Image)
Me.PanLeftButton.Location = New System.Drawing.Point(475, 37)
Me.PanLeftButton.Name = "PanLeftButton"
Me.PanLeftButton.Size = New System.Drawing.Size(27, 27)
Me.PanLeftButton.TabIndex = 1
Me.PanLeftButton.TabStop = False
'
'PanUpButton
'
Me.PanUpButton.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.PanUpButton.Image = CType(resources.GetObject("PanUpButton.Image"), System.Drawing.Image)
Me.PanUpButton.Location = New System.Drawing.Point(510, 9)
Me.PanUpButton.Name = "PanUpButton"
Me.PanUpButton.Size = New System.Drawing.Size(28, 28)
Me.PanUpButton.TabIndex = 1
Me.PanUpButton.TabStop = False
'
'PanRightButton
'
Me.PanRightButton.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.PanRightButton.Image = CType(resources.GetObject("PanRightButton.Image"), System.Drawing.Image)
Me.PanRightButton.Location = New System.Drawing.Point(545, 37)
Me.PanRightButton.Name = "PanRightButton"
Me.PanRightButton.Size = New System.Drawing.Size(28, 27)
Me.PanRightButton.TabIndex = 1
Me.PanRightButton.TabStop = False
'
'PanDownButton
'
Me.PanDownButton.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.PanDownButton.Image = CType(resources.GetObject("PanDownButton.Image"), System.Drawing.Image)
Me.PanDownButton.Location = New System.Drawing.Point(510, 61)
Me.PanDownButton.Name = "PanDownButton"
Me.PanDownButton.Size = New System.Drawing.Size(28, 26)
Me.PanDownButton.TabIndex = 1
Me.PanDownButton.TabStop = False
'
'Label1
'
Me.Label1.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Label1.Location = New System.Drawing.Point(510, 44)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(28, 19)
Me.Label1.TabIndex = 2
Me.Label1.Text = "Pan"
'
'RotateDownButton
'
Me.RotateDownButton.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.RotateDownButton.Image = CType(resources.GetObject("RotateDownButton.Image"), System.Drawing.Image)
Me.RotateDownButton.Location = New System.Drawing.Point(510, 159)
Me.RotateDownButton.Name = "RotateDownButton"
Me.RotateDownButton.Size = New System.Drawing.Size(28, 27)
Me.RotateDownButton.TabIndex = 1
Me.RotateDownButton.TabStop = False
'
'RotateRightButton
'
Me.RotateRightButton.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.RotateRightButton.Image = CType(resources.GetObject("RotateRightButton.Image"), System.Drawing.Image)
Me.RotateRightButton.Location = New System.Drawing.Point(545, 131)
Me.RotateRightButton.Name = "RotateRightButton"
Me.RotateRightButton.Size = New System.Drawing.Size(28, 28)
Me.RotateRightButton.TabIndex = 1
Me.RotateRightButton.TabStop = False
'
'RotateLeftButton
'
Me.RotateLeftButton.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.RotateLeftButton.Image = CType(resources.GetObject("RotateLeftButton.Image"), System.Drawing.Image)
Me.RotateLeftButton.Location = New System.Drawing.Point(475, 131)
Me.RotateLeftButton.Name = "RotateLeftButton"
Me.RotateLeftButton.Size = New System.Drawing.Size(27, 28)
Me.RotateLeftButton.TabIndex = 1
Me.RotateLeftButton.TabStop = False
'
'Label2
'
Me.Label2.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Label2.Location = New System.Drawing.Point(502, 138)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(48, 28)
Me.Label2.TabIndex = 2
Me.Label2.Text = "Rotate"
'
'RotateUpButton
'
Me.RotateUpButton.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.RotateUpButton.Image = CType(resources.GetObject("RotateUpButton.Image"), System.Drawing.Image)
Me.RotateUpButton.Location = New System.Drawing.Point(510, 103)
Me.RotateUpButton.Name = "RotateUpButton"
Me.RotateUpButton.Size = New System.Drawing.Size(28, 28)
Me.RotateUpButton.TabIndex = 1
Me.RotateUpButton.TabStop = False
'
'Label3
'
Me.Label3.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Label3.Location = New System.Drawing.Point(505, 240)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(42, 19)
Me.Label3.TabIndex = 2
Me.Label3.Text = "Zoom"
'
'ZoomInButton
'
Me.ZoomInButton.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.ZoomInButton.Image = CType(resources.GetObject("ZoomInButton.Image"), System.Drawing.Image)
Me.ZoomInButton.Location = New System.Drawing.Point(510, 205)
Me.ZoomInButton.Name = "ZoomInButton"
Me.ZoomInButton.Size = New System.Drawing.Size(28, 29)
Me.ZoomInButton.TabIndex = 1
Me.ZoomInButton.TabStop = False
'
'ZoomOutButton
'
Me.ZoomOutButton.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.ZoomOutButton.Image = CType(resources.GetObject("ZoomOutButton.Image"), System.Drawing.Image)
Me.ZoomOutButton.Location = New System.Drawing.Point(510, 261)
Me.ZoomOutButton.Name = "ZoomOutButton"
Me.ZoomOutButton.Size = New System.Drawing.Size(28, 29)
Me.ZoomOutButton.TabIndex = 1
Me.ZoomOutButton.TabStop = False
'
'ViewerWindow
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(584, 326)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.RenderPane)
Me.Controls.Add(Me.PanLeftButton)
Me.Controls.Add(Me.PanUpButton)
Me.Controls.Add(Me.PanRightButton)
Me.Controls.Add(Me.PanDownButton)
Me.Controls.Add(Me.RotateDownButton)
Me.Controls.Add(Me.RotateRightButton)
Me.Controls.Add(Me.RotateLeftButton)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.RotateUpButton)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.ZoomInButton)
Me.Controls.Add(Me.ZoomOutButton)
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.Name = "ViewerWindow"
Me.ShowInTaskbar = False
Me.Text = "Revit Viewer"
CType(Me.RenderPane, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
''' <summary>
''' return the width to be fit.
''' </summary>
''' <returns></returns>
''' <remarks></remarks>
Public Function ScaleWidth() As Double
Return Me.Width * 0.8
End Function
''' <summary>
''' return the height to be fit.
''' </summary>
''' <returns></returns>
''' <remarks></remarks>
Public Function ScaleHeight() As Double
Return Me.Height * 0.8
End Function
'the Wireframe object stores all primitive lines.
Dim mViewerObject As Wireframe
''' <summary>
''' draw primitive line using the System.Drawing.Graphics object
''' </summary>
''' <param name="gs"></param>
''' <param name="x1"></param>
''' <param name="y1"></param>
''' <param name="x2"></param>
''' <param name="y2"></param>
''' <remarks></remarks>
Public Sub DrawLine(ByRef gs As System.Drawing.Graphics, ByVal x1 As Double, ByVal y1 As Double, ByVal x2 As Double, ByVal y2 As Double)
Dim startX As Single
Dim startY As Single
Dim endX As Single
Dim endY As Single
startX = x1 + (Me.ScaleWidth / 2)
endX = x2 + (Me.ScaleWidth / 2)
startY = -y1 + (Me.ScaleHeight / 2)
endY = -y2 + (Me.ScaleHeight / 2)
' Create a Pen object.
Dim pen As New Drawing.Pen(System.Drawing.Color.White, 1)
gs.DrawLine(pen, startX, startY, endX, endY)
End Sub
''' <summary>
''' clear the graphics' drawing.
''' </summary>
''' <param name="gs"></param>
''' <remarks></remarks>
Public Sub Clear(ByRef gs As System.Drawing.Graphics)
gs.Clear(RenderPane.BackColor)
End Sub
''' <summary>
''' Occurs when a key is pressed while the control has focus.
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub ViewerWindow_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
RenderPane_KeyDown(sender, e)
End Sub
''' <summary>
''' To handle keyboard events
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub RenderPane_KeyDown(ByVal sender As Object, ByVal e As KeyEventArgs) Handles RenderPane.KeyDown
mViewerObject.KeyDown(e.KeyCode, e.Shift, e.Control)
End Sub
''' <summary>
''' Initialize wire frame to be display.
''' </summary>
''' <param name="viewerObject"></param>
''' <remarks></remarks>
Public Sub Initialize(ByVal viewerObject As Wireframe)
mViewerObject = viewerObject
End Sub
''' <summary>
''' Occurs when the mouse wheel moves while the control has focus.
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub ViewerWindow_MouseWheel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseWheel
If (e.Delta > 0) Then
mViewerObject.Zoom(1 / 1.2)
Else
mViewerObject.Zoom(1.2)
End If
End Sub
''' <summary>
''' translate model up.
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub PanUpButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PanUpButton.Click
mViewerObject.KeyDown(38, False, False)
End Sub
''' <summary>
''' translate model right.
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub PanRightButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PanRightButton.Click
mViewerObject.KeyDown(39, False, False)
End Sub
''' <summary>
''' translate model down.
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub PanDownButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PanDownButton.Click
mViewerObject.KeyDown(40, False, False)
End Sub
''' <summary>
''' translate model left.
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub PanLeftButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PanLeftButton.Click
mViewerObject.KeyDown(37, False, False)
End Sub
''' <summary>
''' rotate around X axis with default angle.
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub RotateUpButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RotateUpButton.Click
mViewerObject.KeyDown(38, False, True)
End Sub
''' <summary>
''' rotate around Y axis with default angle.
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub RotateRightButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RotateRightButton.Click
mViewerObject.KeyDown(39, False, True)
End Sub
''' <summary>
''' rotate around X axis with default angle.
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub RotateDownButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RotateDownButton.Click
mViewerObject.KeyDown(40, False, True)
End Sub
''' <summary>
''' rotate around Y axis with default angle.
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub RotateLeftButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RotateLeftButton.Click
mViewerObject.KeyDown(37, False, True)
End Sub
''' <summary>
''' zoom in model to display.
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub ZoomInButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ZoomInButton.Click
mViewerObject.KeyDown(38, True, False)
End Sub
''' <summary>
''' zoom out model to display.
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub ZoomOutButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ZoomOutButton.Click
mViewerObject.KeyDown(40, True, False)
End Sub
''' <summary>
''' Occurs when the Size property value changes.
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub ViewerWindow_SizeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.SizeChanged
If Not mViewerObject Is Nothing Then
' schedule a rescale in window next paint
mViewerObject.ReFitRequired = True
End If
End Sub
''' <summary>
''' Occurs before a form is displayed for the first time.
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub ViewerWindow_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not mViewerObject Is Nothing Then
' schedule a rescale in window next paint
mViewerObject.ReFitRequired = True
End If
End Sub
''' <summary>
''' Occurs when the control is double-clicked.
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub RenderPane_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles RenderPane.DoubleClick
If Not mViewerObject Is Nothing Then
' schedule a rescale in window next paint
mViewerObject.ReFitRequired = True
End If
End Sub
''' <summary>
''' Occurs when the control is redrawn.
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub RenderPane_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles RenderPane.Paint
If Not mViewerObject Is Nothing Then
' if the object needs to be fitted into the control
If mViewerObject.ReFitRequired = True Then
' calculate the scales
mViewerObject.Fit()
' reset the flag
mViewerObject.ReFitRequired = False
End If
mViewerObject.RawDraw(e.Graphics)
End If
End Sub
End Class
@@ -0,0 +1,520 @@
'
' (C) Copyright 2003-2019 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.
'
Imports System.Math
''' <summary>
''' Wrapped wire frame of element to be drawn.
''' </summary>
''' <remarks></remarks>
Public Class Wireframe
Dim mLines() As Line
Dim mWindow As New ViewerWindow
Dim xOrigin As Double
Dim yOrigin As Double
Dim zOrigin As Double
Const PI As Double = 3.14159265358979
Dim mScale As Double
' constructor
Public Sub New()
mScale = 1
mWindow.Initialize(Me)
End Sub
''' <summary>
''' update the bound to be display.
''' </summary>
''' <param name="xMin"></param>
''' <param name="xMax"></param>
''' <param name="yMin"></param>
''' <param name="yMax"></param>
''' <param name="zMin"></param>
''' <param name="zMax"></param>
''' <remarks></remarks>
Public Sub FindMinMax(ByRef xMin As Double, ByRef xMax As Double, ByRef yMin As Double, ByRef yMax As Double, ByRef zMin As Double, ByRef zMax As Double)
xMin = 0
xMax = 0
yMin = 0
yMax = 0
zMin = 0
zMax = 0
Dim valSet As Boolean = False
Dim i As Integer
Dim size As Integer = GetTotalNumberLines()
For i = 0 To size
Dim aLine As Line
aLine = mLines(i)
If valSet = False Then
xMin = aLine.startPoint.X
xMax = xMin
yMin = aLine.startPoint.Y
yMax = yMin
zMin = aLine.startPoint.Z
zMax = zMin
valSet = True
End If
If (aLine.startPoint.X < xMin) Then
xMin = aLine.startPoint.X
ElseIf (aLine.startPoint.X > xMax) Then
xMax = aLine.startPoint.X
End If
If (aLine.startPoint.Y < yMin) Then
yMin = aLine.startPoint.Y
ElseIf (aLine.startPoint.Y > yMax) Then
yMax = aLine.startPoint.Y
End If
If (aLine.startPoint.Z < zMin) Then
zMin = aLine.startPoint.Z
ElseIf (aLine.startPoint.Z > zMax) Then
zMax = aLine.startPoint.Z
End If
If (aLine.endPoint.X < xMin) Then
xMin = aLine.endPoint.X
ElseIf (aLine.endPoint.X > xMax) Then
xMax = aLine.endPoint.X
End If
If (aLine.endPoint.Y < yMin) Then
yMin = aLine.endPoint.Y
ElseIf (aLine.endPoint.Y > yMax) Then
yMax = aLine.endPoint.Y
End If
If (aLine.endPoint.Z < zMin) Then
zMin = aLine.endPoint.Z
ElseIf (aLine.endPoint.Z > zMax) Then
zMax = aLine.endPoint.Z
End If
Next i
End Sub
''' <summary>
''' zoom the model to fit to display.
''' </summary>
''' <remarks></remarks>
Public Sub Fit()
' reset the origins
xOrigin = 0.0
yOrigin = 0.0
zOrigin = 0.0
Dim xMin As Double
Dim xMax As Double
Dim yMin As Double
Dim yMax As Double
Dim zMin As Double
Dim zMax As Double
FindMinMax(xMin, xMax, yMin, yMax, zMin, zMax)
Dim xOffset As Double
Dim yOffset As Double
Dim zOffset As Double
xOffset = ((xMin + xMax) / 2)
yOffset = ((yMin + yMax) / 2)
zOffset = ((zMin + zMax) / 2)
Dim i As Integer
Dim size As Integer = GetTotalNumberLines()
For i = 0 To size
mLines(i).startPoint.X = mLines(i).startPoint.X - xOffset
mLines(i).startPoint.Y = mLines(i).startPoint.Y - yOffset
mLines(i).startPoint.Z = mLines(i).startPoint.Z - zOffset
mLines(i).endPoint.X = mLines(i).endPoint.X - xOffset
mLines(i).endPoint.Y = mLines(i).endPoint.Y - yOffset
mLines(i).endPoint.Z = mLines(i).endPoint.Z - zOffset
Next
FindMinMax(xMin, xMax, yMin, yMax, zMin, zMax)
Dim halfWidth As Double
Dim halfHeight As Double
halfWidth = (mWindow.ScaleWidth / 2) * 0.8
halfHeight = (mWindow.ScaleHeight / 2) * 0.8
Dim largestXOffset As Double
Dim largestYOffset As Double
largestXOffset = Abs(xMin)
If Abs(xMax) > largestXOffset Then
largestXOffset = Abs(xMax)
End If
largestYOffset = Abs(yMin)
If Abs(yMax) > largestYOffset Then
largestYOffset = Abs(yMax)
End If
Dim scaleX As Double
Dim scaleY As Double
scaleX = 0
scaleY = 0
If (largestXOffset > 0) Then
scaleX = halfWidth / largestXOffset
End If
If (largestYOffset > 0) Then
scaleY = halfHeight / largestYOffset
End If
Dim smallestScale As Double
smallestScale = scaleX
If (smallestScale = 0 Or (scaleY <> 0 And scaleY < smallestScale)) Then
smallestScale = scaleY
End If
If smallestScale <> 0 Then
Zoom(smallestScale)
End If
End Sub
''' <summary>
''' add the primititive line.
''' </summary>
''' <param name="x1">the the first coordinate of start point</param>
''' <param name="y1">the the second coordinate of start point</param>
''' <param name="z1">the the third coordinate of start point</param>
''' <param name="x2">the the first coordinate of end point</param>
''' <param name="y2">the the second coordinate of end point</param>
''' <param name="z2">the the third coordinate of end point</param>
''' <remarks></remarks>
Public Sub Add(ByVal x1 As Double, ByVal y1 As Double, ByVal z1 As Double, ByVal x2 As Double, ByVal y2 As Double, ByVal z2 As Double)
Dim size As Integer = GetTotalNumberLines()
size = size + 1
ReDim Preserve mLines(size)
Dim newLine As New Line
newLine.startPoint.X = x1
newLine.startPoint.Y = y1
newLine.startPoint.Z = z1
newLine.endPoint.X = x2
newLine.endPoint.Y = y2
newLine.endPoint.Z = z2
mLines(UBound(mLines)) = newLine
'Draw
End Sub
Sub Draw()
' force OnPaint call
mWindow.Invalidate(True)
End Sub
Sub RawDraw(ByRef gs As System.Drawing.Graphics)
' clear the control
mWindow.Clear(gs)
' draw the lines
Dim i As Integer
Dim size As Integer = GetTotalNumberLines()
For i = 0 To size
mWindow.DrawLine(gs, mLines(i).startPoint.X + xOrigin, mLines(i).startPoint.Y + yOrigin, mLines(i).endPoint.X + xOrigin, mLines(i).endPoint.Y + yOrigin)
Next i
End Sub
''' <summary>
''' rotate around Z axis with spcified angle.
''' </summary>
''' <param name="angle">the angle to rotate.</param>
''' <remarks></remarks>
Public Sub RotateXY(ByVal angle As Double)
Dim tempX As Double
Dim tempY As Double
Dim i As Integer
Dim size As Integer = GetTotalNumberLines()
For i = 0 To size
'start Point
tempX = mLines(i).startPoint.X
tempY = mLines(i).startPoint.Y
mLines(i).startPoint.X = tempX * Cos(angle) - tempY * Sin(angle)
mLines(i).startPoint.Y = tempX * Sin(angle) + tempY * Cos(angle)
'end point
tempX = mLines(i).endPoint.X
tempY = mLines(i).endPoint.Y
mLines(i).endPoint.X = tempX * Cos(angle) - tempY * Sin(angle)
mLines(i).endPoint.Y = tempX * Sin(angle) + tempY * Cos(angle)
Next
Draw()
End Sub
''' <summary>
''' rotate around X axis with spcified angle.
''' </summary>
''' <param name="angle">the angle to rotate.</param>
''' <remarks></remarks>
Public Sub RotateYZ(ByVal angle As Double)
Dim tempY As Double
Dim tempZ As Double
Dim i As Integer
Dim size As Integer = GetTotalNumberLines()
For i = 0 To size
'start Point
tempY = mLines(i).startPoint.Y
tempZ = mLines(i).startPoint.Z
mLines(i).startPoint.Y = tempY * Cos(angle) - tempZ * Sin(angle)
mLines(i).startPoint.Z = tempY * Sin(angle) + tempZ * Cos(angle)
'end point
tempY = mLines(i).endPoint.Y
tempZ = mLines(i).endPoint.Z
mLines(i).endPoint.Y = tempY * Cos(angle) - tempZ * Sin(angle)
mLines(i).endPoint.Z = tempY * Sin(angle) + tempZ * Cos(angle)
Next
Draw()
End Sub
''' <summary>
''' rotate around Y axis with spcified angle.
''' </summary>
''' <param name="angle">the angle to rotate.</param>
''' <remarks></remarks>
Public Sub RotateXZ(ByVal angle As Double)
Dim tempX As Double
Dim tempZ As Double
Dim i As Integer
Dim size As Integer = GetTotalNumberLines()
For i = 0 To size
'start Point
tempX = mLines(i).startPoint.X
tempZ = mLines(i).startPoint.Z
mLines(i).startPoint.X = tempX * Cos(angle) - tempZ * Sin(angle)
mLines(i).startPoint.Z = tempX * Sin(angle) + tempZ * Cos(angle)
'end point
tempX = mLines(i).endPoint.X
tempZ = mLines(i).endPoint.Z
mLines(i).endPoint.X = tempX * Cos(angle) - tempZ * Sin(angle)
mLines(i).endPoint.Z = tempX * Sin(angle) + tempZ * Cos(angle)
Next
Draw()
End Sub
''' <summary>
''' translate in X axis with the specified distance.
''' </summary>
''' <param name="translation">the specified distance.</param>
''' <remarks></remarks>
Public Sub TranslateX(ByVal translation As Double)
xOrigin = xOrigin + translation
Draw()
End Sub
''' <summary>
''' translate in Y axis with the specified distance.
''' </summary>
''' <param name="translation">the specified distance.</param>
''' <remarks></remarks>
Public Sub TranslateY(ByVal translation As Double)
yOrigin = yOrigin + translation
Draw()
End Sub
''' <summary>
''' zoom the model with the specified amount.
''' </summary>
''' <param name="amount">the specified amount.</param>
''' <remarks></remarks>
Public Sub Zoom(ByVal amount As Double)
Dim i As Integer
Dim size As Integer = GetTotalNumberLines()
For i = 0 To size
mLines(i).startPoint.X = mLines(i).startPoint.X * amount
mLines(i).startPoint.Y = mLines(i).startPoint.Y * amount
mLines(i).startPoint.Z = mLines(i).startPoint.Z * amount
mLines(i).endPoint.X = mLines(i).endPoint.X * amount
mLines(i).endPoint.Y = mLines(i).endPoint.Y * amount
mLines(i).endPoint.Z = mLines(i).endPoint.Z * amount
Next
mScale = mScale * amount
Draw()
End Sub
''' <summary>
''' respond the UI operation.
''' </summary>
''' <param name="keyCode">the pressed key code</param>
''' <param name="shiftKey">if the shift key is pressed</param>
''' <param name="ctrlKey">if the ctrl key is pressed</param>
''' <remarks></remarks>
Public Sub KeyDown(ByVal keyCode As Integer, ByVal shiftKey As Boolean, ByVal ctrlKey As Boolean)
Dim offsetX As Double
Dim offsetY As Double
Dim useScale As Double
useScale = mScale
'If (useScale < 1) Then
useScale = 1
'End If
offsetX = (mWindow.RenderPane.Width / useScale) * 0.1
offsetY = (mWindow.RenderPane.Height / useScale) * 0.1
If shiftKey And ctrlKey Then
ElseIf shiftKey Then
Select Case keyCode
Case 37
TranslateX(-offsetX)
Case 39
TranslateX(offsetX)
Case 40
Zoom(1 / 1.05)
Case 38
Zoom(1.05)
End Select
ElseIf ctrlKey Then
Select Case keyCode
Case 37
RotateXZ(-PI / 24)
Case 39
RotateXZ(PI / 24)
Case 40
RotateYZ(-PI / 24)
Case 38
RotateYZ(PI / 24)
End Select
Else
Select Case keyCode
Case 37
TranslateX(-offsetX)
Case 39
TranslateX(offsetX)
Case 40
TranslateY(-offsetY)
Case 38
TranslateY(offsetY)
End Select
End If
End Sub
''' <summary>
''' draw the wire frame in a picture box.
''' </summary>
''' <remarks></remarks>
Public Sub ShowModal()
mWindow.ShowDialog()
End Sub
''' <summary>
''' get the total number of lines.
''' </summary>
''' <returns>the total number of lines.</returns>
''' <remarks></remarks>
Private Function GetTotalNumberLines() As Integer
' be safe about the array
Dim size As Integer
If mLines Is Nothing Then
size = -1
Else
size = UBound(mLines)
End If
Return size
End Function
' flag properties for drawing
Private drawRequired As Boolean
Property ReDrawRequired() As Boolean
Get
Return drawRequired
End Get
Set(ByVal Value As Boolean)
drawRequired = Value
End Set
End Property
' flag properties for fit
Private fitRequired As Boolean
Property ReFitRequired() As Boolean
Get
Return fitRequired
End Get
Set(ByVal Value As Boolean)
fitRequired = Value
End Set
End Property
End Class