added Revit 2022 SDK minus except *rvt and *rfa

This commit is contained in:
Jeremy Tammik
2021-04-20 11:36:21 +02:00
parent 1133a82dc5
commit 7e327986e8
3034 changed files with 1245318 additions and 0 deletions
+100
View File
@@ -0,0 +1,100 @@
//
// (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.Collections.Generic;
using System.Text;
using Autodesk.Revit;
using System.Windows.Forms;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Selection;
using System.Collections;
namespace Revit.SDK.Samples.SlabShapeEditing.CS
{
/// <summary>
/// The entrance of this example, implements the Execute method of IExternalCommand
/// </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 Command : IExternalCommand
{
#region IExternalCommand Members Implementation
///<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(ExternalCommandData commandData,
ref string message, Autodesk.Revit.DB.ElementSet elements)
{
Floor selectFloor = GetSelectFloor(commandData);
if (null == selectFloor)
{
message = "Make sure selected only one floor (Slab) in Revit.";
return Autodesk.Revit.UI.Result.Failed;
}
SlabShapeEditingForm slabShapeEditingForm =
new SlabShapeEditingForm(selectFloor, commandData);
slabShapeEditingForm.ShowDialog();
return Autodesk.Revit.UI.Result.Succeeded;
}
/// <summary>
/// get selected floor (slab)
/// </summary>
/// <param name="commandData">object which contains reference of Revit Application.</param>
/// <returns>selected floor (slab)</returns>
private Floor GetSelectFloor(ExternalCommandData commandData)
{
ElementSet eleSet = new ElementSet();
foreach (ElementId elementId in commandData.Application.ActiveUIDocument.Selection.GetElementIds())
{
eleSet.Insert(commandData.Application.ActiveUIDocument.Document.GetElement(elementId));
}
if (eleSet.Size != 1) { return null; }
IEnumerator iter = eleSet.GetEnumerator();
iter.Reset();
while (iter.MoveNext())
{
return iter.Current as Floor;
}
return null;
}
#endregion
}
}
+115
View File
@@ -0,0 +1,115 @@
//
// (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.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Collections;
namespace Revit.SDK.Samples.SlabShapeEditing.CS
{
/// <summary>
/// tool used to draw line
/// </summary>
class LineTool
{
#region class member variables
ArrayList m_Points; //record all the points draw by this tool
PointF m_movePoint; //record the coordinate of location where mouse just moved to.
#endregion
/// <summary>
/// Get all the points of this tool
/// </summary>
public ArrayList Points
{
get
{
return m_Points;
}
set
{
m_Points = value;
}
}
/// <summary>
///Get coordinate of location where mouse just moved to.
/// </summary>
public PointF MovePoint
{
get
{
return m_movePoint;
}
set
{
m_movePoint = value;
}
}
/// <summary>
/// default constructor
/// </summary>
public LineTool()
{
m_Points = new ArrayList();
m_movePoint = Point.Empty;
}
/// <summary>
/// draw the stored lines
/// </summary>
/// <param name="graphics">Graphics object, used to draw geometry</param>
/// <param name="pen">Pen which used to draw lines</param>
public void Draw2D(Graphics graphics, Pen pen)
{
for (int i = 0; i < m_Points.Count - 1; i+=2)
{
graphics.DrawLine(pen, (PointF)m_Points[i], (PointF)m_Points[i+1]);
}
//draw the moving point
if (!m_movePoint.IsEmpty)
{
if (m_Points.Count >= 1)
{
graphics.DrawLine(pen, (PointF)m_Points[m_Points.Count - 1], m_movePoint);
}
}
}
/// <summary>
/// draw rectangle with specific graphics and pen
/// </summary>
/// <param name="graphics">Graphics object, used to draw geometry</param>
/// <param name="pen">Pen which used to draw lines</param>
public void DrawRectangle(Graphics graphics, Pen pen)
{
for (int i = 0; i < m_Points.Count - 1; i += 2)
{
PointF pointF = (PointF)m_Points[i];
graphics.DrawRectangle(pen, pointF.X-2, pointF.Y-2, 4, 4);
}
}
}
}
@@ -0,0 +1,528 @@
//
// (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.Collections.Generic;
using System.Text;
using Autodesk.Revit.DB;
namespace Revit.SDK.Samples.SlabShapeEditing.CS
{
/// <summary>
/// Vector4 is a homogeneous coordinate class used to store vector
/// and contain method to handle the vector
/// </summary>
public class Vector4
{
#region Class member variables and properties
private double m_x;
private double m_y;
private double m_z;
private double m_w = 1.0f;
/// <summary>
/// X property to get/set x value of Vector4
/// </summary>
public double X
{
get
{
return m_x;
}
set
{
m_x = value;
}
}
/// <summary>
/// Y property to get/set y value of Vector4
/// </summary>
public double Y
{
get
{
return m_y;
}
set
{
m_y = value;
}
}
/// <summary>
/// Z property to get/set z value of Vector4
/// </summary>
public double Z
{
get
{
return m_z;
}
set
{
m_z = value;
}
}
/// <summary>
/// W property to get/set fourth value of Vector4
/// </summary>
public double W
{
get
{
return m_w;
}
set
{
m_w = value;
}
}
#endregion
/// <summary>
/// constructor
/// </summary>
public Vector4(double x, double y, double z)
{
this.X = x; this.Y = y; this.Z = z;
}
/// <summary>
/// constructor, transfer Autodesk.Revit.DB.XYZ to vector
/// </summary>
/// <param name="v">Autodesk.Revit.DB.XYZ structure which needs to be transferred</param>
public Vector4(Autodesk.Revit.DB.XYZ v)
{
this.X = (double)v.X; this.Y = (double)v.Y; this.Z = (double)v.Z;
}
/// <summary>
/// adds two vectors
/// </summary>
/// <param name="va">first vector</param>
/// <param name="vb">second vector</param>
public static Vector4 operator+ (Vector4 va, Vector4 vb)
{
return new Vector4(va.X + vb.X, va.Y + vb.Y, va.Z + vb.Z);
}
/// <summary>
/// subtracts two vectors
/// </summary>
/// <param name="va">first vector</param>
/// <param name="vb">second vector</param>
/// <returns>subtraction of two vectors</returns>
public static Vector4 operator- (Vector4 va, Vector4 vb)
{
return new Vector4(va.X - vb.X, va.Y - vb.Y, va.Z - vb.Z);
}
/// <summary>
/// multiplies a vector by a double type value
/// </summary>
/// <param name="v">vector</param>
/// <param name="factor">multiplier of double type</param>
/// <returns> the result vector </returns>
public static Vector4 operator *(Vector4 v, double factor)
{
return new Vector4(v.X * factor, v.Y * factor, v.Z * factor);
}
/// <summary>
/// divides vector by a double type value
/// </summary>
/// <param name="v">vector</param>
/// <param name="factor">double type value</param>
/// <returns> vector divided by a double type value </returns>
public static Vector4 operator /(Vector4 v, double factor)
{
return new Vector4(v.X / factor, v.Y / factor, v.Z / factor);
}
/// <summary>
/// dot multiply vector
/// </summary>
/// <param name="v"> the result vector </param>
public double DotProduct(Vector4 v)
{
return (this.X * v.X + this.Y * v.Y + this.Z * v.Z);
}
/// <summary>
/// get normal vector of plane contains two vectors
/// </summary>
/// <param name="v">second vector</param>
/// <returns> normal vector of two vectors</returns>
public Vector4 CrossProduct(Vector4 v)
{
return new Vector4(this.Y * v.Z - this.Z * v.Y,this.Z * v.X
- this.X * v.Z,this.X * v.Y - this.Y * v.X);
}
/// <summary>
/// dot multiply two vectors
/// </summary>
/// <param name="va">first vector</param>
/// <param name="vb">second vector</param>
public static double DotProduct(Vector4 va, Vector4 vb)
{
return (va.X * vb.X + va.Y * vb.Y + va.Z * vb.Z);
}
/// <summary>
/// get normal vector of two vectors
/// </summary>
/// <param name="va">first vector</param>
/// <param name="vb">second vector</param>
/// <returns> normal vector of two vectors </returns>
public static Vector4 CrossProduct(Vector4 va, Vector4 vb)
{
return new Vector4(va.Y * vb.Z - va.Z * vb.Y, va.Z * vb.X
- va.X * vb.Z, va.X * vb.Y - va.Y * vb.X);
}
/// <summary>
/// get unit vector
/// </summary>
public void Normalize()
{
double length = Length();
if(length == 0)
{
length = 1;
}
this.X /= length;
this.Y /= length;
this.Z /= length;
}
/// <summary>
/// calculate the length of vector
/// </summary>
public double Length()
{
return (double)Math.Sqrt(this.X * this.X + this.Y * this.Y + this.Z * this.Z);
}
};
/// <summary>
/// Matrix used to transform between ucs coordinate and world coordinate.
/// </summary>
public class Matrix4
{
#region MatrixType
/// <summary>
/// Matrix Type Enum use to define function of matrix
/// </summary>
public enum MatrixType
{
Rotation, // matrix use to rotate
Translation, // matrix used to Translation
Scale, // matrix used to Scale
RotationAndTranslation, // matrix used to Rotation and Translation
Normal // normal matrix
};
private double[,] m_matrix = new double[4,4]; // an array stores the matrix
private MatrixType m_type; //type of matrix
#endregion
/// <summary>
/// X property to get/set Type of matrix
/// </summary>
public MatrixType Type
{
get
{
return m_type;
}
set
{
m_type = value;
}
}
/// <summary>
/// X property to get/set Array which store data for matrix
/// </summary>
public double[,] Matrix
{
get
{
return m_matrix;
}
set
{
m_matrix = value;
}
}
/// <summary>
/// get a matrix used to rotate object specific angle on X direction
/// </summary>
/// <param name="angle">rotate angle</param>
/// <returns>matrix which rotate object specific angle on X direction</returns>
public static Matrix4 RotateX(double angle)
{
Matrix4 rotateX = new Matrix4();
rotateX.Type = MatrixType.Rotation;
rotateX.Identity();
double sin = (double)Math.Sin(angle);
double cos = (double)Math.Cos(angle);
rotateX.Matrix[1, 1] = cos;
rotateX.Matrix[1, 2] = sin;
rotateX.Matrix[2, 1] = -sin;
rotateX.Matrix[2, 2] = cos;
return rotateX;
}
/// <summary>
/// get a matrix used to rotate object specific angle on Y direction
/// </summary>
/// <param name="angle">rotate angle</param>
/// <returns>matrix which rotate object specific angle on Y direction</returns>
public static Matrix4 RotateY(double angle)
{
Matrix4 rotateX = new Matrix4();
rotateX.Type = MatrixType.Rotation;
rotateX.Identity();
double sin = (double)Math.Sin(angle);
double cos = (double)Math.Cos(angle);
rotateX.Matrix[0, 0] = cos;
rotateX.Matrix[0, 2] = -sin;
rotateX.Matrix[2, 0] = sin;
rotateX.Matrix[2, 2] = cos;
return rotateX;
}
/// <summary>
/// get a matrix used to rotate object specific angle on Z direction
/// </summary>
/// <param name="angle">rotate angle</param>
/// <returns>matrix which rotate object specific angle on Z direction</returns>
public static Matrix4 RotateZ(double angle)
{
Matrix4 rotateX = new Matrix4();
rotateX.Type = MatrixType.Rotation;
rotateX.Identity();
double sin = (double)Math.Sin(angle);
double cos = (double)Math.Cos(angle);
rotateX.Matrix[1, 1] = cos;
rotateX.Matrix[1, 2] = sin;
rotateX.Matrix[2, 1] = -sin;
rotateX.Matrix[2, 2] = cos;
return rotateX;
}
/// <summary>
/// default constructor
/// </summary>
public Matrix4()
{
m_type = MatrixType.Normal;
Identity();
}
/// <summary>
/// ctor,rotation matrix,origin at (0,0,0)
/// </summary>
/// <param name="xAxis">identity of x axis</param>
/// <param name="yAxis">identity of y axis</param>
/// <param name="zAxis">identity of z axis</param>
public Matrix4(Vector4 xAxis,Vector4 yAxis, Vector4 zAxis)
{
m_type = MatrixType.Rotation;
Identity();
m_matrix[0, 0] = xAxis.X; m_matrix[0, 1] = xAxis.Y; m_matrix[0, 2] = xAxis.Z;
m_matrix[1, 0] = yAxis.X; m_matrix[1, 1] = yAxis.Y; m_matrix[1, 2] = yAxis.Z;
m_matrix[2, 0] = zAxis.X; m_matrix[2, 1] = zAxis.Y; m_matrix[2, 2] = zAxis.Z;
}
/// <summary>
/// ctor,translation matrix.
/// </summary>
/// <param name="origin">origin of ucs in world coordinate</param>
public Matrix4(Vector4 origin)
{
m_type = MatrixType.Translation;
Identity();
m_matrix[3, 0] = origin.X; m_matrix[3, 1] = origin.Y; m_matrix[3, 2] = origin.Z;
}
/// <summary>
/// rotation and translation matrix constructor
/// </summary>
/// <param name="xAxis">x Axis</param>
/// <param name="yAxis">y Axis</param>
/// <param name="zAxis">z Axis</param>
/// <param name="origin">origin</param>
public Matrix4(Vector4 xAxis, Vector4 yAxis, Vector4 zAxis, Vector4 origin)
{
m_type = MatrixType.RotationAndTranslation;
Identity();
m_matrix[0, 0] = xAxis.X; m_matrix[0, 1] = xAxis.Y; m_matrix[0, 2] = xAxis.Z;
m_matrix[1, 0] = yAxis.X; m_matrix[1, 1] = yAxis.Y; m_matrix[1, 2] = yAxis.Z;
m_matrix[2, 0] = zAxis.X; m_matrix[2, 1] = zAxis.Y; m_matrix[2, 2] = zAxis.Z;
m_matrix[3, 0] = origin.X; m_matrix[3, 1] = origin.Y; m_matrix[3, 2] = origin.Z;
}
/// <summary>
/// scale matrix constructor
/// </summary>
/// <param name="scale">scale factor</param>
public Matrix4(double scale)
{
m_type = MatrixType.Scale;
Identity();
m_matrix[0, 0] = scale;
m_matrix[1, 1] = scale;
m_matrix[2, 2] = scale;
}
/// <summary>
/// indexer of matrix
/// </summary>
/// <param name="row">row number</param>
/// <param name="column">column number</param>
/// <returns></returns>
public double this[int row, int column]
{
get
{
return this.m_matrix[row, column];
}
set
{
this.m_matrix[row, column] = value;
}
}
/// <summary>
/// Identity matrix
/// </summary>
public void Identity()
{
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 4; j++)
{
this.m_matrix[i, j] = 0.0f;
}
}
this.m_matrix[0, 0] = 1.0f;
this.m_matrix[1, 1] = 1.0f;
this.m_matrix[2, 2] = 1.0f;
this.m_matrix[3, 3] = 1.0f;
}
/// <summary>
/// multiply matrix left and right
/// </summary>
/// <param name="left">left matrix</param>
/// <param name="right">right matrix</param>
/// <returns></returns>
public static Matrix4 Multiply(Matrix4 left, Matrix4 right)
{
Matrix4 result = new Matrix4();
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 4; j++)
{
result[i, j] = left[i, 0] * right[0, j] + left[i, 1] * right[1, j]
+ left[i, 2] * right[2, j] + left[i, 3] * right[3, j];
}
}
return result;
}
/// <summary>
/// transform point using this matrix
/// </summary>
/// <param name="point">point to be transformed</param>
/// <returns>transform result</returns>
public Vector4 Transform(Vector4 point)
{
return new Vector4(point.X * this[0, 0] + point.Y * this[1, 0]
+ point.Z * this[2, 0]+ point.W * this[3, 0],
point.X * this[0, 1] + point.Y * this[1, 1]
+ point.Z * this[2, 1]+ point.W * this[3, 1],
point.X * this[0, 2] + point.Y * this[1, 2]
+ point.Z * this[2, 2]+ point.W * this[3, 2]);
}
/// <summary>
/// if m_matrix is a rotation matrix,this method can get the rotation inverse matrix.
/// </summary>
/// <returns>inverse of rotation matrix</returns>
public Matrix4 RotationInverse()
{
return new Matrix4(new Vector4(this[0, 0], this[1, 0], this[2, 0]),
new Vector4(this[0, 1], this[1, 1], this[2, 1]),
new Vector4(this[0, 2], this[1, 2], this[2, 2]));
}
/// <summary>
/// if this m_matrix is a translation matrix,
/// this method can get the translation inverse matrix.
/// </summary>
/// <returns>inverse of translation matrix</returns>
public Matrix4 TranslationInverse()
{
return new Matrix4(new Vector4(-this[3, 0], -this[3, 1], -this[3, 2]));
}
/// <summary>
/// get inverse matrix
/// </summary>
/// <returns>inverse matrix</returns>
public Matrix4 Inverse()
{
switch(m_type)
{
case MatrixType.Rotation: return RotationInverse();
case MatrixType.Translation: return TranslationInverse();
case MatrixType.RotationAndTranslation:
return Multiply(TranslationInverse(),RotationInverse());
case MatrixType.Scale: return ScaleInverse();
case MatrixType.Normal: return new Matrix4();
default: return null;
}
}
/// <summary>
/// if m_matrix is a scale matrix,this method can get the scale inverse matrix.
/// </summary>
/// <returns>inverse of scale matrix</returns>
public Matrix4 ScaleInverse()
{
return new Matrix4(1 / m_matrix[0,0]);
}
};
}
@@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SlabShapeEditing")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SlabShapeEditing")]
[assembly: AssemblyCopyright("Copyright © Autodesk, Inc. 2009")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c852362e-bc06-4c93-9ff3-155586d66101")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace SlabShapeEditing.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SlabShapeEditing.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}
@@ -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,246 @@
{\rtf1\fbidis\ansi\ansicpg1252\deff0\deflang1033\deflangfe1033\deftab420{\fonttbl{\f0\fswiss\fprq2\fcharset0 Arial;}{\f1\fswiss\fprq2\fcharset0 Tahoma;}{\f2\fnil\fcharset0 Tahoma;}}
{\colortbl ;\red0\green0\blue0;}
{\info{\horzdoc}{\*\lchars (.<?[\'7b\'ab\'b7\'91\'93}{\*\fchars !"'),.:\'3b>?]`|\'7d~\'a8\'af\'b7\'bb\'92\'94\'85}}
\viewkind4\uc1\pard\ltrpar\nowidctlpar\kerning2\b\f0\fs20 Application:\b0 SlabShapeEditing\line\b Revit Platform:\b0 Architecture, Structure\line\b Revit Version:\b0 2011.0\line\b First Released For:\b0 2009.0\line\b Programming Language:\b0 C#\line\b Skill Level:\b0 Medium\line\b Category:\b0 Geometry, Elements\line\b Type:\b0 ExternalCommand\line\line\b Subject:\b0 Create SlabShapeVertex and SlabShapeCrease.\line\b Summary:\b0 \line\kerning0 This sample demonstrates how to create SlabShapeVertex and SlabShapeCrease, and then use them to edit slab\rquote s shape.\par
\pard\ltrpar\nowidctlpar\qj\kerning2\b\par
Classes: \par
\pard\ltrpar\nowidctlpar\fi360\kerning0\b0 Autodesk.Revit.DB.SlabShapeEditor\par
Autodesk.Revit.DB.SlabShapeCrease\par
Autodesk.Revit.DB.SlabShapeCreaseArray\par
Autodesk.Revit.DB.SlabShapeCreaseArrayIterator\par
Autodesk.Revit.DB.SlabShapeVertex\par
Autodesk.Revit.DB.Line\par
Autodesk.Revit.DB.Edge\par
Autodesk.Revit.DB.CurveArray\par
Autodesk.Revit.DB.GeometryObject\par
\pard\ltrpar\nowidctlpar\qj\kerning2\par
\b Project Files: \par
\b0 Command.cs\par
\pard\ltrpar\nowidctlpar\li360\kerning0 This file contains a class Command that implements the IExternalCommand interface, get selected slab, creates SlabShapeEditingForm and gets ExternalCommandData.\par
\par
\pard\ltrpar\nowidctlpar\qj SlabShapeEditingForm\kerning2 .cs\par
\pard\ltrpar\nowidctlpar\li360\kerning0 This file contains a class SlabShapeEditingForm which inherits from Form. This Form has a PictureBox show the geometry info of Slab and some button used to create vertex and crease. \par
\pard\ltrpar\nowidctlpar\li720\par
\pard\ltrpar\nowidctlpar\qj\kerning2 SlabProfile.cs\par
\pard\ltrpar\nowidctlpar\li360\tx720\kerning0 This file contains a class \kerning2 Sl\kerning0 abProfile which calculates the geometry info of Slab. SlabProfile consists of methods Draw2D(), AddVertex() and AddCrease(). Draw2D() is used to draw \kerning2 Slab \kerning0 curves on the picture box, and AddVertex() and AddCrease() are used to create vertex and crease on slab.\par
\pard\ltrpar\nowidctlpar\qj\kerning2\par
LineTool.cs\par
\pard\ltrpar\nowidctlpar\li360\tx720\kerning0 This file contains a class named LineTool which provides some methods to draw lines on the form and store the data of drawn lines. It also provide method to draw new created vertex as rectangle\par
\pard\ltrpar\nowidctlpar\tx720\par
\pard\ltrpar\nowidctlpar\qj\kerning2 MathTools.cs\par
\pard\ltrpar\nowidctlpar\li360\tx720\kerning0 This file contains Verctor4 and Matrix4 two classes. These two classes are used to transform points between 3D and 2D.\par
\pard\ltrpar\nowidctlpar\qj\kerning2\par
\b Description:\b0 \par
\pard\ltrpar\nowidctlpar This sample shows user how to:\par
\pard\ltrpar\nowidctlpar\fi-360\li360 1.\tab Create SlabShapeVertex by \par
\pard\ltrpar\nowidctlpar SlabShapeEditor.DrawPoint(Autodesk.Revit.Geometry.XYZ location) method.\par
\pard\ltrpar\nowidctlpar\fi-360\li360 2.\tab Create SlabShapeCrease by\par
\pard\ltrpar\nowidctlpar SlabShapeEditor.DrawSplitLine(SlabShapeVertex startVertex, SlabShapeVertex endVertex) method. A crease is consisted by two vertices.\par
\pard\ltrpar\nowidctlpar\fi-360\li360 3.\tab Move new created vertex by\cf1\kerning0\f1\fs18\par
\pard\ltrpar\nowidctlpar\cf0\kerning2\f0\fs20 SlabShapeEditor.ModifySubElement(SlabShapeVertex pVertex, double offset)\par
\pard\ltrpar\nowidctlpar\fi-360\li360 4.\tab Move new created crease by\cf1\kerning0\f1\fs18\par
\pard\ltrpar\nowidctlpar\cf0\kerning2\f0\fs20 SlabShapeEditor.ModifySubElement(SlabShapeCrease pCrease, double offset), offset use to set position of midpoint on crease.\cf1\kerning0\f1\fs18\par
\pard\ltrpar\nowidctlpar\li360\cf0\kerning2\f0\fs20\par
\pard\ltrpar\nowidctlpar\qj\par
\b Instructions:\b0 \par
\pard\ltrpar\nowidctlpar\fi-420\li420\qj\tx420 1.\tab Draw a slab in Revit or open the CreateComplexAreaRein.rvt, and then select the slab.\par
\pard\ltrpar\nowidctlpar\fi-420\li420\qj 2.\tab Run this command.\par
3.\tab Click \ldblquote create vertex\rdblquote \kerning0\f2\fs17{\pict\wmetafile8\picw635\pich635\picwgoal360\pichgoal360
0100090000031204000000000e03000000000e03000026060f001206574d464301000000000001
00eb5b0000000001000000f005000000000000f0050000010000006c0000000000000000000000
17000000170000000000000000000000770200007802000020454d4600000100f00500000c0000
00010000000000000000000000000000000005000000040000510100000e010000000000000000
00000000000068240500b01e0400460000002c00000020000000454d462b014001001c00000010
0000000210c0db01000000600000006000000046000000b8020000ac020000454d462b22400400
0c000000000000001e4009000c00000000000000244001000c0000000000000030400200100000
00040000000000803f214007000c000000000000000840000504020000f80100000210c0db0100
0000000000000000000000000000000000000100000089504e470d0a1a0a0000000d4948445200
0000180000001808020000006f15aaaf000000017352474200aece1ce900000009704859730000
0ec400000ec401952b0e1b0000018049444154384fad94bf4ac35014c6ad55413385f8043af802
59923d93afd19748910c199a296f10a89363111c043308ba5971707014424b146c081924d0b4e0
a7a79e5cb44993b49770b849eef9eeeffcb9b79524c9d626460b428aa2ac291545d142284b270d
b40683f387a737d77521b4cdfeef93f0239ed6b2bbfb47711c93424e04958a509ee7d1ca93e383
2544f3f977742b2d542ccb324d53d77591280faddd3e8450b9edf72fb1c6b66dc7712449cad257
5996892e17aac202100e5fd3b42644602115c33060111d6c6d22e48559545525a8d1e8b91e11b3
903fb2039c300c91cd1a44220bab8085ea5b95683cfe24e7c79f21b2507dab12f9be4fa9c10403
1131cb7fa21d2e27760882000ed36e171f4f8743fe4535425ee80bf75a96de2cef2356210af853
38e8c03f2c2b8888850651882022cb6f8e0a88580593b3d90c4fa7d329e9f8c2aaedf57aa216bd
969cbec2aaa1fd590b139c6fca45915df73e62eafbdb0bbe8f16e5bfbabe032776a86be3f88574
377af98b096e3cff02f7d9baf0443afd350000000049454e44ae42608200084001082400000018
0000000210c0db01000000030000000000000000000000000000001b4000004000000034000000
0100000002000000000000bf000000bf0000c0410000c04103000000000000b3000000b3ffffbf
41000000b3000000b3ffffbf412100000008000000620000000c00000001000000150000000c00
000004000000150000000c0000000400000051000000d401000000000000000000001700000017
0000000000000000000000000000000000000018000000180000005000000064000000b4000000
20010000000000002000cc00180000001800000028000000180000001800000001000400000000
000000000000000000000000000f0000000000000000000000ffffff00f1f1f10004040400f0fb
ff0090a9ad0077777700d6e7e700eaeaea00b2b2b2006666660086868600c0c0c000cbcbcb0000
008000222222222222222222222222233333333333333333333332239595959595959595959a32
2348888888888888888856322347dbeebc87878787879a322348beeeeb888888888856322347ee
eeee87878787879a322348eeee33b88888888856322347beeeb3b3b78787879a322348dbeedb1b
338888885632234787878b1bbb3787879a32234888888dbbddb3888856322347878787b1111b37
879a3223488888888b1111b3885632234787878787b1111b379a322348888888888b11db335632
23478787878787b1bbb39a32234888888888888bbbbd56322347878787878787b31c9a32234888
88888888888bbb5632234787878787878787879a32234444444444444444445632233333333333
3333333333322222222222222222222222224c0000006400000000000000000000001700000017
000000000000000000000018000000180000002900aa0000000000000000000000803f00000000
000000000000803f00000000000000000000000000000000000000000000000000000000000000
00220000000c000000ffffffff460000001c00000010000000454d462b024000000c0000000000
00000e000000140000000000000010000000140000000400000003010800050000000b02000000
00050000000c0218001800030000001e0004000000070104000400000007010400cf000000410b
2000cc001800180000000000180018000000000028000000180000001800000001000400000000
000000000000000000000000000f0000000000000000000000ffffff00f1f1f10004040400f0fb
ff0090a9ad0077777700d6e7e700eaeaea00b2b2b2006666660086868600c0c0c000cbcbcb0000
008000222222222222222222222222233333333333333333333332239595959595959595959a32
2348888888888888888856322347dbeebc87878787879a322348beeeeb888888888856322347ee
eeee87878787879a322348eeee33b88888888856322347beeeb3b3b78787879a322348dbeedb1b
338888885632234787878b1bbb3787879a32234888888dbbddb3888856322347878787b1111b37
879a3223488888888b1111b3885632234787878787b1111b379a322348888888888b11db335632
23478787878787b1bbb39a32234888888888888bbbbd56322347878787878787b31c9a32234888
88888888888bbb5632234787878787878787879a32234444444444444444445632233333333333
3333333333322222222222222222222222220c00000040092900aa000000000000001800180000
000000040000002701ffff030000000000
}\kerning2\f0\fs20 button and click mouse in picture box to create a vertex on slab.\par
4.\tab Click \ldblquote create crease\rdblquote \kerning0\f2\fs17{\pict\wmetafile8\picw635\pich635\picwgoal360\pichgoal360
010009000003c805000000000e04000000000e04000026060f001208574d464301000000000001
00cf100000000001000000f007000000000000f0070000010000006c0000000000000000000000
17000000170000000000000000000000770200007802000020454d4600000100f00700000c0000
00010000000000000000000000000000000005000000040000510100000e010000000000000000
00000000000068240500b01e0400460000002c00000020000000454d462b014001001c00000010
0000000210c0db010000006000000060000000460000004c03000040030000454d462b22400400
0c000000000000001e4009000c00000000000000244001000c0000000000000030400200100000
00040000000000803f214007000c0000000000000008400005980200008c0200000210c0db0100
0000000000000000000000000000000000000100000089504e470d0a1a0a0000000d4948445200
0000180000001808020000006f15aaaf000000017352474200aece1ce900000009704859730000
0ec400000ec401952b0e1b0000021449444154384f63fcf8f12303350023d0206161610a8d7afb
f62dd4a0dfbf7f33fc21d9699bb71f3a7af4686f6f2fd02026b85b5ebfff05442fde3c239e44f6
07c220514136a00433b3c8a3f5eb674a6aadaff104b2212268e4ce9de7e6cc99337ffe86dfdfef
c1cd42711150f4efdf375fd4d5c1d2c64036440499dcb66d5753539d1b18b0722a613108ee229e
9b3721d2986e397dfaceb3678f52525276eddaf5e5cb17ec5e03060dd46663a80234b79c387142
555555474707221d1616f6e4c9137c2e62380b913d8bec22a05ba4a4a4343434806601930b308c
debd7b47c045986104740bd014636390538166b1b37303197bf6ec91919121218c6ede7cc5c7c7
07310508366fdedcd9d93a6fde3c2d2d2d12c2e8dab56b40d5f6f6f67053cacbcb3b3b3b81a640
42100e58e02c60ac01c31b142eb030faf68dfdd3a74f57ae5c79f0e089b6b6fad5ab37274fee6f
6948b7b0b080c5e91d2c5e83c71a3c8c1e3f7e0cf49495951530ca77efde3d73e6d4b4b4345bc7
28e4d824228cce9e053a07a88e9b9b1b18ae757575b1b1b181818130b740531916af61a6a3c58b
1703530a272727c42c48b800fd0e27b107363c6543c2e8ecd9b3ebd7af07320a0a0ae6ce9d0b89
23ccb44e388c8cd3d21e3fbeb471e346535315a06aacf98e808bf0e435d25cc48023af617517be
5893930bcc7af52ab0a5055779842c8e25d6d6ad5b002c5f8065154924dc20aa16fec8814f361b
007a2886f7604395230000000049454e44ae426082000840010824000000180000000210c0db01
000000030000000000000000000000000000001b40000040000000340000000100000002000000
000000bf000000bf0000c0410000c04103000000000000b3000000b3ffffbf41000000b3000000
b3ffffbf412100000008000000620000000c00000001000000150000000c000000040000001500
00000c000000040000005100000040030000000000000000000017000000170000000000000000
0000000000000000000000180000001800000050000000b0000000000100004002000000000000
2000cc001800000018000000280000001800000018000000010008000000000000000000000000
0000000000220000000000000000000000ffffff00f1f1f10004040400f0fbff00b2b2b2007777
7700eaeaea00d6e7e7009999cc000000800033669900a4a0a0008686860090a9ad00c0c0c00066
66990022222200cccccc0099cccc00d7d7d70016161600969696009999990029292900dddddd00
cbcbcb0033333300393939003333990042424200555555004d4d4d000000660002020202020202
020202020202020202020202020202020202030303030303030303030303030303030303030303
03020203010e050e050e050e050e050e050e050e050e0506030202030104070707070707070707
0707070707070705060302020301070708130a1008070807080708070807080506030202030104
0707090a100707070707070707070707050603020203010707080f0a1008070807080708070807
0805060302020301040707090a21031c05070707070707070705060302020301070708130a1d1f
1c1e200f07080708070805060302020301040707090a1d050f1a1e031607070707070506030202
03010707080f0a100f0f0f0d0d1c170708070805060302020301040707090a0b19050d0c1a0c1b
0e07070705060302020301070708130a10080f0f01010105180507080506030202030104070709
0a1007070f0f01010105180f07050603020203010707080f0a1008070805120101010c110f0506
0302020301040707090a0b070707070512011417110316060302020301070708130a1008070807
080514050d0d1516060302020301040707090a10070707070707050d0d0d0f0506030202030107
07080f0a10080708070807080c11121205060302020301040707090a0b07070707070707070c0d
0d0e06030202030107070807080708070807080708070807080506030202030104040404040404
040404040404040404040506030202030303030303030303030303030303030303030303030202
02020202020202020202020202020202020202020202024c000000640000000000000000000000
1700000017000000000000000000000018000000180000002900aa000000000000000000000080
3f00000000000000000000803f0000000000000000000000000000000000000000000000000000
000000000000220000000c000000ffffffff460000001c00000010000000454d462b024000000c
000000000000000e00000014000000000000001000000014000000040000000301080005000000
0b0200000000050000000c0218001800030000001e000400000007010400040000000701040085
010000410b2000cc00180018000000000018001800000000002800000018000000180000000100
080000000000000000000000000000000000220000000000000000000000ffffff00f1f1f10004
040400f0fbff00b2b2b20077777700eaeaea00d6e7e7009999cc000000800033669900a4a0a000
8686860090a9ad00c0c0c0006666990022222200cccccc0099cccc00d7d7d70016161600969696
009999990029292900dddddd00cbcbcb0033333300393939003333990042424200555555004d4d
4d0000006600020202020202020202020202020202020202020202020202020303030303030303
0303030303030303030303030303020203010e050e050e050e050e050e050e050e050e05060302
020301040707070707070707070707070707070705060302020301070708130a10080708070807
080708070805060302020301040707090a10070707070707070707070705060302020301070708
0f0a10080708070807080708070805060302020301040707090a21031c05070707070707070705
060302020301070708130a1d1f1c1e200f07080708070805060302020301040707090a1d050f1a
1e03160707070707050603020203010707080f0a100f0f0f0d0d1c170708070805060302020301
040707090a0b19050d0c1a0c1b0e07070705060302020301070708130a10080f0f010101051805
070805060302020301040707090a1007070f0f01010105180f07050603020203010707080f0a10
08070805120101010c110f05060302020301040707090a0b070707070512011417110316060302
020301070708130a1008070807080514050d0d1516060302020301040707090a10070707070707
050d0d0d0f050603020203010707080f0a10080708070807080c11121205060302020301040707
090a0b07070707070707070c0d0d0e060302020301070708070807080708070807080708070805
060302020301040404040404040404040404040404040405060302020303030303030303030303
0303030303030303030303020202020202020202020202020202020202020202020202020c0000
0040092900aa000000000000001800180000000000040000002701ffff030000000000
}\kerning2\f0\fs20 button and click mouse in picture box to create a crease on slab.\par
5.\tab Click \ldblquote select\rdblquote \kerning0\f2\fs17{\pict\wmetafile8\picw529\pich503\picwgoal300\pichgoal285
0100090000035c04000000002603000000002603000026060f004206574d464301000000000001
0007e40000000001000000200600000000000020060000010000006c0000000000000000000000
130000001200000000000000000000000e020000f401000020454d4600000100200600000c0000
00010000000000000000000000000000000005000000040000510100000e010000000000000000
00000000000068240500b01e0400460000002c00000020000000454d462b014001001c00000010
0000000210c0db010000006000000060000000460000008402000078020000454d462b22400400
0c000000000000001e4009000c00000000000000244001000c0000000000000030400200100000
00040000000000803f214007000c0000000000000008400005d0010000c40100000210c0db0100
0000000000000000000000000000000000000100000089504e470d0a1a0a0000000d4948445200
0000140000001308020000001feebae2000000017352474200aece1ce900000009704859730000
0ec500000ec101230029fb0000014a49444154384f9d54b14e8440145c4e50cf42206a21a51fc7
2f905c4189858d15b5e599e015172a3a5a0b3fc182e6122e04f70a058959873c8264dd35de6d36
2fc3f266e7cd5b584308c10e1d46d3346ddb9e9f896dfd79e51eefde8dffe03ccfd3349d415599
6d58f61fbb741fafaeebf6e4df9a60621d51578b35bfa9eb7a7672d44819c4a4a1d31f94dbaf53
c9a7e878596ec1e47c07acecc5a0acf30ce6219e8ba2b8bd8b97b68d08acecbfd6739665178bc5
86314460a5bed63331af1923fe7e9eab28222622b0e779a85fd2d79e731886c447ec7155398e63
cd2f932419fd936726ba374cce39625996a6694651441811182b534c6f9f1eef832060f8b6954c
c604ad137fcc89e3188febf5daf7fd9eacd40459a94fbbfc284bd582369d4afd41993c4f7d227b
248fd54afe159ea79d1b3d53b7247d52ee2f03fc587bdd0438f3d5eae1f965f30db7885afb8514
02da0000000049454e44ae4260820000000840010824000000180000000210c0db010000000300
00000000000000000000000000001b40000040000000340000000100000002000000000000bf00
0000bf0000a0410000984103000000000000b3000000b3ffff9f41000000b3000000b3ffff9741
2100000008000000620000000c00000001000000150000000c00000004000000150000000c0000
000400000051000000380200000000000000000000130000001200000000000000000000000000
0000000000001400000013000000500000006c000000bc0000007c010000000000002000cc0014
000000130000002800000014000000130000000100080000000000000000000000000000000000
110000000000000000000000ffffff00f8f8f800f1f1f100f0fbff00eaeaea00b2b2b200666666
00ff00000090a9ad0077777700cccccc0086868600000099000000800004040400969696000204
05040304050403040504030405040304090a0203040504030405080304050403040c0f03060704
040c04050403080808030405040c0f0504090a02050f0c0405080808080803040c0f0304050607
0204050f0c040504080405040c0f05040304090a020304050f0c04050803040c0f030405100f06
0704040304050f0c0405040c0f05040c0f0c04090a0205040304050f0c0d0c0f03100f10030405
06070204050403040c0d0e0d0c0f0c0405040304090a0203040504030d0e0d0e0d050403040504
0306070404030405040c0d0e0d0c04050403040504090a0205040304050b0c0d0c0b0304050403
04050607020405040304050403040504030405040304090a020304050403040508030405040304
0504030607040403040504080808080804050403040504090a0205040304050408080804030405
040304050607020405040304050408040504030405040304090a02030405040304050403040504
0304050403060701010101010101010101010101010101010101014c0000006400000000000000
000000001300000012000000000000000000000014000000130000002900aa0000000000000000
000000803f00000000000000000000803f00000000000000000000000000000000000000000000
00000000000000000000220000000c000000ffffffff460000001c00000010000000454d462b02
4000000c000000000000000e000000140000000000000010000000140000000400000003010800
050000000b0200000000050000000c0213001400030000001e0004000000070104000400000007
01040001010000410b2000cc001300140000000000130014000000000028000000140000001300
00000100080000000000000000000000000000000000110000000000000000000000ffffff00f8
f8f800f1f1f100f0fbff00eaeaea00b2b2b20066666600ff00000090a9ad0077777700cccccc00
868686000000990000008000040404009696960002040504030405040304050403040504030409
0a0203040504030405080304050403040c0f03060704040c04050403080808030405040c0f0504
090a02050f0c0405080808080803040c0f03040506070204050f0c040504080405040c0f050403
04090a020304050f0c04050803040c0f030405100f060704040304050f0c0405040c0f05040c0f
0c04090a0205040304050f0c0d0c0f03100f1003040506070204050403040c0d0e0d0c0f0c0405
040304090a0203040504030d0e0d0e0d0504030405040306070404030405040c0d0e0d0c040504
03040504090a0205040304050b0c0d0c0b03040504030405060702040504030405040304050403
0405040304090a0203040504030405080304050403040504030607040403040504080808080804
050403040504090a02050403040504080808040304050403040506070204050403040504080405
04030405040304090a020304050403040504030405040304050403060701010101010101010101
010101010101010101010c00000040092900aa0000000000000013001400000000000400000027
01ffff030000000000
}\kerning2\f0\fs20 button, then move mouse and click in picture box to select new created vertex or crease, when new vertex or crease turn red, it means you have selected it successfully.\par
6.\tab Then input the distance user want to move in the textbox (just input number, unit is feet), click \ldblquote Update\rdblquote button.\par
7.\tab Click \ldblquote Reset\rdblquote button to restore the original shape of slab.\par
8.\tab If user wants to observe slab in different direction, just click right mouse button down and move mouse in picture box.\par
}
@@ -0,0 +1,428 @@
//
// (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.Collections.Generic;
using System.Text;
using System.Collections;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using System.Drawing;
using Autodesk.Revit;
using System.Windows.Forms;
namespace Revit.SDK.Samples.SlabShapeEditing.CS
{
/// <summary>
/// SlabProfile class contains Geometry information of Slab,
/// and contains methods used to edit slab's Shape.
/// </summary>
class SlabProfile
{
#region class member variables
ExternalCommandData m_commandData; //contains reference of Revit Application
Autodesk.Revit.DB.Floor m_floor; //object of truss in Revit
EdgeArray m_edges; // store all the edges of floor
PointF[] m_boundPoints; // store array store bound point of Slab
Matrix4 m_to2DMatrix = null; // store the Matrix used to transform 3D points to 2D
Matrix4 m_moveToCenterMatrix = null; // store the Matrix used to move points to center
Matrix4 m_scaleMatrix = null; // store the Matrix used to scale profile fit to pictureBox
Matrix4 m_MoveToPictureBoxCenter = null; // store the Matrix used to move profile to center of pictureBox
Matrix4 m_transformMatrix = null; // store the Matrix used to transform Revit coordinate to window UI
Matrix4 m_restoreMatrix = null; // store the Matrix used to transform window UI coordinate to Revit
Matrix4 m_rotateMatrix = null; //store the matrix which rotate object
const int m_sizeXPictureBox = 354; //save picture box's size.X
const int m_sizeYPictureBox = 280; //save picture box's size.Y
SlabShapeEditor m_slabShapeEditor; //SlabShapeEditor which use to editor shape of slab
double m_rotateAngleX = 0; //rotate angle in X direction
double m_rotateAngleY = 0; //rotate angle in Y direction
#endregion
/// <summary>
/// constructor
/// </summary>
/// <param name="floor">Floor object in Revit</param>
/// <param name="commandData">contains reference of Revit Application</param>
public SlabProfile(Autodesk.Revit.DB.Floor floor, ExternalCommandData commandData)
{
m_floor = floor;
m_commandData = commandData;
m_slabShapeEditor = floor.SlabShapeEditor;
GetSlabProfileInfo();
}
/// <summary>
/// Calculate geometry info for Slab
/// </summary>
public void GetSlabProfileInfo()
{
// get all the edges of the Slab
m_edges = GetFloorEdges();
// Get a matrix which can transform points to 2D
m_to2DMatrix = GetTo2DMatrix();
// get the boundary of all the points
m_boundPoints = GetBoundsPoints();
// get a matrix which can keep all the points in the center of the canvas
m_moveToCenterMatrix = GetMoveToCenterMatrix();
// get a matrix for scaling all the points and lines within the canvas
m_scaleMatrix = GetScaleMatrix();
// get a matrix for moving all point in the middle of PictureBox
m_MoveToPictureBoxCenter = GetMoveToCenterOfPictureBox();
// transform 3D points to 2D
m_transformMatrix = Get3DTo2DMatrix();
// transform from 2D to 3D
m_restoreMatrix = Get2DTo3DMatrix();
}
/// <summary>
/// Get all points of the Slab
/// </summary>
/// <returns>points array stores all the points on slab</returns>
public EdgeArray GetFloorEdges()
{
EdgeArray edges = new EdgeArray();
Options options = m_commandData.Application.Application.Create.NewGeometryOptions();
options.DetailLevel = ViewDetailLevel.Medium;
//make sure references to geometric objects are computed.
options.ComputeReferences = true;
Autodesk.Revit.DB.GeometryElement geoElem = m_floor.get_Geometry(options);
//GeometryObjectArray gObjects = geoElem.Objects;
IEnumerator<GeometryObject> Objects = geoElem.GetEnumerator();
//get all the edges in the Geometry object
//foreach (GeometryObject geo in gObjects)
while (Objects.MoveNext())
{
GeometryObject geo = Objects.Current;
Solid solid = geo as Solid;
if (solid != null)
{
FaceArray faces = solid.Faces;
foreach (Face face in faces)
{
EdgeArrayArray edgeArrarr = face.EdgeLoops;
foreach (EdgeArray edgeArr in edgeArrarr)
{
foreach (Edge edge in edgeArr)
{
edges.Append(edge);
}
}
}
}
}
return edges;
}
/// <summary>
/// Get a matrix which can transform points to 2D
/// </summary>
/// <returns>matrix which can transform points to 2D</returns>
public Matrix4 GetTo2DMatrix()
{
Vector4 xAxis = new Vector4(1, 0, 0);
//Because Y axis in windows UI is downward, so we should Multiply(-1) here
Vector4 yAxis = new Vector4(0, -1, 0);
Vector4 zAxis = new Vector4(0, 0, 1);
Matrix4 result = new Matrix4(xAxis, yAxis, zAxis);
return result;
}
/// <summary>
/// calculate the matrix use to scale
/// </summary>
/// <returns>maxtrix is use to scale the profile</returns>
public Matrix4 GetScaleMatrix()
{
float xScale = 384 / (m_boundPoints[1].X - m_boundPoints[0].X);
float yScale = 275 / (m_boundPoints[1].Y - m_boundPoints[0].Y);
float factor = xScale <= yScale ? xScale : yScale;
return new Matrix4((float)(factor * 0.85));
}
/// <summary>
/// Get a matrix which can move points to center of itself
/// </summary>
/// <returns>matrix used to move point to center of itself</returns>
public Matrix4 GetMoveToCenterMatrix()
{
//translate the origin to bound center
PointF[] bounds = GetBoundsPoints();
PointF min = bounds[0];
PointF max = bounds[1];
PointF center = new PointF((min.X + max.X) / 2, (min.Y + max.Y) / 2);
return new Matrix4(new Vector4(center.X, center.Y, 0));
}
/// <summary>
/// Get a matrix which can move points to center of picture box
/// </summary>
/// <returns>matrix used to move point to center of picture box</returns>
private Matrix4 GetMoveToCenterOfPictureBox()
{
return new Matrix4(new Vector4(m_sizeXPictureBox / 2, m_sizeYPictureBox / 2, 0));
}
/// <summary>
/// calculate the matrix used to transform 3D to 2D
/// </summary>
/// <returns>maxtrix is use to transform 3d points to 2d</returns>
public Matrix4 Get3DTo2DMatrix()
{
Matrix4 result = Matrix4.Multiply(
m_to2DMatrix.Inverse(), m_moveToCenterMatrix.Inverse());
result = Matrix4.Multiply(result, m_scaleMatrix);
return Matrix4.Multiply(result, m_MoveToPictureBoxCenter);
}
/// <summary>
/// calculate the matrix used to transform 2D to 3D
/// </summary>
/// <returns>maxtrix is use to transform 2d points to 3d</returns>
public Matrix4 Get2DTo3DMatrix()
{
Matrix4 matrix = Matrix4.Multiply(
m_MoveToPictureBoxCenter.Inverse(), m_scaleMatrix.Inverse());
matrix = Matrix4.Multiply(
matrix, m_moveToCenterMatrix);
return Matrix4.Multiply(matrix, m_to2DMatrix);
}
/// <summary>
/// Get max and min coordinates of all points
/// </summary>
/// <returns>points array stores the bound of all points</returns>
public PointF[] GetBoundsPoints()
{
Matrix4 matrix = m_to2DMatrix;
Matrix4 inverseMatrix = matrix.Inverse();
double minX = 0, maxX = 0, minY = 0, maxY = 0;
bool bFirstPoint = true;
//get all points on slab
List<XYZ> points = new List<XYZ>();
foreach (Edge edge in m_edges)
{
List<XYZ> edgexyzs = edge.Tessellate() as List<XYZ>;
foreach (Autodesk.Revit.DB.XYZ xyz in edgexyzs)
{ points.Add(xyz); }
}
//get the max and min point on the face
foreach (Autodesk.Revit.DB.XYZ point in points)
{
Vector4 v = new Vector4(point);
Vector4 v1 = inverseMatrix.Transform(v);
if (bFirstPoint)
{
minX = maxX = v1.X;
minY = maxY = v1.Y;
bFirstPoint = false;
}
else
{
if (v1.X < minX) { minX = v1.X; }
else if (v1.X > maxX) { maxX = v1.X; }
if (v1.Y < minY) { minY = v1.Y; }
else if (v1.Y > maxY) { maxY = v1.Y; }
}
}
//return an array with max and min value of all points
PointF[] resultPoints = new PointF[2] {
new PointF((float)minX, (float)minY), new PointF((float)maxX, (float)maxY) };
return resultPoints;
}
/// <summary>
/// draw profile of Slab in pictureBox
/// </summary>
/// <param name="graphics">form graphic</param>
/// <param name="pen">pen used to draw line in pictureBox</param>
public void Draw2D(Graphics graphics, Pen pen)
{
foreach (Edge edge in m_edges)
{
List<XYZ> edgexyzs = edge.Tessellate() as List<XYZ>;
DrawCurve(graphics, pen, edgexyzs);
}
}
/// <summary>
/// draw specific points in pictureBox
/// </summary>
/// <param name="graphics">form graphic</param>
/// <param name="pen">pen used to draw line in pictureBox</param>
/// <param name="points">points which need to be drawn</param>
public void DrawCurve(Graphics graphics, Pen pen, List<XYZ> points)
{
//draw slab curves
for (int i = 0; i < points.Count - 1; i += 1)
{
Autodesk.Revit.DB.XYZ point1 = points[i];
Autodesk.Revit.DB.XYZ point2 = points[i + 1];
Vector4 v1 = new Vector4(point1);
Vector4 v2 = new Vector4(point2);
v1 = m_transformMatrix.Transform(v1);
v2 = m_transformMatrix.Transform(v2);
if (m_rotateMatrix != null)
{
v1 = m_rotateMatrix.Transform(v1);
v2 = m_rotateMatrix.Transform(v2);
}
graphics.DrawLine(pen, new PointF((int)v1.X, (int)v1.Y),
new PointF((int)v2.X, (int)v2.Y));
}
}
/// <summary>
/// rotate slab with specific angle
/// </summary>
/// <param name="xAngle">rotate angle in X direction</param>
/// <param name="yAngle">rotate angle in Y direction</param>
public void RotateFloor(double xAngle, double yAngle)
{
if (0 == xAngle && 0 == yAngle) { return; }
m_rotateAngleX += xAngle;
m_rotateAngleY += yAngle;
Matrix4 rotateX = Matrix4.RotateX(m_rotateAngleX);
Matrix4 rotateY = Matrix4.RotateY(m_rotateAngleY);
Matrix4 rotateMatrix = Matrix4.Multiply(rotateX, rotateY);
m_rotateMatrix = Matrix4.Multiply(m_MoveToPictureBoxCenter.Inverse(), rotateMatrix);
m_rotateMatrix = Matrix4.Multiply(m_rotateMatrix, m_MoveToPictureBoxCenter);
}
/// <summary>
/// make rotate matrix null
/// </summary>
public void ClearRotateMatrix()
{
m_rotateMatrix = null;
}
/// <summary>
/// Reset index and clear line tool
/// </summary>
public void ResetSlabShape()
{
Transaction transaction = new Transaction(
m_commandData.Application.ActiveUIDocument.Document, "ResetSlabShape");
transaction.Start();
m_slabShapeEditor.ResetSlabShape();
transaction.Commit();
//re-calculate geometry info
GetSlabProfileInfo();
}
/// <summary>
/// Add vertex on specific location
/// </summary>
/// <param name="point">location where vertex add on</param>
/// <returns>new created vertex</returns>
public SlabShapeVertex AddVertex(PointF point)
{
Transaction transaction = new Transaction(
m_commandData.Application.ActiveUIDocument.Document, "AddVertex");
transaction.Start();
Vector4 v1 = new Vector4(new Autodesk.Revit.DB.XYZ(point.X, point.Y, 0));
v1 = m_restoreMatrix.Transform(v1);
SlabShapeVertex vertex = m_slabShapeEditor.DrawPoint(new Autodesk.Revit.DB.XYZ(v1.X, v1.Y, v1.Z));
transaction.Commit();
//re-calculate geometry info
GetSlabProfileInfo();
return vertex;
}
/// <summary>
/// Add Crease on specific location
/// </summary>
/// <param name="point1">first point of location where Crease add on</param>
/// <param name="point2">second point of location where Crease add on</param>
/// <returns>new created Crease</returns>
public SlabShapeCrease AddCrease(PointF point1, PointF point2)
{
//create first vertex
Transaction transaction = new Transaction(
m_commandData.Application.ActiveUIDocument.Document, "AddCrease");
transaction.Start();
Vector4 v1 = new Vector4(new Autodesk.Revit.DB.XYZ(point1.X, point1.Y, 0));
v1 = m_restoreMatrix.Transform(v1);
SlabShapeVertex vertex1 = m_slabShapeEditor.DrawPoint(new Autodesk.Revit.DB.XYZ(v1.X, v1.Y, v1.Z));
//create second vertex
Vector4 v2 = new Vector4(new Autodesk.Revit.DB.XYZ(point2.X, point2.Y, 0));
v2 = m_restoreMatrix.Transform(v2);
SlabShapeVertex vertex2 = m_slabShapeEditor.DrawPoint(new Autodesk.Revit.DB.XYZ(v2.X, v2.Y, v2.Z));
//create crease
SlabShapeCreaseArray creases = m_slabShapeEditor.DrawSplitLine(vertex1, vertex2);
SlabShapeCrease crease = creases.get_Item(0);
transaction.Commit();
//re-calculate geometry info
GetSlabProfileInfo();
return crease;
}
/// <summary>
/// judge whether point can use to create vertex on slab
/// </summary>
/// <param name="point1">location where vertex add on</param>
/// <returns>whether point can use to create vertex on slab</returns>
public bool CanCreateVertex(PointF pointF)
{
bool createSuccess = false;
Transaction transaction = new Transaction(
m_commandData.Application.ActiveUIDocument.Document, "CanCreateVertex");
transaction.Start();
Vector4 v1 = new Vector4(new Autodesk.Revit.DB.XYZ(pointF.X, pointF.Y, 0));
v1 = m_restoreMatrix.Transform(v1);
SlabShapeVertex vertex = m_slabShapeEditor.DrawPoint(new Autodesk.Revit.DB.XYZ(v1.X, v1.Y, v1.Z));
if (null != vertex) { createSuccess = true; }
transaction.RollBack();
//re-calculate geometry info
GetSlabProfileInfo();
return createSuccess;
}
}
}
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<RevitAddIns>
<AddIn Type="Command">
<Assembly>SlabShapeEditing.dll</Assembly>
<ClientId>04707e34-39a3-4b3b-89c6-ed8fcf64ebf7</ClientId>
<FullClassName>Revit.SDK.Samples.SlabShapeEditing.CS.Command</FullClassName>
<Text>SlabShapeEditing</Text>
<Description>Create vertex and crease on slab to edit it's shape.</Description>
<VisibilityMode>AlwaysVisible</VisibilityMode>
<VendorId>ADSK</VendorId>
<VendorDescription>Autodesk, www.autodesk.com</VendorDescription>
</AddIn>
</RevitAddIns>
@@ -0,0 +1,110 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{1DC983AE-320A-4CEB-8C7F-4223367099D0}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SlabShapeEditing</RootNamespace>
<AssemblyName>SlabShapeEditing</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<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>
<Optimize>true</Optimize>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup>
<RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Command.cs" />
<Compile Include="LineTool.cs" />
<Compile Include="MathTools.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="SlabProfile.cs" />
<Compile Include="SlabShapeEditingForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="SlabShapeEditingForm.Designer.cs">
<DependentUpon>SlabShapeEditingForm.cs</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Properties\Resources.resx">
<SubType>Designer</SubType>
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="SlabShapeEditingForm.resx">
<SubType>Designer</SubType>
<DependentUpon>SlabShapeEditingForm.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(SolutionDir)VSProps\SDKSamples.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<PropertyGroup>
<PostBuildEvent>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,216 @@
//
// (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.
//
namespace Revit.SDK.Samples.SlabShapeEditing.CS
{
partial class SlabShapeEditingForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
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.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SlabShapeEditingForm));
this.SlabShapePictureBox = new System.Windows.Forms.PictureBox();
this.PointButton = new System.Windows.Forms.Button();
this.LineButton = new System.Windows.Forms.Button();
this.DistanceLabel = new System.Windows.Forms.Label();
this.DistanceTextBox = new System.Windows.Forms.TextBox();
this.MoveButton = new System.Windows.Forms.Button();
this.ResetButton = new System.Windows.Forms.Button();
this.OKButton = new System.Windows.Forms.Button();
this.UpdateButton = new System.Windows.Forms.Button();
this.NoteLabel = new System.Windows.Forms.Label();
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
((System.ComponentModel.ISupportInitialize)(this.SlabShapePictureBox)).BeginInit();
this.SuspendLayout();
//
// SlabShapePictureBox
//
this.SlabShapePictureBox.BackColor = System.Drawing.Color.White;
this.SlabShapePictureBox.Location = new System.Drawing.Point(12, 13);
this.SlabShapePictureBox.Name = "SlabShapePictureBox";
this.SlabShapePictureBox.Size = new System.Drawing.Size(354, 301);
this.SlabShapePictureBox.TabIndex = 0;
this.SlabShapePictureBox.TabStop = false;
this.SlabShapePictureBox.MouseDown += new System.Windows.Forms.MouseEventHandler(this.SlabShapePictureBox_MouseDown);
this.SlabShapePictureBox.MouseMove += new System.Windows.Forms.MouseEventHandler(this.SlabShapePictureBox_MouseMove);
this.SlabShapePictureBox.Paint += new System.Windows.Forms.PaintEventHandler(this.SlabShapePictureBox_Paint);
this.SlabShapePictureBox.MouseClick += new System.Windows.Forms.MouseEventHandler(this.SlabShapePictureBox_MouseClick);
this.SlabShapePictureBox.MouseHover += new System.EventHandler(this.SlabShapePictureBox_MouseHover);
//
// PointButton
//
this.PointButton.Image = ((System.Drawing.Image)(resources.GetObject("PointButton.Image")));
this.PointButton.Location = new System.Drawing.Point(46, 342);
this.PointButton.Name = "PointButton";
this.PointButton.Size = new System.Drawing.Size(28, 28);
this.PointButton.TabIndex = 1;
this.PointButton.UseVisualStyleBackColor = true;
this.PointButton.Click += new System.EventHandler(this.PointButton_Click);
this.PointButton.MouseHover += new System.EventHandler(this.PointButton_MouseHover);
//
// LineButton
//
this.LineButton.Image = ((System.Drawing.Image)(resources.GetObject("LineButton.Image")));
this.LineButton.Location = new System.Drawing.Point(80, 342);
this.LineButton.Name = "LineButton";
this.LineButton.Size = new System.Drawing.Size(28, 28);
this.LineButton.TabIndex = 2;
this.LineButton.UseVisualStyleBackColor = true;
this.LineButton.Click += new System.EventHandler(this.LineButton_Click);
this.LineButton.MouseHover += new System.EventHandler(this.LineButton_MouseHover);
//
// DistanceLabel
//
this.DistanceLabel.AutoSize = true;
this.DistanceLabel.Location = new System.Drawing.Point(113, 351);
this.DistanceLabel.Name = "DistanceLabel";
this.DistanceLabel.Size = new System.Drawing.Size(93, 14);
this.DistanceLabel.TabIndex = 4;
this.DistanceLabel.Text = "Distance (Feet):";
//
// DistanceTextBox
//
this.DistanceTextBox.Location = new System.Drawing.Point(210, 348);
this.DistanceTextBox.Name = "DistanceTextBox";
this.DistanceTextBox.Size = new System.Drawing.Size(75, 22);
this.DistanceTextBox.TabIndex = 5;
//
// MoveButton
//
this.MoveButton.Image = ((System.Drawing.Image)(resources.GetObject("MoveButton.Image")));
this.MoveButton.Location = new System.Drawing.Point(12, 342);
this.MoveButton.Name = "MoveButton";
this.MoveButton.Size = new System.Drawing.Size(28, 28);
this.MoveButton.TabIndex = 6;
this.MoveButton.UseVisualStyleBackColor = true;
this.MoveButton.Click += new System.EventHandler(this.MoveButton_Click);
this.MoveButton.MouseHover += new System.EventHandler(this.MoveButton_MouseHover);
//
// ResetButton
//
this.ResetButton.Location = new System.Drawing.Point(210, 387);
this.ResetButton.Name = "ResetButton";
this.ResetButton.Size = new System.Drawing.Size(75, 25);
this.ResetButton.TabIndex = 7;
this.ResetButton.Text = "&Reset";
this.ResetButton.UseVisualStyleBackColor = true;
this.ResetButton.Click += new System.EventHandler(this.ResetButton_Click);
//
// OKButton
//
this.OKButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.OKButton.Location = new System.Drawing.Point(291, 387);
this.OKButton.Name = "OKButton";
this.OKButton.Size = new System.Drawing.Size(75, 25);
this.OKButton.TabIndex = 9;
this.OKButton.Text = "&OK";
this.OKButton.UseVisualStyleBackColor = true;
//
// UpdateButton
//
this.UpdateButton.Location = new System.Drawing.Point(291, 348);
this.UpdateButton.Name = "UpdateButton";
this.UpdateButton.Size = new System.Drawing.Size(75, 25);
this.UpdateButton.TabIndex = 10;
this.UpdateButton.Text = "&Update";
this.UpdateButton.UseVisualStyleBackColor = true;
this.UpdateButton.Click += new System.EventHandler(this.UpdateButton_Click);
//
// NoteLabel
//
this.NoteLabel.AutoSize = true;
this.NoteLabel.Font = new System.Drawing.Font("Calibri", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.NoteLabel.Location = new System.Drawing.Point(12, 317);
this.NoteLabel.Name = "NoteLabel";
this.NoteLabel.Size = new System.Drawing.Size(316, 15);
this.NoteLabel.TabIndex = 11;
this.NoteLabel.Text = "Click right mouse button and move mouse to rotate Slab.";
//
// SlabShapeEditingForm
//
this.AcceptButton = this.OKButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 14F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.OKButton;
this.ClientSize = new System.Drawing.Size(377, 425);
this.Controls.Add(this.NoteLabel);
this.Controls.Add(this.UpdateButton);
this.Controls.Add(this.OKButton);
this.Controls.Add(this.ResetButton);
this.Controls.Add(this.MoveButton);
this.Controls.Add(this.DistanceTextBox);
this.Controls.Add(this.DistanceLabel);
this.Controls.Add(this.LineButton);
this.Controls.Add(this.PointButton);
this.Controls.Add(this.SlabShapePictureBox);
this.Font = new System.Drawing.Font("Calibri", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "SlabShapeEditingForm";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.Text = "Slab Shape Editing";
((System.ComponentModel.ISupportInitialize)(this.SlabShapePictureBox)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.PictureBox SlabShapePictureBox;
private System.Windows.Forms.Button PointButton;
private System.Windows.Forms.Button LineButton;
private System.Windows.Forms.Label DistanceLabel;
private System.Windows.Forms.TextBox DistanceTextBox;
private System.Windows.Forms.Button MoveButton;
private System.Windows.Forms.Button ResetButton;
private System.Windows.Forms.Button OKButton;
private System.Windows.Forms.Button UpdateButton;
private System.Windows.Forms.Label NoteLabel;
private System.Windows.Forms.ToolTip toolTip;
}
}
@@ -0,0 +1,382 @@
//
// (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.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Autodesk.Revit;
using System.Collections;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using System.Drawing.Drawing2D;
namespace Revit.SDK.Samples.SlabShapeEditing.CS
{
/// <summary>
/// window form contains one picture box to show the
/// profile of slab geometry. user can add vertex and crease.
/// User can edit slab shape via vertex and crease too.
/// </summary>
public partial class SlabShapeEditingForm : System.Windows.Forms.Form
{
enum EditorState { AddVertex, AddCrease, Select, Rotate, Null };
ExternalCommandData m_commandData; //object which contains reference of Revit Application
SlabProfile m_slabProfile; //store geometry info of selected slab
PointF m_mouseRightDownLocation; //where mouse right button down
LineTool m_lineTool; //tool use to draw crease
LineTool m_pointTool; //tool use to draw vertex
ArrayList m_graphicsPaths; //store all the GraphicsPath objects of crease and vertex.
int m_selectIndex; //index of crease and vertex which mouse hovering on.
int m_clickedIndex; //index of crease and vertex which mouse clicked.
ArrayList m_createdVertices; // new created vertices
ArrayList m_createCreases; // new created creases
SlabShapeEditor m_slabShapeEditor; //object use to edit slab shape
SlabShapeCrease m_selectedCrease; //selected crease, mouse clicked on
SlabShapeVertex m_selectedVertex; //selected vertex, mouse clicked on
EditorState editorState; //state of user's operation
Pen m_toolPen; //pen use to draw new created vertex and crease
Pen m_selectPen; // pen use to draw vertex and crease which been selected
Pen m_profilePen; // pen use to draw slab's profile
const string justNumber = "Please input numbers in textbox!"; //error message
const string selectFirst = "Please select a Vertex (or Crease) first!"; //error message
/// <summary>
/// constructor
/// </summary>
/// <param name="commandData">selected floor (or slab)</param>
/// <param name="commandData">contains reference of Revit Application</param>
public SlabShapeEditingForm(Floor floor, ExternalCommandData commandData)
{
InitializeComponent();
m_commandData = commandData;
m_slabProfile = new SlabProfile(floor, commandData);
m_slabShapeEditor = floor.SlabShapeEditor;
m_lineTool = new LineTool();
m_pointTool = new LineTool();
editorState = EditorState.AddVertex;
m_graphicsPaths = new ArrayList();
m_createdVertices = new ArrayList();
m_createCreases = new ArrayList();
m_selectIndex = -1;
m_clickedIndex = -1;
m_toolPen = new Pen(System.Drawing.Color.Blue, 2);
m_selectPen = new Pen(System.Drawing.Color.Red, 2);
m_profilePen = new Pen(System.Drawing.Color.Black, (float)(0.5));
}
/// <summary>
/// represents the geometry info for slab
/// </summary>
/// <param name="sender">object who sent this event</param>
/// <param name="e">event args</param>
private void SlabShapePictureBox_Paint(object sender, PaintEventArgs e)
{
e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
m_slabProfile.Draw2D(e.Graphics, m_profilePen);
if (EditorState.Rotate != editorState)
{
m_lineTool.Draw2D(e.Graphics, m_toolPen);
m_pointTool.DrawRectangle(e.Graphics, m_toolPen);
//draw selected beam (line) by red pen
DrawSelectedLineRed(e.Graphics, m_selectPen);
}
}
/// <summary>
/// Draw selected crease or vertex red
/// </summary>
/// <param name="graphics">Form graphics object,</param>
/// <param name="pen">Pen which used to draw lines</param>
private void DrawSelectedLineRed(Graphics graphics, Pen pen)
{
if (-1 != m_selectIndex)
{
GraphicsPath selectedPath = (GraphicsPath)m_graphicsPaths[m_selectIndex];
PointF pointF0 = (PointF)selectedPath.PathPoints.GetValue(0);
PointF pointF1 = (PointF)selectedPath.PathPoints.GetValue(1);
if (m_selectIndex < m_createCreases.Count)
{ graphics.DrawLine(pen, pointF0, pointF1); }
else { graphics.DrawRectangle(pen, pointF0.X - 2, pointF0.Y - 2, 4, 4); }
}
if (-1 != m_clickedIndex)
{
GraphicsPath clickedPath = (GraphicsPath)m_graphicsPaths[m_clickedIndex];
PointF pointF0 = (PointF)clickedPath.PathPoints.GetValue(0);
PointF pointF1 = (PointF)clickedPath.PathPoints.GetValue(1);
if (m_clickedIndex < m_createCreases.Count)
{ graphics.DrawLine(pen, pointF0, pointF1); }
else { graphics.DrawRectangle(pen, pointF0.X - 2, pointF0.Y - 2, 4, 4); }
}
}
/// <summary>
/// rotate slab and get selected vertex or crease
/// </summary>
/// <param name="sender">object who sent this event</param>
/// <param name="e">event args</param>
private void SlabShapePictureBox_MouseMove(object sender, MouseEventArgs e)
{
PointF pointF = new PointF(e.X, e.Y);
if (EditorState.AddCrease == editorState && 1 == m_lineTool.Points.Count % 2)
{ m_lineTool.MovePoint = pointF; }
else { m_lineTool.MovePoint = PointF.Empty; }
if (MouseButtons.Right == e.Button)
{
double moveX = e.Location.X - m_mouseRightDownLocation.X;
double moveY = m_mouseRightDownLocation.Y - e.Location.Y;
m_slabProfile.RotateFloor(moveY / 500, moveX / 500);
m_mouseRightDownLocation = e.Location;
}
else if (EditorState.Select == editorState)
{
for (int i = 0; i < m_graphicsPaths.Count; i++)
{
GraphicsPath path = (GraphicsPath)m_graphicsPaths[i];
if (path.IsOutlineVisible(pointF, m_toolPen))
{ m_selectIndex = i; break; }
m_selectIndex = -1;
}
}
this.SlabShapePictureBox.Refresh();
}
/// <summary>
/// get location where right button click down.
/// </summary>
/// <param name="sender">object who sent this event</param>
/// <param name="e">event args</param>
private void SlabShapePictureBox_MouseDown(object sender, MouseEventArgs e)
{
if (MouseButtons.Right == e.Button)
{
m_mouseRightDownLocation = e.Location;
editorState = EditorState.Rotate;
m_clickedIndex = m_selectIndex = -1;
}
}
/// <summary>
/// add vertex and crease, select new created vertex and crease
/// </summary>
/// <param name="sender">object who sent this event</param>
/// <param name="e">event args</param>
private void SlabShapePictureBox_MouseClick(object sender, MouseEventArgs e)
{
if (EditorState.AddCrease == editorState)
{
if (!m_slabProfile.CanCreateVertex(new PointF(e.X, e.Y))) { return; }
m_lineTool.Points.Add(new PointF(e.X, e.Y));
int lineSize = m_lineTool.Points.Count;
if (0 == m_lineTool.Points.Count % 2)
{
m_createCreases.Add(
m_slabProfile.AddCrease((PointF)m_lineTool.Points[lineSize - 2],
(PointF)m_lineTool.Points[lineSize - 1]));
}
CreateGraphicsPath(); //create graphic path for all the vertex and crease
}
else if (EditorState.AddVertex == editorState)
{
SlabShapeVertex vertex = m_slabProfile.AddVertex(new PointF(e.X, e.Y));
if (null == vertex) { return; }
m_pointTool.Points.Add(new PointF(e.X, e.Y));
//draw point as a short line, so add two points here
m_pointTool.Points.Add(new PointF((float)(e.X + 2), (float)(e.Y + 2)));
m_createdVertices.Add(vertex);
CreateGraphicsPath(); //create graphic path for all the vertex and crease
}
else if (EditorState.Select == editorState)
{
if (m_selectIndex >= 0)
{
m_clickedIndex = m_selectIndex;
if (m_selectIndex <= m_createCreases.Count - 1)
{
m_selectedCrease = (SlabShapeCrease)(m_createCreases[m_selectIndex]);
m_selectedVertex = null;
}
else
{
//put all path (crease and vertex) in one arrayList, so reduce creases.count
int index = m_selectIndex - m_createCreases.Count;
m_selectedVertex = (SlabShapeVertex)(m_createdVertices[index]);
m_selectedCrease = null;
}
}
else { m_selectedVertex = null; m_selectedCrease = null; m_clickedIndex = -1; }
}
this.SlabShapePictureBox.Refresh();
}
/// <summary>
/// get ready to add vertex
/// </summary>
/// <param name="sender">object who sent this event</param>
/// <param name="e">event args</param>
private void PointButton_Click(object sender, EventArgs e)
{
editorState = EditorState.AddVertex;
m_slabProfile.ClearRotateMatrix();
this.SlabShapePictureBox.Cursor = Cursors.Cross;
}
/// <summary>
/// get ready to add crease
/// </summary>
/// <param name="sender">object who sent this event</param>
/// <param name="e">event args</param>
private void LineButton_Click(object sender, EventArgs e)
{
editorState = EditorState.AddCrease;
m_slabProfile.ClearRotateMatrix();
this.SlabShapePictureBox.Cursor = Cursors.Cross;
}
/// <summary>
/// get ready to move vertex and crease
/// </summary>
/// <param name="sender">object who sent this event</param>
/// <param name="e">event args</param>
private void MoveButton_Click(object sender, EventArgs e)
{
editorState = EditorState.Select;
m_slabProfile.ClearRotateMatrix();
this.SlabShapePictureBox.Cursor = Cursors.Arrow;
}
/// <summary>
/// Move vertex and crease, then update profile of slab
/// </summary>
/// <param name="sender">object who sent this event</param>
/// <param name="e">event args</param>
private void UpdateButton_Click(object sender, EventArgs e)
{
if (-1 == m_clickedIndex) { TaskDialog.Show("Revit", selectFirst); return; }
double moveDistance = 0;
try { moveDistance = Convert.ToDouble(this.DistanceTextBox.Text); }
catch (Exception) { TaskDialog.Show("Revit", justNumber); return; }
Transaction transaction = new Transaction(
m_commandData.Application.ActiveUIDocument.Document, "Update");
transaction.Start();
if (null != m_selectedCrease)
{ m_slabShapeEditor.ModifySubElement(m_selectedCrease, moveDistance); }
else if (null != m_selectedVertex)
{ m_slabShapeEditor.ModifySubElement(m_selectedVertex, moveDistance); }
transaction.Commit();
//re-calculate geometry info
m_slabProfile.GetSlabProfileInfo();
this.SlabShapePictureBox.Refresh();
}
/// <summary>
/// Reset slab shape
/// </summary>
/// <param name="sender">object who sent this event</param>
/// <param name="e">event args</param>
private void ResetButton_Click(object sender, EventArgs e)
{
m_slabProfile.ResetSlabShape();
m_lineTool.Points.Clear();
m_pointTool.Points.Clear();
}
/// <summary>
/// Create Graphics Path for each vertex and crease
/// </summary>
public void CreateGraphicsPath()
{
m_graphicsPaths.Clear();
//create path for all the lines draw by user
for (int i = 0; i < m_lineTool.Points.Count - 1; i += 2)
{
GraphicsPath path = new GraphicsPath();
path.AddLine((PointF)m_lineTool.Points[i], (PointF)m_lineTool.Points[i + 1]);
m_graphicsPaths.Add(path);
}
for (int i = 0; i < m_pointTool.Points.Count - 1; i += 2)
{
GraphicsPath path = new GraphicsPath();
path.AddLine((PointF)m_pointTool.Points[i], (PointF)m_pointTool.Points[i + 1]);
m_graphicsPaths.Add(path);
}
}
/// <summary>
/// set tool tip for MoveButton
/// </summary>
/// <param name="sender">object who sent this event</param>
/// <param name="e">event args</param>
private void MoveButton_MouseHover(object sender, EventArgs e)
{
this.toolTip.SetToolTip(this.MoveButton, "Select Vertex or Crease");
}
/// <summary>
/// set tool tip for PointButton
/// </summary>
/// <param name="sender">object who sent this event</param>
/// <param name="e">event args</param>
private void PointButton_MouseHover(object sender, EventArgs e)
{
this.toolTip.SetToolTip(this.PointButton, "Add Vertex");
}
/// <summary>
/// set tool tip for LineButton
/// </summary>
/// <param name="sender">object who sent this event</param>
/// <param name="e">event args</param>
private void LineButton_MouseHover(object sender, EventArgs e)
{
this.toolTip.SetToolTip(this.LineButton, "Add Crease");
}
/// <summary>
/// change cursor
/// </summary>
/// <param name="sender">object who sent this event</param>
/// <param name="e">event args</param>
private void SlabShapePictureBox_MouseHover(object sender, EventArgs e)
{
switch (editorState)
{
case EditorState.AddVertex:
this.SlabShapePictureBox.Cursor = Cursors.Cross; break;
case EditorState.AddCrease:
this.SlabShapePictureBox.Cursor = Cursors.Cross; break;
case EditorState.Select:
this.SlabShapePictureBox.Cursor = Cursors.Arrow; break;
default:
this.SlabShapePictureBox.Cursor = Cursors.Default; break;
}
}
}
}
@@ -0,0 +1,154 @@
<?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>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="PointButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAIAAABL1vtsAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAAOxAAA
DsQBlSsOGwAAAMhJREFUOE+llDsOwjAQRPeu1FTcAOUYnCASp0DKMWgpKFKmDGNPtJhk8WcdrRI38zw7
a0fWjudyPs3vp4CwzC9H3cfbDwKw1vIjhuvAciKgFAm9T4/Jg9D9sfAgIMPmSoGXNhfU0z97aUOonhQi
ML5aF//0tYiMvgrBthm+RpAev3IjxxHsjq+B2LYVQVxca3jMr4wItqM+VIxd3+b1MVx89Zx7RGTuXgFB
XP7uWoi0kZIFe6hpnJxls4uuXw668tX248Onp+D9A+VuUxuz5BitAAAAAElFTkSuQmCC
</value>
</data>
<data name="LineButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABcAAAAWCAIAAACkFJBSAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAAOxAAA
DsQBlSsOGwAAALlJREFUOE/VlDEOgzAMRX3XzkzcoMoxOEElTlEpx2BlYMjISL/0JbdKIYmdCfSFgkQe
3z82krbl6LjG4QGCkLKn1aH5NeUU4KwqUYIIVCCGZ6D8FGwWEYQQ39FJURdYOCnYCQsKgiOzFyJYCIsy
UxRBECmI3+DlCmGgFBCtFEbA49A4fvuoqaL/Q8lasU7hxzVLxmmm8CD0fjoQdS/sCFAKA1WntMz3XSgt
tfCdvCI8+/T9Y2LVI5j6ABz0fv7PqGRWAAAAAElFTkSuQmCC
</value>
</data>
<data name="MoveButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABUAAAAWCAIAAACg4UBvAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAAOxAAA
DsQBlSsOGwAAAMNJREFUOE+1lEEOgkAMRetZdYsbOQGZY3ACE09hwjHcumDB0uX4sVCbMnQyYySFdMF7
bUqHQ4yRaq/2fCLwr+lZEbdrf2mOCz+Nj9LI80TRkWZ4wBx7Co8X2FH8uf/sOL36w30IXQhEeCJPujx+
gcF/FOU8k2uU89z8Wh/7ve3C/34zwM0DRn1OtGWXN++JwljSvIZl+bRCLAneVNbLaxSwWN5U1ivM8zcK
y5sJJ8+PVlTuvyjyvH8Evjyyupj/X7h/iTfP69gm+sG9wwAAAABJRU5ErkJggg==
</value>
</data>
<metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>