mirror of
https://github.com/jeremytammik/RevitSdkSamples.git
synced 2026-08-30 16:42:51 +00:00
added Revit 2022 SDK minus except *rvt and *rfa
This commit is contained in:
@@ -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("6038F50C-19F1-4E0F-993F-B31C965EE6DF")>
|
||||
|
||||
' 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.*")>
|
||||
Binary file not shown.
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RevitAddIns>
|
||||
<AddIn Type="Command">
|
||||
<Assembly>RotateFramingObjects.dll</Assembly>
|
||||
<ClientId>beb5115d-b4ff-4032-9bba-ef8f13899006</ClientId>
|
||||
<FullClassName>Revit.SDK.Samples.RotateFramingObjects.VB.NET.RotateFramingObjects</FullClassName>
|
||||
<Text>Rotate Framing Objects (VB)</Text>
|
||||
<Description>Rotate selected objects, such as beams, braces and columns.</Description>
|
||||
<VisibilityMode>AlwaysVisible</VisibilityMode>
|
||||
<VendorId>ADSK</VendorId>
|
||||
<VendorDescription>Autodesk, www.autodesk.com</VendorDescription>
|
||||
</AddIn>
|
||||
</RevitAddIns>
|
||||
@@ -0,0 +1,305 @@
|
||||
'
|
||||
' (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.IO
|
||||
Imports System.Windows.Forms
|
||||
|
||||
Imports Autodesk.Revit
|
||||
Imports Autodesk.Revit.DB
|
||||
Imports Autodesk.Revit.UI
|
||||
|
||||
' rotate the objects that were selected when the command was executed.
|
||||
' and allow the user input the amount, in degrees that the objects should be rotated.
|
||||
' the dialog contain option for the user to specify this value is absolute or relative.
|
||||
<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 RotateFramingObjects
|
||||
Implements IExternalCommand
|
||||
|
||||
Private m_revit As Autodesk.Revit.UI.UIApplication
|
||||
Private m_receiveRotationTextBox As Double
|
||||
Private m_isAbsoluteChecked As Boolean ' true if moving absolute
|
||||
Private Const AngleDefinitionName As String = "Cross-Section Rotation"
|
||||
Public Property ReceiveRotationTextBox() As Double
|
||||
Get
|
||||
Return m_receiveRotationTextBox
|
||||
End Get
|
||||
Set(ByVal Value As Double)
|
||||
m_receiveRotationTextBox = Value
|
||||
End Set
|
||||
End Property
|
||||
Public Property IsAbsoluteChecked() As Boolean
|
||||
Get
|
||||
Return m_isAbsoluteChecked
|
||||
End Get
|
||||
Set(ByVal Value As Boolean)
|
||||
m_isAbsoluteChecked = Value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
''' <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 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 Autodesk.Revit.UI.ExternalCommandData, _
|
||||
ByRef message As String, _
|
||||
ByVal elements As Autodesk.Revit.DB.ElementSet _
|
||||
) As Autodesk.Revit.UI.Result Implements IExternalCommand.Execute
|
||||
'revit,the application object for the active instance of Autodesk Revit.
|
||||
'message,a message that can be set by the external command and displayed in case of error.
|
||||
'elements,a set of elements that can be displayed if an error occurs.
|
||||
'returns,a value that signifies if yout command was successful, failed or cancel.
|
||||
Dim revit As Autodesk.Revit.UI.UIApplication = commandData.Application
|
||||
m_revit = revit
|
||||
Dim displayForm As RotateFramingObjectsForm = New RotateFramingObjectsForm(Me)
|
||||
displayForm.StartPosition = FormStartPosition.CenterParent
|
||||
Dim selection As Autodesk.Revit.DB.ElementSet = New Autodesk.Revit.DB.ElementSet()
|
||||
Dim elementId As Autodesk.Revit.DB.ElementId
|
||||
For Each elementId In revit.ActiveUIDocument.Selection.GetElementIds()
|
||||
selection.Insert(revit.ActiveUIDocument.Document.GetElement(elementId))
|
||||
Next
|
||||
Dim isSingle As Boolean = True
|
||||
Dim isAllFamilyInstance As Boolean = True
|
||||
'There must be beams, braces or columns selected
|
||||
If (selection.IsEmpty) Then
|
||||
' nothing selected
|
||||
message = "Please select some beams, braces or columns."
|
||||
Return Autodesk.Revit.UI.Result.Failed
|
||||
ElseIf (1 <> selection.Size) Then
|
||||
isSingle = False
|
||||
Try
|
||||
If DialogResult.OK <> displayForm.ShowDialog Then
|
||||
Return Autodesk.Revit.UI.Result.Failed
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Return Autodesk.Revit.UI.Result.Failed
|
||||
End Try
|
||||
'not single object selected
|
||||
End If
|
||||
|
||||
'if the selected elements are familyInstances, try to get their existing rotation or angle
|
||||
Dim e As Autodesk.Revit.DB.Element
|
||||
For Each e In selection
|
||||
Dim familyComponent As Autodesk.Revit.DB.FamilyInstance
|
||||
familyComponent = Nothing
|
||||
If TypeOf e Is Autodesk.Revit.DB.FamilyInstance Then
|
||||
familyComponent = e
|
||||
End If
|
||||
If Not (familyComponent Is Nothing) Then
|
||||
If Autodesk.Revit.DB.Structure.StructuralType.Beam = familyComponent.StructuralType _
|
||||
Or Autodesk.Revit.DB.Structure.StructuralType.Brace = familyComponent.StructuralType _
|
||||
Then
|
||||
'selection is a beam or a brace
|
||||
Dim returnValue As String = Me.FindParameter(AngleDefinitionName, familyComponent)
|
||||
displayForm.rotationTextBox.Text = returnValue.ToString()
|
||||
ElseIf Autodesk.Revit.DB.Structure.StructuralType.Column = _
|
||||
familyComponent.StructuralType Then
|
||||
'selection is a column
|
||||
Dim columnLocation As Autodesk.Revit.DB.Location = familyComponent.Location
|
||||
Dim pointLocation As Autodesk.Revit.DB.LocationPoint = Nothing
|
||||
If TypeOf columnLocation Is Autodesk.Revit.DB.LocationPoint Then
|
||||
pointLocation = columnLocation
|
||||
End If
|
||||
Dim temp As Double = pointLocation.Rotation
|
||||
Dim outPut As String = (Math.Round(temp * 180 / (Math.PI), 3)).ToString()
|
||||
displayForm.rotationTextBox.Text = outPut
|
||||
Else
|
||||
'other familyInstance can not be rotated
|
||||
message = "It is not a beam, brace or column."
|
||||
elements.Insert(familyComponent)
|
||||
Return Autodesk.Revit.UI.Result.Failed
|
||||
End If
|
||||
Else
|
||||
If isSingle Then
|
||||
message = "It is not a FamilyInstance."
|
||||
elements.Insert(e)
|
||||
Return Autodesk.Revit.UI.Result.Failed
|
||||
Else
|
||||
'there is some objects is not familyInstance
|
||||
message = "They are not FamilyInstances"
|
||||
elements.Insert(e)
|
||||
isAllFamilyInstance = False
|
||||
End If
|
||||
End If
|
||||
Next e
|
||||
If isSingle Then
|
||||
Try
|
||||
If DialogResult.OK <> displayForm.ShowDialog Then
|
||||
Return Autodesk.Revit.UI.Result.Failed
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Return Autodesk.Revit.UI.Result.Failed
|
||||
End Try
|
||||
End If
|
||||
If isAllFamilyInstance Then
|
||||
Return Autodesk.Revit.UI.Result.Succeeded
|
||||
Else
|
||||
Return Autodesk.Revit.UI.Result.Failed
|
||||
End If
|
||||
End Function
|
||||
'The function set value to rotation of the beams and braces
|
||||
'and rotate columns.
|
||||
Public Sub RotateElement()
|
||||
Dim transaction As New Autodesk.Revit.DB.Transaction(m_revit.ActiveUIDocument.Document, "RotateElement")
|
||||
transaction.Start()
|
||||
Try
|
||||
Dim selection As Autodesk.Revit.DB.ElementSet = New Autodesk.Revit.DB.ElementSet()
|
||||
Dim elementId As Autodesk.Revit.DB.ElementId
|
||||
For Each elementId In m_revit.ActiveUIDocument.Selection.GetElementIds()
|
||||
selection.Insert(m_revit.ActiveUIDocument.Document.GetElement(elementId))
|
||||
Next
|
||||
Dim e As Autodesk.Revit.DB.Element
|
||||
For Each e In selection
|
||||
Dim familyComponent As Autodesk.Revit.DB.FamilyInstance
|
||||
familyComponent = Nothing
|
||||
If TypeOf e Is Autodesk.Revit.DB.FamilyInstance Then
|
||||
familyComponent = e
|
||||
End If
|
||||
If Not familyComponent Is Nothing Then
|
||||
'if be familyInstance,judge the types of familyInstance
|
||||
If (Autodesk.Revit.DB.Structure.StructuralType.Beam = familyComponent.StructuralType) _
|
||||
Or (Autodesk.Revit.DB.Structure.StructuralType.Brace = familyComponent.StructuralType) Then
|
||||
Dim j As ParameterSetIterator = familyComponent.Parameters.ForwardIterator()
|
||||
j.Reset()
|
||||
|
||||
Dim jMoreAttribute As Boolean = j.MoveNext
|
||||
While jMoreAttribute
|
||||
Dim a As Object = j.Current
|
||||
Dim objectAttribute As Parameter = Nothing
|
||||
If TypeOf a Is Parameter Then
|
||||
objectAttribute = a
|
||||
End If
|
||||
Dim p As Integer = objectAttribute.Definition.Name.CompareTo(AngleDefinitionName)
|
||||
If 0 = p Then
|
||||
Dim temp As Double = objectAttribute.AsDouble
|
||||
Dim rotateDegree As Double = m_receiveRotationTextBox * Math.PI / 180
|
||||
If Not m_isAbsoluteChecked Then
|
||||
rotateDegree += temp
|
||||
End If
|
||||
objectAttribute.Set(rotateDegree)
|
||||
End If
|
||||
jMoreAttribute = j.MoveNext()
|
||||
End While
|
||||
ElseIf Autodesk.Revit.DB.Structure.StructuralType.Column = _
|
||||
familyComponent.StructuralType Then
|
||||
'rotate a column
|
||||
Dim columnLocation As Location = familyComponent.Location
|
||||
'get the location object
|
||||
Dim pointLocation As LocationPoint = Nothing
|
||||
If TypeOf columnLocation Is LocationPoint Then
|
||||
pointLocation = columnLocation
|
||||
End If
|
||||
Dim insertPoint As Autodesk.Revit.DB.XYZ = pointLocation.Point
|
||||
'get the location point
|
||||
Dim temp As Double = pointLocation.Rotation
|
||||
'existing rotation
|
||||
Dim directionPoint As Autodesk.Revit.DB.XYZ
|
||||
directionPoint = New Autodesk.Revit.DB.XYZ(0, 0, 1)
|
||||
'define the vector of axis
|
||||
Dim rotateAxis As Autodesk.Revit.DB.Line
|
||||
rotateAxis = Autodesk.Revit.DB.Line.CreateBound(insertPoint, directionPoint)
|
||||
Dim rotateDegree As Double = m_receiveRotationTextBox * Math.PI / 180
|
||||
' rotate column by rotate method
|
||||
If m_isAbsoluteChecked Then
|
||||
rotateDegree -= temp
|
||||
End If
|
||||
Dim rotateResult As Integer = pointLocation.Rotate(rotateAxis, rotateDegree)
|
||||
If 0 = rotateResult Then
|
||||
TaskDialog.Show("Revit", "Rotate Failed")
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
transaction.Commit()
|
||||
|
||||
Catch ex As Exception
|
||||
TaskDialog.Show("Revit", ("Rotate failed! " & ex.Message))
|
||||
transaction.RollBack()
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
'get the parameter value according to given parameter name
|
||||
Public Function FindParameter( _
|
||||
ByVal parameterName As String, _
|
||||
ByVal familyInstanceName As Autodesk.Revit.DB.FamilyInstance _
|
||||
) As String
|
||||
Dim i As ParameterSetIterator = familyInstanceName.Parameters.ForwardIterator
|
||||
i.Reset()
|
||||
|
||||
Dim valueOfParameter As String = Nothing
|
||||
Dim imoreAttribute As Boolean = i.MoveNext
|
||||
While imoreAttribute
|
||||
Dim isFound As Boolean = False
|
||||
Dim o As Object = i.Current
|
||||
Dim familyAttribute As Parameter = Nothing
|
||||
If TypeOf o Is Parameter Then
|
||||
familyAttribute = o
|
||||
End If
|
||||
If parameterName = familyAttribute.Definition.Name Then
|
||||
Dim t As StorageType = familyAttribute.StorageType
|
||||
If t = (Autodesk.Revit.DB.StorageType.Double) Then
|
||||
If AngleDefinitionName = parameterName Then
|
||||
Dim temp As Double = familyAttribute.AsDouble
|
||||
valueOfParameter = Math.Round(temp * 180 / (Math.PI), 3).ToString
|
||||
Else
|
||||
valueOfParameter = familyAttribute.AsDouble.ToString
|
||||
End If
|
||||
ElseIf StorageType.ElementId = t Then
|
||||
' get element id as string
|
||||
valueOfParameter = familyAttribute.AsElementId.ToString
|
||||
ElseIf StorageType.Integer = t Then
|
||||
' get integer as string
|
||||
valueOfParameter = familyAttribute.AsInteger.ToString
|
||||
ElseIf StorageType.String = t Then
|
||||
' get string parameter
|
||||
valueOfParameter = familyAttribute.AsString()
|
||||
End If
|
||||
isFound = True
|
||||
End If
|
||||
If isFound Then
|
||||
Exit While
|
||||
End If
|
||||
imoreAttribute = i.MoveNext
|
||||
End While
|
||||
'return the value.
|
||||
Return valueOfParameter
|
||||
End Function
|
||||
End Class
|
||||
@@ -0,0 +1,155 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
|
||||
<PropertyGroup>
|
||||
<ProjectType>Local</ProjectType>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{1823B4FE-46DE-4CB1-A310-DED7B854F087}</ProjectGuid>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ApplicationIcon>
|
||||
</ApplicationIcon>
|
||||
<AssemblyKeyContainerName>
|
||||
</AssemblyKeyContainerName>
|
||||
<AssemblyName>RotateFramingObjects</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.RotateFramingObjects.VB.NET</RootNamespace>
|
||||
<StartupObject>Revit.SDK.Samples.RotateFramingObjects.VB.NET.%28None%29</StartupObject>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<MyType>Windows</MyType>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<OldToolsVersion>2.0</OldToolsVersion>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DocumentationFile>RotateFramingObjects.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>RotateFramingObjects.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>RotateFramingObjects.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>RotateFramingObjects.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="RotateFramingObjects.vb">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="RotateFramingObjectsForm.vb">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="RotateFramingObjectsForm.resx">
|
||||
<DependentUpon>RotateFramingObjectsForm.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,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=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>
|
||||
@@ -0,0 +1,210 @@
|
||||
'
|
||||
' (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.Drawing
|
||||
Imports System.Collections
|
||||
Imports System.ComponentModel
|
||||
Imports System.Windows.Forms
|
||||
Public Class RotateFramingObjectsForm
|
||||
Inherits System.Windows.Forms.Form
|
||||
Private m_instance As RotateFramingObjects
|
||||
Private m_isReset As Boolean
|
||||
Public Property IsReset() As Boolean
|
||||
Get
|
||||
Return m_isReset
|
||||
End Get
|
||||
Set(ByVal Value As Boolean)
|
||||
m_isReset = Value
|
||||
End Set
|
||||
End Property
|
||||
#Region " Windows Form Designer generated code "
|
||||
|
||||
Public Sub New(ByVal Inst As RotateFramingObjects)
|
||||
MyBase.New()
|
||||
'This call is required by the Windows Form Designer.
|
||||
m_instance = Inst
|
||||
m_isReset = False
|
||||
If (m_instance Is Nothing) Then
|
||||
Autodesk.Revit.UI.TaskDialog.Show("Revit", "Load Application Failed !")
|
||||
End If
|
||||
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 okButton As System.Windows.Forms.Button
|
||||
Friend WithEvents rotationLabel As System.Windows.Forms.Label
|
||||
Public WithEvents rotationTextBox As System.Windows.Forms.TextBox
|
||||
Friend WithEvents relativeRadio As System.Windows.Forms.RadioButton
|
||||
Public WithEvents absoluteRadio As System.Windows.Forms.RadioButton
|
||||
Friend WithEvents canceledButton As System.Windows.Forms.Button
|
||||
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
|
||||
Me.rotationLabel = New System.Windows.Forms.Label
|
||||
Me.okButton = New System.Windows.Forms.Button
|
||||
Me.canceledButton = New System.Windows.Forms.Button
|
||||
Me.rotationTextBox = New System.Windows.Forms.TextBox
|
||||
Me.relativeRadio = New System.Windows.Forms.RadioButton
|
||||
Me.absoluteRadio = New System.Windows.Forms.RadioButton
|
||||
Me.SuspendLayout()
|
||||
'
|
||||
'rotationLabel
|
||||
'
|
||||
Me.rotationLabel.Location = New System.Drawing.Point(12, 12)
|
||||
Me.rotationLabel.Name = "rotationLabel"
|
||||
Me.rotationLabel.Size = New System.Drawing.Size(51, 17)
|
||||
Me.rotationLabel.TabIndex = 17
|
||||
Me.rotationLabel.Text = "Rotation"
|
||||
'
|
||||
'okButton
|
||||
'
|
||||
Me.okButton.Location = New System.Drawing.Point(12, 65)
|
||||
Me.okButton.Name = "okButton"
|
||||
Me.okButton.Size = New System.Drawing.Size(75, 23)
|
||||
Me.okButton.TabIndex = 16
|
||||
Me.okButton.Text = "&OK"
|
||||
'
|
||||
'canceledButton
|
||||
'
|
||||
Me.canceledButton.DialogResult = System.Windows.Forms.DialogResult.Cancel
|
||||
Me.canceledButton.Location = New System.Drawing.Point(93, 65)
|
||||
Me.canceledButton.Name = "canceledButton"
|
||||
Me.canceledButton.Size = New System.Drawing.Size(75, 23)
|
||||
Me.canceledButton.TabIndex = 15
|
||||
Me.canceledButton.Text = "&Cancel"
|
||||
'
|
||||
'rotationTextBox
|
||||
'
|
||||
Me.rotationTextBox.Location = New System.Drawing.Point(69, 9)
|
||||
Me.rotationTextBox.Name = "rotationTextBox"
|
||||
Me.rotationTextBox.Size = New System.Drawing.Size(100, 20)
|
||||
Me.rotationTextBox.TabIndex = 1
|
||||
'
|
||||
'relativeRadio
|
||||
'
|
||||
Me.relativeRadio.Checked = True
|
||||
Me.relativeRadio.Location = New System.Drawing.Point(12, 35)
|
||||
Me.relativeRadio.Name = "relativeRadio"
|
||||
Me.relativeRadio.Size = New System.Drawing.Size(64, 24)
|
||||
Me.relativeRadio.TabIndex = 11
|
||||
Me.relativeRadio.TabStop = True
|
||||
Me.relativeRadio.Text = "Relative"
|
||||
'
|
||||
'absoluteRadio
|
||||
'
|
||||
Me.absoluteRadio.Location = New System.Drawing.Point(82, 35)
|
||||
Me.absoluteRadio.Name = "absoluteRadio"
|
||||
Me.absoluteRadio.Size = New System.Drawing.Size(72, 24)
|
||||
Me.absoluteRadio.TabIndex = 10
|
||||
Me.absoluteRadio.Text = "Absolute"
|
||||
'
|
||||
'RotateFramingObjectsForm
|
||||
'
|
||||
Me.AcceptButton = Me.okButton
|
||||
Me.AccessibleRole = System.Windows.Forms.AccessibleRole.None
|
||||
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
|
||||
Me.CancelButton = Me.canceledButton
|
||||
Me.ClientSize = New System.Drawing.Size(181, 98)
|
||||
Me.Controls.Add(Me.rotationLabel)
|
||||
Me.Controls.Add(Me.okButton)
|
||||
Me.Controls.Add(Me.canceledButton)
|
||||
Me.Controls.Add(Me.rotationTextBox)
|
||||
Me.Controls.Add(Me.relativeRadio)
|
||||
Me.Controls.Add(Me.absoluteRadio)
|
||||
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
|
||||
Me.MaximizeBox = False
|
||||
Me.MinimizeBox = False
|
||||
Me.Name = "RotateFramingObjectsForm"
|
||||
Me.ShowInTaskbar = False
|
||||
Me.Text = "Rotate Framing Object"
|
||||
Me.ResumeLayout(False)
|
||||
Me.PerformLayout()
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
Private Sub okButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
|
||||
Handles okButton.Click
|
||||
If (m_isReset) Then
|
||||
m_instance.RotateElement()
|
||||
End If
|
||||
Me.DialogResult = System.Windows.Forms.DialogResult.OK
|
||||
Me.Close()
|
||||
End Sub
|
||||
|
||||
Private Sub CloseButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
|
||||
Handles canceledButton.Click
|
||||
Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
|
||||
End Sub
|
||||
|
||||
Private Sub rotationTextBox_TextChanged(ByVal sender As System.Object, _
|
||||
ByVal e As System.EventArgs) Handles rotationTextBox.TextChanged
|
||||
If "" <> Me.rotationTextBox.Text Then
|
||||
Try
|
||||
m_instance.ReceiveRotationTextBox = Convert.ToDouble(Me.rotationTextBox.Text)
|
||||
Catch ex As Exception
|
||||
Autodesk.Revit.UI.TaskDialog.Show("Revit", "Please input number")
|
||||
Me.rotationTextBox.Clear()
|
||||
End Try
|
||||
|
||||
Else
|
||||
m_instance.ReceiveRotationTextBox = 0
|
||||
End If
|
||||
m_isReset = True
|
||||
End Sub
|
||||
|
||||
Private Sub relativeRadio_CheckedChanged(ByVal sender As System.Object, ByVal e _
|
||||
As System.EventArgs) Handles relativeRadio.CheckedChanged
|
||||
m_isReset = True
|
||||
m_instance.IsAbsoluteChecked = False
|
||||
End Sub
|
||||
|
||||
Private Sub absoluteRadio_CheckedChanged(ByVal sender As System.Object, ByVal e _
|
||||
As System.EventArgs) Handles absoluteRadio.CheckedChanged
|
||||
m_isReset = True
|
||||
m_instance.IsAbsoluteChecked = True
|
||||
End Sub
|
||||
Private Sub rotationTextBox_KeyPress(ByVal sender As Object, ByVal e _
|
||||
As System.Windows.Forms.KeyPressEventArgs) Handles rotationTextBox.KeyPress
|
||||
If Microsoft.VisualBasic.ChrW(13) = e.KeyChar Then
|
||||
okButton_Click(sender, e)
|
||||
Else
|
||||
rotationTextBox_TextChanged(sender, e)
|
||||
End If
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user