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
+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 Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
namespace Revit.SDK.Samples.GenerateFloor.CS
{
/// <summary>
/// Implements the Revit add-in interface 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(Autodesk.Revit.UI.ExternalCommandData commandData,
ref string message, Autodesk.Revit.DB.ElementSet elements)
{
Transaction tran = new Transaction(commandData.Application.ActiveUIDocument.Document, "Generate Floor");
tran.Start();
try
{
if (null == commandData)
{
throw new ArgumentNullException("commandData");
}
Data data = new Data();
data.ObtainData(commandData);
GenerateFloorForm dlg = new GenerateFloorForm(data);
if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
CreateFloor(data, commandData.Application.ActiveUIDocument.Document);
tran.Commit();
return Autodesk.Revit.UI.Result.Succeeded;
}
else
{
tran.RollBack();
return Autodesk.Revit.UI.Result.Cancelled;
}
}
catch (Exception e)
{
message = e.Message;
tran.RollBack();
return Autodesk.Revit.UI.Result.Failed;
}
}
#endregion IExternalCommand Members Implementation
/// <summary>
/// create a floor by the data obtain from revit.
/// </summary>
/// <param name="data">Data including the profile, level etc, which is need for create a floor.</param>
/// <param name="doc">Retrieves an object that represents the currently active project.</param>
static public void CreateFloor(Data data, Document doc)
{
CurveLoop loop = new CurveLoop();
foreach (Curve curve in data.Profile)
{
loop.Append(curve);
}
List<CurveLoop> floorLoops = new List<CurveLoop> { loop };
Floor.Create(doc, floorLoops, data.FloorType.Id, data.Level.Id, data.Structural, null, 0.0);
}
}
}
+436
View File
@@ -0,0 +1,436 @@
//
// (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.Collections;
using System.Drawing;
using Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
namespace Revit.SDK.Samples.GenerateFloor.CS
{
/// <summary>
/// obtain all data for this sample.
/// all possible types for floor
/// the level that walls based
/// </summary>
public class Data
{
private Hashtable m_floorTypes;
private List<string> m_floorTypesName;
private FloorType m_floorType;
private Level m_level;
private CurveArray m_profile;
private bool m_structural;
private System.Drawing.PointF[] m_points;
private double m_maxLength;
private const double PRECISION = 0.00000001;
private Autodesk.Revit.Creation.Application m_creApp;
private Document m_document;
/// <summary>
/// A floor type to be used by the new floor instead of the default type.
/// </summary>
public FloorType FloorType
{
get
{
return m_floorType;
}
set
{
m_floorType = value;
}
}
/// <summary>
/// The level on which the floor is to be placed.
/// </summary>
public Level Level
{
get
{
return m_level;
}
set
{
m_level = value;
}
}
/// <summary>
/// A array of planar lines and arcs that represent the horizontal profile of the floor.
/// </summary>
public CurveArray Profile
{
get
{
return m_profile;
}
set
{
m_profile = value;
}
}
/// <summary>
/// If set, specifies that the floor is structural in nature.
/// </summary>
public bool Structural
{
get
{
return m_structural;
}
set
{
m_structural = value;
}
}
/// <summary>
/// Points to be draw.
/// </summary>
public System.Drawing.PointF[] Points
{
get
{
return m_points;
}
set
{
m_points = value;
}
}
/// <summary>
/// the graphics' max length
/// </summary>
public double MaxLength
{
get
{
return m_maxLength;
}
set
{
m_maxLength = value;
}
}
/// <summary>
/// List of all floor types name could be used by the floor.
/// </summary>
public List<string> FloorTypesName
{
get
{
return m_floorTypesName;
}
set
{
m_floorTypesName = value;
}
}
/// <summary>
/// Obtain all data which is necessary for generate floor.
/// </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>
public void ObtainData(ExternalCommandData commandData)
{
if (null == commandData)
{
throw new ArgumentNullException("commandData");
}
UIDocument doc = commandData.Application.ActiveUIDocument;
m_document = doc.Document;
ElementSet es = new ElementSet();
foreach (ElementId elementId in doc.Selection.GetElementIds())
{
es.Insert(doc.Document.GetElement(elementId));
}
ElementSet walls = WallFilter(es);
m_creApp = commandData.Application.Application.Create;
Profile = m_creApp.NewCurveArray();
FilteredElementIterator iter = (new FilteredElementCollector(doc.Document)).OfClass(typeof(FloorType)).GetElementIterator();
ObtainFloorTypes(iter);
ObtainProfile(walls);
ObtainLevel(walls);
Generate2D();
Structural = true;
}
/// <summary>
/// Set the floor type to generate by its name.
/// </summary>
/// <param name="typeName">the floor type's name</param>
public void ChooseFloorType(string typeName)
{
FloorType = m_floorTypes[typeName] as FloorType;
}
/// <summary>
/// Obtain all types are available for floor.
/// </summary>
/// <param name="elements">all elements within the Document.</param>
private void ObtainFloorTypes(FilteredElementIterator elements)
{
m_floorTypes = new Hashtable();
FloorTypesName = new List<string>();
elements.Reset();
while (elements.MoveNext())
{
Autodesk.Revit.DB.FloorType ft = elements.Current as Autodesk.Revit.DB.FloorType;
if (null == ft || null == ft.Category || !ft.Category.Name.Equals("Floors"))
{
continue;
}
m_floorTypes.Add(ft.Name, ft);
FloorTypesName.Add(ft.Name);
FloorType = ft;
}
}
/// <summary>
/// Obtain the wall's level
/// </summary>
/// <param name="walls">the selection of walls that make a closed outline </param>
private void ObtainLevel(ElementSet walls)
{
Autodesk.Revit.DB.Level temp = null;
foreach (Wall w in walls)
{
if (null == temp)
{
temp = m_document.GetElement(w.LevelId) as Level;
Level = temp;
}
if (Level.Elevation != (m_document.GetElement(w.LevelId) as Level).Elevation)
{
throw new InvalidOperationException("All walls should base the same level.");
}
}
}
/// <summary>
/// Obtain a profile to generate floor.
/// </summary>
/// <param name="walls">the selection of walls that make a closed outline</param>
private void ObtainProfile(ElementSet walls)
{
CurveArray temp = new CurveArray();
foreach (Wall w in walls)
{
LocationCurve curve = w.Location as LocationCurve;
temp.Append(curve.Curve);
}
SortCurves(temp);
}
/// <summary>
/// Generate 2D data for preview pane.
/// </summary>
private void Generate2D()
{
ArrayList tempArray = new ArrayList();
double xMin = 0;
double xMax = 0;
double yMin = 0;
double yMax = 0;
foreach (Curve c in Profile)
{
List<XYZ> xyzArray = c.Tessellate() as List<XYZ>;
foreach (Autodesk.Revit.DB.XYZ xyz in xyzArray)
{
Autodesk.Revit.DB.XYZ temp = new Autodesk.Revit.DB.XYZ(xyz.X, -xyz.Y, xyz.Z);
FindMinMax(temp, ref xMin, ref xMax, ref yMin, ref yMax);
tempArray.Add(temp);
}
}
MaxLength = ((xMax - xMin) > (yMax - yMin)) ? (xMax - xMin) : (yMax - yMin);
Points = new PointF[tempArray.Count / 2 + 1];
for (int i = 0; i < tempArray.Count; i = i + 2)
{
Autodesk.Revit.DB.XYZ point = (Autodesk.Revit.DB.XYZ)tempArray[i];
Points.SetValue(new PointF((float)(point.X - xMin), (float)(point.Y - yMin)), i / 2);
}
PointF end = (PointF)Points.GetValue(0);
Points.SetValue(end, tempArray.Count / 2);
}
/// <summary>
/// Estimate the current point is left_bottom or right_up.
/// </summary>
/// <param name="point">current point</param>
/// <param name="xMin">left</param>
/// <param name="xMax">right</param>
/// <param name="yMin">bottom</param>
/// <param name="yMax">up</param>
static private void FindMinMax(Autodesk.Revit.DB.XYZ point, ref double xMin, ref double xMax, ref double yMin, ref double yMax)
{
if (point.X < xMin)
{
xMin = point.X;
}
if (point.X > xMax)
{
xMax = point.X;
}
if (point.Y < yMin)
{
yMin = point.Y;
}
if (point.Y > yMax)
{
yMax = point.Y;
}
}
/// <summary>
/// Filter none-wall elements.
/// </summary>
/// <param name="miscellanea">The currently selected Elements in Autodesk Revit</param>
/// <returns></returns>
static private ElementSet WallFilter(ElementSet miscellanea)
{
ElementSet walls = new ElementSet();
foreach (Autodesk.Revit.DB.Element e in miscellanea)
{
Wall w = e as Wall;
if (null != w)
{
walls.Insert(w);
}
}
if (0 == walls.Size)
{
throw new InvalidOperationException("Please select wall first.");
}
return walls;
}
/// <summary>
/// Chaining the profile.
/// </summary>
/// <param name="lines">none-chained profile</param>
private void SortCurves(CurveArray lines)
{
Autodesk.Revit.DB.XYZ temp = lines.get_Item(0).GetEndPoint(1);
Curve temCurve = lines.get_Item(0);
Profile.Append(temCurve);
while (Profile.Size != lines.Size)
{
temCurve = GetNext(lines, temp, temCurve);
if (Math.Abs(temp.X - temCurve.GetEndPoint(0).X) < PRECISION
&& Math.Abs(temp.Y - temCurve.GetEndPoint(0).Y) < PRECISION)
{
temp = temCurve.GetEndPoint(1);
}
else
{
temp = temCurve.GetEndPoint(0);
}
Profile.Append(temCurve);
}
if (Math.Abs(temp.X - lines.get_Item(0).GetEndPoint(0).X) > PRECISION
|| Math.Abs(temp.Y - lines.get_Item(0).GetEndPoint(0).Y) > PRECISION
|| Math.Abs(temp.Z - lines.get_Item(0).GetEndPoint(0).Z) > PRECISION)
{
throw new InvalidOperationException("The selected walls should be closed.");
}
}
/// <summary>
/// Get the connected curve for current curve
/// </summary>
/// <param name="profile">a closed outline made by the selection of walls</param>
/// <param name="connected">current curve's end point</param>
/// <param name="line">current curve</param>
/// <returns>a appropriate curve for generate floor</returns>
private Curve GetNext(CurveArray profile, Autodesk.Revit.DB.XYZ connected, Curve line)
{
foreach (Curve c in profile)
{
if (c.Equals(line))
{
continue;
}
if ((Math.Abs(c.GetEndPoint(0).X - line.GetEndPoint(1).X) < PRECISION && Math.Abs(c.GetEndPoint(0).Y - line.GetEndPoint(1).Y) < PRECISION && Math.Abs(c.GetEndPoint(0).Z - line.GetEndPoint(1).Z) < PRECISION)
&& (Math.Abs(c.GetEndPoint(1).X - line.GetEndPoint(0).X) < PRECISION && Math.Abs(c.GetEndPoint(1).Y - line.GetEndPoint(0).Y) < PRECISION && Math.Abs(c.GetEndPoint(1).Z - line.GetEndPoint(0).Z) < PRECISION)
&& 2 != profile.Size)
{
continue;
}
if (Math.Abs(c.GetEndPoint(0).X - connected.X) < PRECISION && Math.Abs(c.GetEndPoint(0).Y - connected.Y) < PRECISION && Math.Abs(c.GetEndPoint(0).Z - connected.Z) < PRECISION)
{
return c;
}
else if (Math.Abs(c.GetEndPoint(1).X - connected.X) < PRECISION && Math.Abs(c.GetEndPoint(1).Y - connected.Y) < PRECISION && Math.Abs(c.GetEndPoint(1).Z - connected.Z) < PRECISION)
{
if (c.GetType().Name.Equals("Line"))
{
Autodesk.Revit.DB.XYZ start = c.GetEndPoint(1);
Autodesk.Revit.DB.XYZ end = c.GetEndPoint(0);
return Line.CreateBound(start, end);
}
else if (c.GetType().Name.Equals("Arc"))
{
int size = c.Tessellate().Count;
Autodesk.Revit.DB.XYZ start = c.Tessellate()[0];
Autodesk.Revit.DB.XYZ middle = c.Tessellate()[size / 2];
Autodesk.Revit.DB.XYZ end = c.Tessellate()[size];
return Arc.Create(start, end, middle);
}
}
}
throw new InvalidOperationException("The selected walls should be closed.");
}
}
}
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<RevitAddIns>
<AddIn Type="Command">
<Assembly>GenerateFloor.dll</Assembly>
<ClientId>541f100c-ccb9-44fa-b3ae-407ec992dc2e</ClientId>
<FullClassName>Revit.SDK.Samples.GenerateFloor.CS.Command</FullClassName>
<Text>GenerateFloor</Text>
<Description>Generate a floor using a selection of walls that make a closed outline.</Description>
<VisibilityMode>AlwaysVisible</VisibilityMode>
<VendorId>ADSK</VendorId>
<VendorDescription>Autodesk, www.autodesk.com</VendorDescription>
</AddIn>
</RevitAddIns>
@@ -0,0 +1,107 @@
<?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>{5B8D8333-3FD7-44AE-860D-41C7685C5A6B}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>GenerateFloor</RootNamespace>
<AssemblyName>GenerateFloor</AssemblyName>
<SccProjectName>
</SccProjectName>
<SccLocalPath>
</SccLocalPath>
<SccAuxPath>
</SccAuxPath>
<SccProvider>
</SccProvider>
<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>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</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="Data.cs" />
<Compile Include="Command.cs" />
<Compile Include="GenerateFloorForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="GenerateFloorForm.Designer.cs">
<DependentUpon>GenerateFloorForm.cs</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="GenerateFloorForm.resx">
<SubType>Designer</SubType>
<DependentUpon>GenerateFloorForm.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>
+173
View File
@@ -0,0 +1,173 @@
//
// (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.GenerateFloor.CS
{
partial class GenerateFloorForm
{
/// <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.previewGroupBox = new System.Windows.Forms.GroupBox();
this.previewPictureBox = new System.Windows.Forms.PictureBox();
this.floorTypesComboBox = new System.Windows.Forms.ComboBox();
this.structuralCheckBox = new System.Windows.Forms.CheckBox();
this.OK = new System.Windows.Forms.Button();
this.Cancel = new System.Windows.Forms.Button();
this.floorTypeLabel = new System.Windows.Forms.Label();
this.previewGroupBox.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.previewPictureBox)).BeginInit();
this.SuspendLayout();
//
// previewGroupBox
//
this.previewGroupBox.Controls.Add(this.previewPictureBox);
this.previewGroupBox.Location = new System.Drawing.Point(12, 12);
this.previewGroupBox.Name = "previewGroupBox";
this.previewGroupBox.Size = new System.Drawing.Size(268, 242);
this.previewGroupBox.TabIndex = 0;
this.previewGroupBox.TabStop = false;
this.previewGroupBox.Text = "Preview";
//
// previewPictureBox
//
this.previewPictureBox.BackColor = System.Drawing.SystemColors.ControlText;
this.previewPictureBox.Location = new System.Drawing.Point(6, 19);
this.previewPictureBox.Name = "previewPictureBox";
this.previewPictureBox.Size = new System.Drawing.Size(256, 208);
this.previewPictureBox.TabIndex = 0;
this.previewPictureBox.TabStop = false;
this.previewPictureBox.Paint += new System.Windows.Forms.PaintEventHandler(this.previewPictureBox_Paint);
//
// floorTypesComboBox
//
this.floorTypesComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.floorTypesComboBox.FormattingEnabled = true;
this.floorTypesComboBox.Location = new System.Drawing.Point(295, 52);
this.floorTypesComboBox.Name = "floorTypesComboBox";
this.floorTypesComboBox.Size = new System.Drawing.Size(237, 21);
this.floorTypesComboBox.TabIndex = 1;
this.floorTypesComboBox.SelectionChangeCommitted += new System.EventHandler(this.floorTypesComboBox_SelectionChangeCommitted);
//
// structuralCheckBox
//
this.structuralCheckBox.AutoSize = true;
this.structuralCheckBox.Checked = true;
this.structuralCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
this.structuralCheckBox.Location = new System.Drawing.Point(295, 92);
this.structuralCheckBox.Name = "structuralCheckBox";
this.structuralCheckBox.Size = new System.Drawing.Size(71, 17);
this.structuralCheckBox.TabIndex = 2;
this.structuralCheckBox.Text = "Structural";
this.structuralCheckBox.UseVisualStyleBackColor = true;
this.structuralCheckBox.CheckedChanged += new System.EventHandler(this.structralCheckBox_CheckedChanged);
//
// OK
//
this.OK.DialogResult = System.Windows.Forms.DialogResult.OK;
this.OK.Location = new System.Drawing.Point(376, 244);
this.OK.Name = "OK";
this.OK.Size = new System.Drawing.Size(75, 23);
this.OK.TabIndex = 3;
this.OK.Text = "&OK";
this.OK.UseVisualStyleBackColor = true;
//
// Cancel
//
this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.Cancel.Location = new System.Drawing.Point(457, 244);
this.Cancel.Name = "Cancel";
this.Cancel.Size = new System.Drawing.Size(75, 23);
this.Cancel.TabIndex = 3;
this.Cancel.Text = "&Cancel";
this.Cancel.UseVisualStyleBackColor = true;
//
// floorTypeLabel
//
this.floorTypeLabel.AutoSize = true;
this.floorTypeLabel.Location = new System.Drawing.Point(292, 22);
this.floorTypeLabel.Name = "floorTypeLabel";
this.floorTypeLabel.Size = new System.Drawing.Size(62, 13);
this.floorTypeLabel.TabIndex = 4;
this.floorTypeLabel.Text = "Floor Types";
//
// GenerateFloorForm
//
this.AcceptButton = this.OK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.Cancel;
this.ClientSize = new System.Drawing.Size(544, 279);
this.Controls.Add(this.floorTypeLabel);
this.Controls.Add(this.Cancel);
this.Controls.Add(this.OK);
this.Controls.Add(this.structuralCheckBox);
this.Controls.Add(this.floorTypesComboBox);
this.Controls.Add(this.previewGroupBox);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "GenerateFloorForm";
this.ShowInTaskbar = false;
this.Text = "Generate Floor";
this.Load += new System.EventHandler(this.GenerateFloorForm_Load);
this.previewGroupBox.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.previewPictureBox)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.GroupBox previewGroupBox;
private System.Windows.Forms.PictureBox previewPictureBox;
private System.Windows.Forms.ComboBox floorTypesComboBox;
private System.Windows.Forms.CheckBox structuralCheckBox;
private System.Windows.Forms.Button OK;
private System.Windows.Forms.Button Cancel;
private System.Windows.Forms.Label floorTypeLabel;
}
}
@@ -0,0 +1,97 @@
//
// (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;
namespace Revit.SDK.Samples.GenerateFloor.CS
{
/// <summary>
/// User interface.
/// </summary>
public partial class GenerateFloorForm : System.Windows.Forms.Form
{
/// <summary>
/// the data get/set with revit.
/// </summary>
private Data m_data;
/// <summary>
/// constructor
/// </summary>
/// <param name="data"></param>
public GenerateFloorForm(Data data)
{
m_data = data;
InitializeComponent();
}
/// <summary>
/// paint the floor's profile.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void previewPictureBox_Paint(object sender, PaintEventArgs e)
{
double maxLength = previewPictureBox.Width > previewPictureBox.Height ? previewPictureBox.Width : previewPictureBox.Height;
float scale = (float)(maxLength / m_data.MaxLength * 0.8);
e.Graphics.ScaleTransform(scale, scale);
e.Graphics.DrawLines(new Pen(System.Drawing.Color.Red, 1), m_data.Points);
}
/// <summary>
/// initialize the data binding with revit.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void GenerateFloorForm_Load(object sender, EventArgs e)
{
floorTypesComboBox.DataSource = m_data.FloorTypesName;
m_data.ChooseFloorType(floorTypesComboBox.Text);
}
/// <summary>
/// set the floor type to be create.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void floorTypesComboBox_SelectionChangeCommitted(object sender, EventArgs e)
{
m_data.ChooseFloorType(floorTypesComboBox.Text);
}
/// <summary>
/// set if the floor to be create is structural.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void structralCheckBox_CheckedChanged(object sender, EventArgs e)
{
m_data.Structural = structuralCheckBox.Checked;
}
}
}
@@ -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,57 @@
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System.Reflection;
using System.Runtime.CompilerServices;
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("GenerateFloor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GenerateFloor")]
[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("695f2756-e2bd-452b-9f7e-47452efd448c")]
// 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")]