mirror of
https://github.com/jeremytammik/RevitSdkSamples.git
synced 2026-09-19 10:45:56 +00:00
added Revit 2022 SDK minus except *rvt and *rfa
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
//
|
||||
// (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.
|
||||
//
|
||||
|
||||
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
//
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
//
|
||||
[assembly: AssemblyTitle("")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("")]
|
||||
[assembly: AssemblyCopyright("Copyright © Autodesk, Inc. 2009")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
//
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
//
|
||||
// In order to sign your assembly you must specify a key to use. Refer to the
|
||||
// Microsoft .NET Framework documentation for more information on assembly signing.
|
||||
//
|
||||
// Use the attributes below to control which key is used for signing.
|
||||
//
|
||||
// Notes:
|
||||
// (*) If no key is specified, the assembly is not signed.
|
||||
// (*) KeyName refers to a key that has been installed in the Crypto Service
|
||||
// Provider (CSP) on your machine. KeyFile refers to a file which contains
|
||||
// a key.
|
||||
// (*) If the KeyFile and the KeyName values are both specified, the
|
||||
// following processing occurs:
|
||||
// (1) If the KeyName can be found in the CSP, that key is used.
|
||||
// (2) If the KeyName does not exist and the KeyFile does exist, the key
|
||||
// in the KeyFile is installed into the CSP and used.
|
||||
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
|
||||
// When specifying the KeyFile, the location of the KeyFile should be
|
||||
// relative to the project output directory which is
|
||||
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
|
||||
// located in the project directory, you would specify the AssemblyKeyFile
|
||||
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
|
||||
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
|
||||
// documentation for more information on this.
|
||||
//
|
||||
[assembly: AssemblyDelaySign(false)]
|
||||
[assembly: AssemblyKeyFile("")]
|
||||
[assembly: AssemblyKeyName("")]
|
||||
Binary file not shown.
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RevitAddIns>
|
||||
<AddIn Type="Command">
|
||||
<Assembly>RotateFramingObjects.dll</Assembly>
|
||||
<ClientId>c71ee76a-a962-4434-b610-0ed5e18e03cf</ClientId>
|
||||
<FullClassName>Revit.SDK.Samples.RotateFramingObjects.CS.RotateFramingObjects</FullClassName>
|
||||
<Text>Rotate Framing Objects (CS)</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,362 @@
|
||||
//
|
||||
// (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.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using Autodesk;
|
||||
using Autodesk.Revit;
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.DB.Structure;
|
||||
using Autodesk.Revit.UI;
|
||||
|
||||
namespace Revit.SDK.Samples.RotateFramingObjects.CS
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
|
||||
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
|
||||
[Autodesk.Revit.Attributes.Journaling(Autodesk.Revit.Attributes.JournalingMode.NoCommandData)]
|
||||
public class RotateFramingObjects : IExternalCommand
|
||||
{
|
||||
Autodesk.Revit.UI.UIApplication m_revit = null; // application of Revit
|
||||
double m_receiveRotationTextBox; // receive change of Angle
|
||||
bool m_isAbsoluteChecked; // true if moving absolute
|
||||
const string AngleDefinitionName = "Cross-Section Rotation";
|
||||
|
||||
/// <summary>
|
||||
/// receive change of Angle
|
||||
/// </summary>
|
||||
public double ReceiveRotationTextBox
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_receiveRotationTextBox;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_receiveRotationTextBox = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// is moving absolutely
|
||||
/// </summary>
|
||||
public bool IsAbsoluteChecked
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_isAbsoluteChecked;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_isAbsoluteChecked = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor of RotateFramingObjects
|
||||
/// </summary>
|
||||
public RotateFramingObjects()
|
||||
{ }
|
||||
|
||||
/// <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 Autodesk.Revit.UI.Result Execute(Autodesk.Revit.UI.ExternalCommandData commandData,
|
||||
ref string message, Autodesk.Revit.DB.ElementSet elements)
|
||||
{
|
||||
Autodesk.Revit.UI.UIApplication revit = commandData.Application;
|
||||
|
||||
m_revit = revit;
|
||||
RotateFramingObjectsForm displayForm = new RotateFramingObjectsForm(this);
|
||||
displayForm.StartPosition = FormStartPosition.CenterParent;
|
||||
ElementSet selection = new ElementSet();
|
||||
foreach (ElementId elementId in revit.ActiveUIDocument.Selection.GetElementIds())
|
||||
{
|
||||
selection.Insert(revit.ActiveUIDocument.Document.GetElement(elementId));
|
||||
}
|
||||
bool isSingle = true; //selection is single object
|
||||
bool isAllFamilyInstance = true; //all is not familyInstance
|
||||
|
||||
// There must be beams, braces or columns selected
|
||||
if (selection.IsEmpty)
|
||||
{
|
||||
// nothing selected
|
||||
message = "Please select some beams, braces or columns.";
|
||||
return Autodesk.Revit.UI.Result.Failed;
|
||||
}
|
||||
else if (1 != selection.Size)
|
||||
{
|
||||
isSingle = false;
|
||||
try
|
||||
{
|
||||
if (DialogResult.OK != displayForm.ShowDialog())
|
||||
{
|
||||
return Autodesk.Revit.UI.Result.Cancelled;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return Autodesk.Revit.UI.Result.Failed;
|
||||
}
|
||||
// return Autodesk.Revit.UI.Result.Succeeded;
|
||||
// more than one object selected
|
||||
}
|
||||
|
||||
// if the selected elements are familyInstances, try to get their existing rotation
|
||||
foreach (Autodesk.Revit.DB.Element e in selection)
|
||||
{
|
||||
FamilyInstance familyComponent = e as FamilyInstance;
|
||||
if (familyComponent != null)
|
||||
{
|
||||
if (StructuralType.Beam == familyComponent.StructuralType
|
||||
|| StructuralType.Brace == familyComponent.StructuralType)
|
||||
{
|
||||
// selection is a beam or brace
|
||||
string returnValue = this.FindParameter(AngleDefinitionName, familyComponent);
|
||||
displayForm.rotationTextBox.Text = returnValue.ToString();
|
||||
}
|
||||
else if (StructuralType.Column == familyComponent.StructuralType)
|
||||
{
|
||||
// selection is a column
|
||||
Location columnLocation = familyComponent.Location;
|
||||
LocationPoint pointLocation = columnLocation as LocationPoint;
|
||||
double temp = pointLocation.Rotation;
|
||||
string output = (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;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isSingle)
|
||||
{
|
||||
message = "It is not a FamilyInstance.";
|
||||
elements.Insert(e);
|
||||
return Autodesk.Revit.UI.Result.Failed;
|
||||
}
|
||||
// there is some objects is not familyInstance
|
||||
message = "They are not FamilyInstances";
|
||||
elements.Insert(e);
|
||||
isAllFamilyInstance = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (isSingle)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (DialogResult.OK != displayForm.ShowDialog())
|
||||
{
|
||||
return Autodesk.Revit.UI.Result.Cancelled;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return Autodesk.Revit.UI.Result.Failed;
|
||||
}
|
||||
}
|
||||
|
||||
if (isAllFamilyInstance)
|
||||
{
|
||||
return Autodesk.Revit.UI.Result.Succeeded;
|
||||
}
|
||||
else
|
||||
{
|
||||
//output error information
|
||||
return Autodesk.Revit.UI.Result.Failed;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The function set value to rotation of the beams and braces
|
||||
/// and rotate columns.
|
||||
/// </summary>
|
||||
public void RotateElement()
|
||||
{
|
||||
Transaction transaction = new Transaction(m_revit.ActiveUIDocument.Document, "RotateElement");
|
||||
transaction.Start();
|
||||
try
|
||||
{
|
||||
ElementSet selection = new ElementSet();
|
||||
foreach (ElementId elementId in m_revit.ActiveUIDocument.Selection.GetElementIds())
|
||||
{
|
||||
selection.Insert(m_revit.ActiveUIDocument.Document.GetElement(elementId));
|
||||
}
|
||||
foreach (Autodesk.Revit.DB.Element e in selection)
|
||||
{
|
||||
FamilyInstance familyComponent = e as FamilyInstance;
|
||||
if (familyComponent == null)
|
||||
{
|
||||
//is not a familyInstance
|
||||
continue;
|
||||
}
|
||||
// if be familyInstance,judge the types of familyInstance
|
||||
if (StructuralType.Beam == familyComponent.StructuralType
|
||||
|| StructuralType.Brace == familyComponent.StructuralType)
|
||||
{
|
||||
// selection is a beam or Brace
|
||||
ParameterSetIterator paraIterator = familyComponent.Parameters.ForwardIterator();
|
||||
paraIterator.Reset();
|
||||
|
||||
while (paraIterator.MoveNext())
|
||||
{
|
||||
object para = paraIterator.Current;
|
||||
Parameter objectAttribute = para as Parameter;
|
||||
//set generic property named "Cross-Section Rotation"
|
||||
if (objectAttribute.Definition.Name.Equals(AngleDefinitionName))
|
||||
{
|
||||
Double originDegree = objectAttribute.AsDouble();
|
||||
double rotateDegree = m_receiveRotationTextBox * Math.PI / 180;
|
||||
if (!m_isAbsoluteChecked)
|
||||
{
|
||||
// absolute rotation
|
||||
rotateDegree += originDegree;
|
||||
}
|
||||
objectAttribute.Set(rotateDegree);
|
||||
// relative rotation
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (StructuralType.Column == familyComponent.StructuralType)
|
||||
{
|
||||
// rotate a column
|
||||
Autodesk.Revit.DB.Location columnLocation = familyComponent.Location;
|
||||
// get the location object
|
||||
LocationPoint pointLocation = columnLocation as LocationPoint;
|
||||
Autodesk.Revit.DB.XYZ insertPoint = pointLocation.Point;
|
||||
// get the location point
|
||||
double temp = pointLocation.Rotation;
|
||||
//existing rotation
|
||||
Autodesk.Revit.DB.XYZ directionPoint = new Autodesk.Revit.DB.XYZ(0, 0, 1);
|
||||
// define the vector of axis
|
||||
Line rotateAxis = Line.CreateUnbound(insertPoint, directionPoint);
|
||||
double rotateDegree = m_receiveRotationTextBox * Math.PI / 180;
|
||||
// rotate column by rotate method
|
||||
if (m_isAbsoluteChecked)
|
||||
{
|
||||
rotateDegree -= temp;
|
||||
}
|
||||
bool rotateResult = pointLocation.Rotate(rotateAxis, rotateDegree);
|
||||
if (rotateResult == false)
|
||||
{
|
||||
TaskDialog.Show("Revit", "Rotate Failed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
transaction.Commit();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TaskDialog.Show("Revit", "Rotate failed! " + ex.Message);
|
||||
transaction.RollBack();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get the parameter value according given parameter name
|
||||
/// </summary>
|
||||
public string FindParameter(string parameterName, FamilyInstance familyInstanceName)
|
||||
{
|
||||
ParameterSetIterator i = familyInstanceName.Parameters.ForwardIterator();
|
||||
i.Reset();
|
||||
string valueOfParameter = null;
|
||||
bool iMoreAttribute = i.MoveNext();
|
||||
while (iMoreAttribute)
|
||||
{
|
||||
bool isFound = false;
|
||||
object o = i.Current;
|
||||
Parameter familyAttribute = o as Parameter;
|
||||
if (familyAttribute.Definition.Name == parameterName)
|
||||
{
|
||||
//find the parameter whose name is same to the given parameter name
|
||||
Autodesk.Revit.DB.StorageType st = familyAttribute.StorageType;
|
||||
switch (st)
|
||||
{
|
||||
//get the storage type
|
||||
case StorageType.Double:
|
||||
if (parameterName.Equals(AngleDefinitionName))
|
||||
{
|
||||
//make conversion between degrees and radians
|
||||
Double temp = familyAttribute.AsDouble();
|
||||
valueOfParameter = Math.Round(temp * 180 / (Math.PI), 3).ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
valueOfParameter = familyAttribute.AsDouble().ToString();
|
||||
}
|
||||
break;
|
||||
case StorageType.ElementId:
|
||||
//get Autodesk.Revit.DB.ElementId as string
|
||||
valueOfParameter = familyAttribute.AsElementId().IntegerValue.ToString();
|
||||
break;
|
||||
case StorageType.Integer:
|
||||
//get Integer as string
|
||||
valueOfParameter = familyAttribute.AsInteger().ToString();
|
||||
break;
|
||||
case StorageType.String:
|
||||
//get string
|
||||
valueOfParameter = familyAttribute.AsString();
|
||||
break;
|
||||
case StorageType.None:
|
||||
valueOfParameter = familyAttribute.AsValueString();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
isFound = true;
|
||||
}
|
||||
if (isFound)
|
||||
{
|
||||
break;
|
||||
}
|
||||
iMoreAttribute = i.MoveNext();
|
||||
}
|
||||
//return the value.
|
||||
return valueOfParameter;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
<?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>{48A33B6D-7E0A-4F17-9E8F-47A85E87B532}</ProjectGuid>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ApplicationIcon>
|
||||
</ApplicationIcon>
|
||||
<AssemblyKeyContainerName>
|
||||
</AssemblyKeyContainerName>
|
||||
<AssemblyName>RotateFramingObjects</AssemblyName>
|
||||
<AssemblyOriginatorKeyFile>
|
||||
</AssemblyOriginatorKeyFile>
|
||||
<DefaultClientScript>JScript</DefaultClientScript>
|
||||
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
|
||||
<DefaultTargetSchema>IE50</DefaultTargetSchema>
|
||||
<DelaySign>false</DelaySign>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>RotateFramingObjects</RootNamespace>
|
||||
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
|
||||
<StartupObject>
|
||||
</StartupObject>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<OldToolsVersion>2.0</OldToolsVersion>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<NoStdLib>false</NoStdLib>
|
||||
<NoWarn>
|
||||
</NoWarn>
|
||||
<Optimize>false</Optimize>
|
||||
<RegisterForComInterop>false</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>false</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DebugType>full</DebugType>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<NoStdLib>false</NoStdLib>
|
||||
<NoWarn>
|
||||
</NoWarn>
|
||||
<Optimize>true</Optimize>
|
||||
<RegisterForComInterop>false</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>false</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DebugType>none</DebugType>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<Optimize>true</Optimize>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
|
||||
</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>
|
||||
<Compile Include="AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="RotateFramingObjects.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="RotateFramingObjectsForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="RotateFramingObjectsForm.resx">
|
||||
<DependentUpon>RotateFramingObjectsForm.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework Client Profile</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 2.0 %28x86%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.0 %28x86%29</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<Import Project="$(SolutionDir)VSProps\SDKSamples.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,254 @@
|
||||
//
|
||||
// (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.
|
||||
//
|
||||
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using Autodesk.Revit.UI;
|
||||
|
||||
namespace Revit.SDK.Samples.RotateFramingObjects.CS
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for PutDialog.
|
||||
/// </summary>
|
||||
public class RotateFramingObjectsForm : System.Windows.Forms.Form
|
||||
{
|
||||
|
||||
private RotateFramingObjects m_instance;
|
||||
private System.ComponentModel.Container m_components = null;
|
||||
private System.Windows.Forms.Button cancelButton;
|
||||
private System.Windows.Forms.Button okButton;
|
||||
public System.Windows.Forms.RadioButton absoluteRadio;
|
||||
private System.Windows.Forms.RadioButton relativeRadio;
|
||||
private System.Windows.Forms.Label rotationLabel;
|
||||
public System.Windows.Forms.TextBox rotationTextBox;
|
||||
private bool m_isReset;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public bool IsReset
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_isReset;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_isReset = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// new form, retrieve relevant data from instance
|
||||
/// </summary>
|
||||
/// <param name="Inst">RotateFramingObjects instance</param>
|
||||
public RotateFramingObjectsForm(RotateFramingObjects Inst)
|
||||
{
|
||||
m_isReset = false;
|
||||
m_instance = Inst;
|
||||
if (null == m_instance)
|
||||
{
|
||||
TaskDialog.Show("Revit", "Load Application Failed");
|
||||
}
|
||||
InitializeComponent();
|
||||
//this.rotationTextBox.Text = "Value";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
protected override void Dispose( bool disposing )
|
||||
{
|
||||
if( disposing )
|
||||
{
|
||||
if(m_components != null)
|
||||
{
|
||||
m_components.Dispose();
|
||||
}
|
||||
}
|
||||
base.Dispose( disposing );
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.absoluteRadio = new System.Windows.Forms.RadioButton();
|
||||
this.relativeRadio = new System.Windows.Forms.RadioButton();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.rotationLabel = new System.Windows.Forms.Label();
|
||||
this.rotationTextBox = new System.Windows.Forms.TextBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// absoluteRadio
|
||||
//
|
||||
this.absoluteRadio.Location = new System.Drawing.Point(85, 35);
|
||||
this.absoluteRadio.Name = "absoluteRadio";
|
||||
this.absoluteRadio.Size = new System.Drawing.Size(72, 24);
|
||||
this.absoluteRadio.TabIndex = 0;
|
||||
this.absoluteRadio.Text = "Absolute";
|
||||
this.absoluteRadio.CheckedChanged += new System.EventHandler(this.allRadio_CheckedChanged);
|
||||
//
|
||||
// relativeRadio
|
||||
//
|
||||
this.relativeRadio.Checked = true;
|
||||
this.relativeRadio.Location = new System.Drawing.Point(15, 35);
|
||||
this.relativeRadio.Name = "relativeRadio";
|
||||
this.relativeRadio.Size = new System.Drawing.Size(64, 24);
|
||||
this.relativeRadio.TabIndex = 1;
|
||||
this.relativeRadio.TabStop = true;
|
||||
this.relativeRadio.Text = "Relative";
|
||||
this.relativeRadio.CheckedChanged += new System.EventHandler(this.singleRadio_CheckedChanged);
|
||||
//
|
||||
// cancelButton
|
||||
//
|
||||
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.cancelButton.Location = new System.Drawing.Point(93, 65);
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.cancelButton.TabIndex = 6;
|
||||
this.cancelButton.Text = "&Cancel";
|
||||
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
this.okButton.Location = new System.Drawing.Point(15, 65);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.okButton.TabIndex = 8;
|
||||
this.okButton.Text = "&OK";
|
||||
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||
//
|
||||
// rotationLabel
|
||||
//
|
||||
this.rotationLabel.Location = new System.Drawing.Point(12, 12);
|
||||
this.rotationLabel.Name = "rotationLabel";
|
||||
this.rotationLabel.Size = new System.Drawing.Size(50, 16);
|
||||
this.rotationLabel.TabIndex = 10;
|
||||
this.rotationLabel.Text = "Rotation";
|
||||
//
|
||||
// rotationTextBox
|
||||
//
|
||||
this.rotationTextBox.Location = new System.Drawing.Point(68, 9);
|
||||
this.rotationTextBox.Name = "rotationTextBox";
|
||||
this.rotationTextBox.Size = new System.Drawing.Size(100, 20);
|
||||
this.rotationTextBox.TabIndex = 1;
|
||||
this.rotationTextBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.rotationTextBox_KeyPress);
|
||||
this.rotationTextBox.TextChanged += new System.EventHandler(this.rotationTextBox_TextChanged);
|
||||
//
|
||||
// RotateFramingObjectsForm
|
||||
//
|
||||
this.AcceptButton = this.okButton;
|
||||
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
|
||||
this.CancelButton = this.cancelButton;
|
||||
this.ClientSize = new System.Drawing.Size(185, 101);
|
||||
this.Controls.Add(this.rotationTextBox);
|
||||
this.Controls.Add(this.relativeRadio);
|
||||
this.Controls.Add(this.rotationLabel);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.Controls.Add(this.cancelButton);
|
||||
this.Controls.Add(this.absoluteRadio);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "RotateFramingObjectsForm";
|
||||
this.ShowInTaskbar = false;
|
||||
this.Text = "Rotate Framing Objects";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void okButton_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
if(IsReset)
|
||||
{
|
||||
m_instance.RotateElement();
|
||||
|
||||
}
|
||||
this.DialogResult=DialogResult.OK;
|
||||
this.Close();
|
||||
|
||||
}
|
||||
|
||||
private void cancelButton_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
this.DialogResult=DialogResult.Cancel;
|
||||
this.Close();
|
||||
|
||||
}
|
||||
private void singleRadio_CheckedChanged(object sender, System.EventArgs e)
|
||||
{
|
||||
m_isReset = true;
|
||||
m_instance.IsAbsoluteChecked = false;
|
||||
}
|
||||
|
||||
private void allRadio_CheckedChanged(object sender, System.EventArgs e)
|
||||
{
|
||||
m_isReset = true;
|
||||
m_instance.IsAbsoluteChecked = true;
|
||||
}
|
||||
|
||||
private void rotationTextBox_TextChanged(object sender, System.EventArgs e)
|
||||
{
|
||||
if("" != this.rotationTextBox.Text)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_instance.ReceiveRotationTextBox = Convert.ToDouble(this.rotationTextBox.Text);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//this.DialogResult=DialogResult.Cancel;
|
||||
TaskDialog.Show("Revit", "Please input number.");
|
||||
this.rotationTextBox.Clear();
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
m_instance.ReceiveRotationTextBox = 0;
|
||||
}
|
||||
m_isReset = true;
|
||||
}
|
||||
|
||||
private void rotationTextBox_KeyPress(object sender, KeyPressEventArgs e)
|
||||
{
|
||||
if (13 == e.KeyChar)
|
||||
{
|
||||
okButton_Click(sender,e);
|
||||
}
|
||||
else
|
||||
rotationTextBox_TextChanged(sender,e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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,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