added Revit 2022 SDK minus except *rvt and *rfa

This commit is contained in:
Jeremy Tammik
2021-04-20 11:36:21 +02:00
parent 1133a82dc5
commit 7e327986e8
3034 changed files with 1245318 additions and 0 deletions
@@ -0,0 +1,45 @@
//
// (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.AreaReinParameters.CS
{
using System;
using System.Collections.Generic;
using System.Text;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Structure;
/// <summary>
/// all class that can be the datasource of propertygrid must inherit from it
/// </summary>
public interface IAreaReinData
{
/// <summary>
/// fill datasource with the data of AreaReinforcement
/// </summary>
/// <param name="areaRein"></param>
/// <returns>is successful</returns>
bool FillInData(AreaReinforcement areaRein);
}
}
@@ -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.
//
namespace Revit.SDK.Samples.AreaReinParameters.CS
{
using System;
using System.Collections.Generic;
using System.Text;
/// <summary>
/// Layout Rules possible values of AreaReinforcement
/// </summary>
public enum LayoutRules
{
Fixed_Number = 2,
Maximum_Spacing = 3
}
/// <summary>
/// Hook Orientation possible values of AreaReinforcement which is on a floor
/// </summary>
public enum FloorHookOrientations
{
Up = 0,
Down =2
}
/// <summary>
/// Hook Orientation possible values of AreaReinforcement which is on a wall
/// </summary>
public enum WallHookOrientations
{
Towards_Exterior = 0,
Towards_Interior = 2
}
}
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<RevitAddIns>
<AddIn Type="Command">
<Assembly>AreaReinParameters.dll</Assembly>
<ClientId>5dd706f7-c50c-4602-80f0-fe7309812ec8</ClientId>
<FullClassName>Revit.SDK.Samples.AreaReinParameters.CS.Command</FullClassName>
<Text>AreaReinParameters</Text>
<Description>Show parameters of selected AreaReinforcement and allow user to modify</Description>
<VisibilityMode>AlwaysVisible</VisibilityMode>
<VendorId>ADSK</VendorId>
<VendorDescription>Autodesk, www.autodesk.com</VendorDescription>
</AddIn>
<AddIn Type="Command">
<Assembly>AreaReinParameters.dll</Assembly>
<ClientId>98be928e-7eec-49d8-80ed-fe75d98ca0a8</ClientId>
<FullClassName>Revit.SDK.Samples.AreaReinParameters.CS.RebarParas</FullClassName>
<Text>RebarParameters</Text>
<Description>Show all parameters of selected Rebar</Description>
<VisibilityMode>AlwaysVisible</VisibilityMode>
<VendorId>ADSK</VendorId>
<VendorDescription>Autodesk, www.autodesk.com</VendorDescription>
</AddIn>
</RevitAddIns>
@@ -0,0 +1,269 @@
//
// (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.AreaReinParameters.CS
{
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using System.Windows.Forms;
using Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using Autodesk.Revit.DB.Structure;
/// <summary>
/// Entry point and main command class
/// </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)]
class Command : IExternalCommand
{
static ExternalCommandData m_commandData;
static Hashtable m_hookTypes;
static Hashtable m_barTypes;
AreaReinforcement m_areaRein;
/// <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 revit,
ref string message,
ElementSet elements)
{
Transaction trans = new Transaction(revit.Application.ActiveUIDocument.Document, "Revit.SDK.Samples.AreaReinParameters");
trans.Start();
m_commandData = revit;
if (!PreData())
{
message = "Please select only one AreaReinforcement and ";
message += "make sure there are Hook Types and Bar Types in current project.";
trans.RollBack();
return Autodesk.Revit.UI.Result.Failed;
}
IAreaReinData data = new WallAreaReinData();
if (!data.FillInData(m_areaRein))
{
data = new FloorAreaReinData();
if (!data.FillInData(m_areaRein))
{
message = "Failed to get properties of selected AreaReinforcement.";
trans.RollBack();
return Autodesk.Revit.UI.Result.Failed;
}
}
AreaReinParametersForm form = new AreaReinParametersForm(data);
if (form.ShowDialog() == DialogResult.Cancel)
{
trans.RollBack();
return Autodesk.Revit.UI.Result.Cancelled;
}
trans.Commit();
return Autodesk.Revit.UI.Result.Succeeded;
}
/// <summary>
/// it is convenient for other class to get
/// </summary>
public static ExternalCommandData CommandData
{
get
{
return m_commandData;
}
}
/// <summary>
/// all hook types in current project
/// it is static because of IConverter limitation
/// </summary>
public static Hashtable HookTypes
{
get
{
return m_hookTypes;
}
}
/// <summary>
/// all hook types in current project
/// it is static because of IConverter limitation
/// </summary>
public static Hashtable BarTypes
{
get
{
return m_barTypes;
}
}
/// <summary>
/// check whether the selected is expected, find all hooktypes in current project
/// </summary>
/// <param name="selected">selected elements</param>
/// <returns>whether the selected AreaReinforcement is expected</returns>
private bool PreData()
{
ElementSet selected = new ElementSet();
foreach (ElementId elementId in m_commandData.Application.ActiveUIDocument.Selection.GetElementIds())
{
selected.Insert(m_commandData.Application.ActiveUIDocument.Document.GetElement(elementId));
}
//selected is not only one AreaReinforcement
if (selected.Size != 1)
{
return false;
}
foreach (Object o in selected)
{
m_areaRein = o as AreaReinforcement;
}
if (null == m_areaRein)
{
return false;
}
//make sure hook type and bar type exist in current project and get them
m_hookTypes = new Hashtable();
m_barTypes = new Hashtable();
Document activeDoc = m_commandData.Application.ActiveUIDocument.Document;
FilteredElementIterator itor = (new FilteredElementCollector(activeDoc)).OfClass(typeof(RebarHookType)).GetElementIterator();
itor.Reset();
while (itor.MoveNext())
{
RebarHookType hookType = itor.Current as RebarHookType;
if (null != hookType)
{
string hookTypeName = hookType.Name;
m_hookTypes.Add(hookTypeName, hookType.Id);
}
}
itor = (new FilteredElementCollector(activeDoc)).OfClass(typeof(RebarBarType)).GetElementIterator();
itor.Reset();
while (itor.MoveNext())
{
RebarBarType barType = itor.Current as RebarBarType;
if (null != barType)
{
string barTypeName = barType.Name;
m_barTypes.Add(barTypeName, barType.Id);
}
}
if (m_hookTypes.Count == 0 || m_barTypes.Count == 0)
{
return false;
}
return true;
}
}
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
class RebarParas : IExternalCommand
{
public Autodesk.Revit.UI.Result Execute(
ExternalCommandData revit,
ref string message,
ElementSet elements)
{
try
{
// Get the active document and view
UIDocument revitDoc = revit.Application.ActiveUIDocument;
Autodesk.Revit.DB.View view = revitDoc.Document.ActiveView;
foreach (Autodesk.Revit.DB.ElementId elemId in revitDoc.Selection.GetElementIds())
{
//if( elem.GetType() == typeof( Autodesk.Revit.DB.Structure.Rebar ) )
Autodesk.Revit.DB.Element elem = revitDoc.Document.GetElement(elemId);
if (elem is Rebar)
{
string str = "";
Autodesk.Revit.DB.Structure.Rebar rebar = (Autodesk.Revit.DB.Structure.Rebar)elem;
ParameterSet pars = rebar.Parameters;
foreach (Parameter param in pars)
{
string val = "";
string name = param.Definition.Name;
Autodesk.Revit.DB.StorageType type = param.StorageType;
switch (type)
{
case Autodesk.Revit.DB.StorageType.Double:
val = param.AsDouble().ToString();
break;
case Autodesk.Revit.DB.StorageType.ElementId:
Autodesk.Revit.DB.ElementId id = param.AsElementId();
Autodesk.Revit.DB.Element paraElem = revitDoc.Document.GetElement(id);
if (paraElem != null)
val = paraElem.Name;
break;
case Autodesk.Revit.DB.StorageType.Integer:
val = param.AsInteger().ToString();
break;
case Autodesk.Revit.DB.StorageType.String:
val = param.AsString();
break;
default:
break;
}
str = str + name + ": " + val + "\r\n";
}
TaskDialog.Show("Rebar parameters", str);
return Autodesk.Revit.UI.Result.Succeeded;
}
}
message = "No rebar selected!";
return Autodesk.Revit.UI.Result.Failed;
}
catch (Exception e)
{
message = e.Message;
return Autodesk.Revit.UI.Result.Failed;
}
}
}
}
@@ -0,0 +1,111 @@
<?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>{79220891-F0E5-4FE1-A09B-499831366424}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Revit.SDK.Samples.AreaReinParameters.CS</RootNamespace>
<AssemblyName>AreaReinParameters</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>
</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="AreaReinData.cs" />
<Compile Include="AreaReinEnum.cs" />
<Compile Include="AreaReinParameters.cs" />
<Compile Include="AreaReinParametersForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="AreaReinParametersForm.Designer.cs">
<DependentUpon>AreaReinParametersForm.cs</DependentUpon>
</Compile>
<Compile Include="HookTypeConverter.cs" />
<Compile Include="FloorAreaReinData.cs" />
<Compile Include="ParameterUtil.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="WallAreaReinData.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="AreaReinParametersForm.resx">
<SubType>Designer</SubType>
<DependentUpon>AreaReinParametersForm.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,127 @@
//
// (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.AreaReinParameters.CS
{
partial class AreaReinParametersForm
{
/// <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.parameterGrid = new System.Windows.Forms.PropertyGrid();
this.label1 = new System.Windows.Forms.Label();
this.OKButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// parameterGrid
//
this.parameterGrid.Location = new System.Drawing.Point(12, 25);
this.parameterGrid.Name = "parameterGrid";
this.parameterGrid.Size = new System.Drawing.Size(484, 472);
this.parameterGrid.TabIndex = 0;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(63, 13);
this.label1.TabIndex = 1;
this.label1.Text = "Parameters:";
//
// OKButton
//
this.OKButton.Location = new System.Drawing.Point(329, 503);
this.OKButton.Name = "OKButton";
this.OKButton.Size = new System.Drawing.Size(75, 23);
this.OKButton.TabIndex = 2;
this.OKButton.Text = "&OK";
this.OKButton.UseVisualStyleBackColor = true;
this.OKButton.Click += new System.EventHandler(this.OKButton_Click);
//
// cancelButton
//
this.cancelButton.Location = new System.Drawing.Point(422, 503);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 23);
this.cancelButton.TabIndex = 3;
this.cancelButton.Text = "&Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
//
// AreaReinParametersForm
//
this.AcceptButton = this.OKButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(508, 534);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.OKButton);
this.Controls.Add(this.label1);
this.Controls.Add(this.parameterGrid);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "AreaReinParametersForm";
this.ShowInTaskbar = false;
this.Text = "AreaReinforcement Parameters";
this.Load += new System.EventHandler(this.AreaReinParametersForm_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.PropertyGrid parameterGrid;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button OKButton;
private System.Windows.Forms.Button cancelButton;
}
}
@@ -0,0 +1,80 @@
//
// (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.AreaReinParameters.CS
{
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
public partial class AreaReinParametersForm : System.Windows.Forms.Form
{
IAreaReinData m_data = null;
/// <summary>
/// initialize datasource
/// </summary>
/// <param name="data"></param>
public AreaReinParametersForm(IAreaReinData data)
{
InitializeComponent();
m_data = data;
}
/// <summary>
/// form load
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void AreaReinParametersForm_Load(object sender, EventArgs e)
{
parameterGrid.SelectedObject = m_data;
}
/// <summary>
/// make changes
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OKButton_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.OK;
this.Close();
}
/// <summary>
/// cancel command
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void cancelButton_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
this.Close();
}
}
}
@@ -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,312 @@
//
// (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.AreaReinParameters.CS
{
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.ComponentModel;
using Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Structure;
/// <summary>
/// can be the datasource of propertygrid
/// </summary>
class FloorAreaReinData : IAreaReinData
{
//member
Parameter m_layoutRule;
//top major layer
Parameter m_topMajorBarType = null;
Parameter m_topMajorHookType = null;
Parameter m_topMajorHookOrientation = null;
//top minor layer
Parameter m_topMinorBarType = null;
Parameter m_topMinorHookType = null;
Parameter m_topMinorHookOrientation = null;
//bottom major layer
Parameter m_bottomMajorBarType = null;
Parameter m_bottomMajorHookType = null;
Parameter m_bottomMajorHookOrientation = null;
//bottom minor layer
Parameter m_bottomMinorBarType = null;
Parameter m_bottomMinorHookType = null;
Parameter m_bottomMinorHookOrientation = null;
/// <summary>
/// fill in data with given AreaReinforcement
/// </summary>
/// <param name="areaRein"></param>
/// <returns></returns>
public bool FillInData(AreaReinforcement areaRein)
{
bool flag = false;
//member
m_layoutRule = areaRein.get_Parameter(
BuiltInParameter.REBAR_SYSTEM_LAYOUT_RULE);
flag = (m_layoutRule != null);
//top major layer
m_topMajorBarType = areaRein.get_Parameter(
BuiltInParameter.REBAR_SYSTEM_BAR_TYPE_TOP_DIR_1);
m_topMajorHookType = areaRein.get_Parameter(
BuiltInParameter.REBAR_SYSTEM_HOOK_TYPE_TOP_DIR_1);
m_topMajorHookOrientation = areaRein.get_Parameter(
BuiltInParameter.REBAR_SYSTEM_HOOK_ORIENT_TOP_DIR_1);
flag &= (m_topMajorBarType != null) && (m_topMajorHookOrientation != null)
&& (m_topMajorHookType != null);
//top minor layer
m_topMinorBarType = areaRein.get_Parameter(
BuiltInParameter.REBAR_SYSTEM_BAR_TYPE_TOP_DIR_2);
m_topMinorHookType = areaRein.get_Parameter(
BuiltInParameter.REBAR_SYSTEM_HOOK_TYPE_TOP_DIR_2);
m_topMinorHookOrientation = areaRein.get_Parameter(
BuiltInParameter.REBAR_SYSTEM_HOOK_ORIENT_TOP_DIR_2);
flag &= (m_topMinorBarType != null) && (m_topMinorHookOrientation != null)
&& (m_topMinorHookType != null);
//bottom major layer
m_bottomMajorBarType = areaRein.get_Parameter(
BuiltInParameter.REBAR_SYSTEM_BAR_TYPE_BOTTOM_DIR_1);
m_bottomMajorHookType = areaRein.get_Parameter(
BuiltInParameter.REBAR_SYSTEM_HOOK_TYPE_BOTTOM_DIR_1);
m_bottomMajorHookOrientation = areaRein.get_Parameter(
BuiltInParameter.REBAR_SYSTEM_HOOK_ORIENT_BOTTOM_DIR_1);
flag &= (m_bottomMajorBarType != null) && (m_bottomMajorHookOrientation != null)
&& (m_bottomMajorHookType != null);
//bottom minor layer
m_bottomMinorBarType = areaRein.get_Parameter(
BuiltInParameter.REBAR_SYSTEM_BAR_TYPE_BOTTOM_DIR_2);
m_bottomMinorHookType = areaRein.get_Parameter(
BuiltInParameter.REBAR_SYSTEM_HOOK_TYPE_BOTTOM_DIR_2);
m_bottomMinorHookOrientation = areaRein.get_Parameter(
BuiltInParameter.REBAR_SYSTEM_HOOK_ORIENT_BOTTOM_DIR_2);
flag &= (m_bottomMinorBarType != null) && (m_bottomMinorHookOrientation != null)
&& (m_bottomMinorHookType != null);
return flag;
}
/// <summary>
/// layout rule
/// </summary>
[Category("Construction")]
public LayoutRules Layout_Rule
{
get
{
int index = m_layoutRule.AsInteger();
return (LayoutRules)index;
}
set
{
int index = (int)value;
m_layoutRule.Set(index);
}
}
#region top major layer
[CategoryAttribute("Top Major Layer"), TypeConverter(typeof(BarTypeItem))]
public Autodesk.Revit.DB.ElementId Top_Major_Bar_Type
{
get
{
return m_topMajorBarType.AsElementId();
}
set
{
m_topMajorBarType.Set(value);
}
}
[CategoryAttribute("Top Major Layer"), TypeConverter(typeof(HookTypeItem))]
public Autodesk.Revit.DB.ElementId Top_Major_Hook_Type
{
get
{
return m_topMajorHookType.AsElementId();
}
set
{
m_topMajorHookType.Set(value);
}
}
[CategoryAttribute("Top Major Layer")]
public FloorHookOrientations Top_Major_Hook_Orientation
{
get
{
int index = m_topMajorHookOrientation.AsInteger();
return (FloorHookOrientations)index;
}
set
{
int index = (int)value;
m_topMajorHookOrientation.Set(index);
}
}
#endregion
#region top minor layer
[CategoryAttribute("Top Minor Layer"), TypeConverter(typeof(BarTypeItem))]
public Autodesk.Revit.DB.ElementId Top_Minor_Bar_Type
{
get
{
return m_topMinorBarType.AsElementId();
}
set
{
m_topMinorBarType.Set(value);
}
}
[CategoryAttribute("Top Minor Layer"), TypeConverter(typeof(HookTypeItem))]
public Autodesk.Revit.DB.ElementId Top_Minor_Hook_Type
{
get
{
return m_topMinorHookType.AsElementId();
}
set
{
m_topMinorHookType.Set(value);
}
}
[CategoryAttribute("Top Minor Layer")]
public FloorHookOrientations Top_Minor_Hook_Orientation
{
get
{
int index = m_topMinorHookOrientation.AsInteger();
return (FloorHookOrientations)index;
}
set
{
int index = (int)value;
m_topMinorHookOrientation.Set(index);
}
}
#endregion
#region bottom major layer
[CategoryAttribute("Bottom Major Layer"), TypeConverter(typeof(BarTypeItem))]
public Autodesk.Revit.DB.ElementId Bottom_Major_Bar_Type
{
get
{
return m_bottomMajorBarType.AsElementId();
}
set
{
m_bottomMajorBarType.Set(value);
}
}
[CategoryAttribute("Bottom Major Layer"), TypeConverter(typeof(HookTypeItem))]
public Autodesk.Revit.DB.ElementId Bottom_Major_Hook_Type
{
get
{
return m_bottomMajorHookType.AsElementId();
}
set
{
m_bottomMajorHookType.Set(value);
}
}
[CategoryAttribute("Bottom Major Layer")]
public FloorHookOrientations Bottom_Major_Hook_Orientation
{
get
{
int index = m_bottomMajorHookOrientation.AsInteger();
return (FloorHookOrientations)index;
}
set
{
int index = (int)value;
m_bottomMajorHookOrientation.Set(index);
}
}
#endregion
#region bottom minor layer
[CategoryAttribute("Bottom Minor Layer"), TypeConverter(typeof(BarTypeItem))]
public Autodesk.Revit.DB.ElementId Bottom_Minor_Bar_Type
{
get
{
return m_bottomMinorBarType.AsElementId();
}
set
{
m_bottomMinorBarType.Set(value);
}
}
[CategoryAttribute("Bottom Minor Layer"), TypeConverter(typeof(HookTypeItem))]
public Autodesk.Revit.DB.ElementId Bottom_Minor_Hook_Type
{
get
{
return m_bottomMinorHookType.AsElementId();
}
set
{
m_bottomMinorHookType.Set(value);
}
}
[CategoryAttribute("Bottom Minor Layer")]
public FloorHookOrientations Bottom_Minor_Hook_Orientation
{
get
{
int index = m_bottomMinorHookOrientation.AsInteger();
return (FloorHookOrientations)index;
}
set
{
int index = (int)value;
m_bottomMinorHookOrientation.Set(index);
}
}
#endregion
}
}
@@ -0,0 +1,195 @@
//
// (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.AreaReinParameters.CS
{
using System;
using System.Collections;
using System.ComponentModel;
using System.Globalization;
using Autodesk.Revit;
using Autodesk.Revit.DB;
/// <summary>
/// converter between Autodesk.Revit.DB.ElementId and Element's name
/// </summary>
public abstract class ParameterConverter : TypeConverter
{
/// <summary>
/// hash table save
/// </summary>
protected Hashtable m_hash = null;
/// <summary>
/// initialize m_hash
/// </summary>
protected ParameterConverter()
{
m_hash = new Hashtable();
GetConvertHash();
}
/// <summary>
/// fill m_hashtable
/// </summary>
public abstract void GetConvertHash();
/// <summary>
/// always return true
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
{
return true;
}
/// <summary>
/// provide Autodesk.Revit.DB.ElementId collection
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override StandardValuesCollection GetStandardValues(
ITypeDescriptorContext context)
{
ParameterConverter.StandardValuesCollection standardValues= null;
Autodesk.Revit.DB.ElementId[] Ids = new Autodesk.Revit.DB.ElementId[m_hash.Values.Count];
int i = 0;
foreach (DictionaryEntry de in m_hash)
{
Ids[i++] = (Autodesk.Revit.DB.ElementId)(de.Value);
}
standardValues = new StandardValuesCollection(Ids);
return standardValues;
}
/// <summary>
/// whether conversion is allowable
/// </summary>
/// <param name="context"></param>
/// <param name="sourceType"></param>
/// <returns></returns>
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
if (sourceType == typeof(string))
{
return true;
}
return base.CanConvertFrom(context, sourceType);
}
/// <summary>
/// convert from Name to ElementId
/// </summary>
/// <param name="context"></param>
/// <param name="culture"></param>
/// <param name="v">Name</param>
/// <returns>ElementId</returns>
public override object ConvertFrom(ITypeDescriptorContext context,
CultureInfo culture, object v)
{
if (v is string)
{
foreach (DictionaryEntry de in m_hash)
{
if (de.Key.Equals(v.ToString()))
{
return de.Value;
}
}
}
return base.ConvertFrom(context, culture, v);
}
/// <summary>
/// convert from Autodesk.Revit.DB.ElementId to Name
/// </summary>
/// <param name="context"></param>
/// <param name="culture"></param>
/// <param name="v">ElementId</param>
/// <param name="destinationType">String</param>
/// <returns>Name</returns>
public override object ConvertTo(ITypeDescriptorContext context,
CultureInfo culture, object v, Type destinationType)
{
if (destinationType == typeof(string))
{
foreach (DictionaryEntry de in m_hash)
{
Autodesk.Revit.DB.ElementId tmpId = (Autodesk.Revit.DB.ElementId)de.Value;
Autodesk.Revit.DB.ElementId cmpId = (Autodesk.Revit.DB.ElementId)v;
if (tmpId.IntegerValue == cmpId.IntegerValue)
{
return de.Key.ToString();
}
}
return "";
}
return base.ConvertTo(context, culture, v, destinationType);
}
/// <summary>
/// always return true so that user can't input unexpected text
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
{
return true;
}
}
/// <summary>
/// Hook Type
/// </summary>
public class HookTypeItem : ParameterConverter
{
public override void GetConvertHash()
{
m_hash = Command.HookTypes;
Autodesk.Revit.DB.ElementId id = new Autodesk.Revit.DB.ElementId(-1);
if (!m_hash.ContainsKey("None"))
{
m_hash.Add("None", id);
}
}
}
/// <summary>
/// Bar Type
/// </summary>
public class BarTypeItem : ParameterConverter
{
public override void GetConvertHash()
{
m_hash = Command.BarTypes;
}
}
}
@@ -0,0 +1,132 @@
//
// (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.AreaReinParameters.CS
{
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using Autodesk.Revit;
using Autodesk.Revit.DB;
/// <summary>
/// contain utility methods find or set certain parameter
/// </summary>
public class ParameterUtil
{
private ParameterUtil()
{
}
/// <summary>
/// find certain parameter in a set
/// </summary>
/// <param name="paras"></param>
/// <param name="name">find by name</param>
/// <returns>found parameter</returns>
public static bool SetParaInt(Element elem, string paraName, int value)
{
ParameterSet paras = elem.Parameters;
Parameter findPara = FindParaByName(paras, paraName);
if (null == findPara)
{
return false;
}
if (!findPara.IsReadOnly)
{
findPara.Set(value);
return true;
}
return false;
}
/// <summary>
/// find certain parameter in a set
/// </summary>
/// <param name="paras"></param>
/// <param name="name">find by name</param>
/// <returns>found parameter</returns>
public static Parameter FindParaByName(ParameterSet paras, string name)
{
Parameter findPara = null;
foreach (Parameter para in paras)
{
if (para.Definition.Name == name)
{
findPara = para;
}
}
return findPara;
}
/// <summary>
/// set certain parameter of given element to int value
/// </summary>
/// <param name="elem">given element</param>
/// <param name="paraIndex">BuiltInParameter</param>
/// <param name="value"></param>
/// <returns></returns>
public static bool SetParaInt(Element elem, BuiltInParameter paraIndex, int value)
{
Parameter para = elem.get_Parameter(paraIndex);
if (null == para)
{
return false;
}
if (!para.IsReadOnly)
{
para.Set(value);
return true;
}
return false;
}
/// <summary>
/// set certain parameter of given element to int value
/// </summary>
/// <param name="elem">given element</param>
/// <param name="paraIndex">BuiltInParameter</param>
/// <param name="value"></param>
/// <returns></returns>
public static bool SetParaNullId(Parameter para)
{
Autodesk.Revit.DB.ElementId id = new ElementId(-1);
if (!para.IsReadOnly)
{
para.Set(id);
return true;
}
return false;
}
}
}
@@ -0,0 +1,58 @@
//
// (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("AreaReinParameters")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AreaReinParameters")]
[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("bba137be-c842-4d2d-929a-d6bde9c7e288")]
// 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,306 @@
//
// (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.AreaReinParameters.CS
{
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.ComponentModel;
using Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Structure;
/// <summary>
/// can be the datasource of propertygrid
/// </summary>
class WallAreaReinData : IAreaReinData
{
//member
Parameter m_layoutRule;
//exterior major layer
Parameter m_exteriorMajorBarType = null;
Parameter m_exteriorMajorHookType = null;
Parameter m_exteriorMajorHookOrientation = null;
//exterior minor layer
Parameter m_exteriorMinorBarType = null;
Parameter m_exteriorMinorHookType = null;
Parameter m_exteriorMinorHookOrientation = null;
//interior major layer
Parameter m_interiorMajorBarType = null;
Parameter m_interiorMajorHookType = null;
Parameter m_interiorMajorHookOrientation = null;
//interior minor layer
Parameter m_interiorMinorBarType = null;
Parameter m_interiorMinorHookType = null;
Parameter m_interiorMinorHookOrientation = null;
public bool FillInData(AreaReinforcement areaRein)
{
bool flag = true;
//member
m_layoutRule = areaRein.get_Parameter(
BuiltInParameter.REBAR_SYSTEM_LAYOUT_RULE);
flag = (m_layoutRule != null);
ParameterSet paras = areaRein.Parameters;
//exterior major layer
m_exteriorMajorBarType = ParameterUtil.FindParaByName(paras,
"Exterior Major Bar Type");
m_exteriorMajorHookType = ParameterUtil.FindParaByName(paras,
"Exterior Major Hook Type");
m_exteriorMajorHookOrientation = ParameterUtil.FindParaByName(paras,
"Exterior Major Hook Orientation");
flag &= (m_exteriorMajorBarType != null) && (m_exteriorMajorHookOrientation != null)
&& (m_exteriorMajorHookType != null);
//exterior minor layer
m_exteriorMinorBarType = ParameterUtil.FindParaByName(paras,
"Exterior Minor Bar Type");
m_exteriorMinorHookType = ParameterUtil.FindParaByName(paras,
"Exterior Minor Hook Type");
m_exteriorMinorHookOrientation = ParameterUtil.FindParaByName(paras,
"Exterior Minor Hook Orientation");
flag &= (m_exteriorMinorBarType != null) && (m_exteriorMinorHookOrientation != null)
&& (m_exteriorMinorHookType != null);
//interior major layer
m_interiorMajorBarType = ParameterUtil.FindParaByName(paras,
"Interior Major Bar Type");
m_interiorMajorHookType = ParameterUtil.FindParaByName(paras,
"Interior Major Hook Type");
m_interiorMajorHookOrientation = ParameterUtil.FindParaByName(paras,
"Interior Major Hook Orientation");
flag &= (m_interiorMajorBarType != null) && (m_interiorMajorHookOrientation != null)
&& (m_interiorMajorHookType != null);
//interior minor layer
m_interiorMinorBarType = ParameterUtil.FindParaByName(paras,
"Interior Minor Bar Type");
m_interiorMinorHookType = ParameterUtil.FindParaByName(paras,
"Interior Minor Hook Type");
m_interiorMinorHookOrientation = ParameterUtil.FindParaByName(paras,
"Interior Minor Hook Orientation");
flag &= (m_interiorMinorBarType != null) && (m_interiorMinorHookOrientation != null)
&& (m_interiorMinorHookType != null);
return flag;
}
[Category("Construction")]
public LayoutRules Layout_Rule
{
get
{
int index = m_layoutRule.AsInteger();
return (LayoutRules)index;
}
set
{
int index = (int)value;
m_layoutRule.Set(index);
}
}
#region exterior major layer
[CategoryAttribute("Exterior Major Layers"), TypeConverter(typeof(BarTypeItem))]
public Autodesk.Revit.DB.ElementId Exterior_Major_Bar_Type
{
get
{
return m_exteriorMajorBarType.AsElementId();
}
set
{
m_exteriorMajorBarType.Set(value);
}
}
[CategoryAttribute("Exterior Major Layers"), TypeConverter(typeof(HookTypeItem))]
public Autodesk.Revit.DB.ElementId Exterior_Major_Hook_Type
{
get
{
return m_exteriorMajorHookType.AsElementId();
}
set
{
m_exteriorMajorHookType.Set(value);
}
}
[CategoryAttribute("Exterior Major Layers")]
public WallHookOrientations Exterior_Major_Hook_Orientation
{
get
{
int index = m_exteriorMajorHookOrientation.AsInteger();
return (WallHookOrientations)index;
}
set
{
int index = (int)value;
m_exteriorMajorHookOrientation.Set(index);
}
}
#endregion
#region exterior minor layer
[CategoryAttribute("Exterior Minor Layers"), TypeConverter(typeof(BarTypeItem))]
public Autodesk.Revit.DB.ElementId Exterior_Minor_Bar_Type
{
get
{
return m_exteriorMinorBarType.AsElementId();
}
set
{
m_exteriorMinorBarType.Set(value);
}
}
[CategoryAttribute("Exterior Minor Layers"), TypeConverter(typeof(HookTypeItem))]
public Autodesk.Revit.DB.ElementId Exterior_Minor_Hook_Type
{
get
{
return m_exteriorMinorHookType.AsElementId();
}
set
{
m_exteriorMinorHookType.Set(value);
}
}
[CategoryAttribute("Exterior Minor Layers")]
public WallHookOrientations Exterior_Minor_Hook_Orientation
{
get
{
int index = m_exteriorMinorHookOrientation.AsInteger();
return (WallHookOrientations)index;
}
set
{
int index = (int)value;
m_exteriorMinorHookOrientation.Set(index);
}
}
#endregion
#region interior major layer
[CategoryAttribute("Interior Major Layers"), TypeConverter(typeof(BarTypeItem))]
public Autodesk.Revit.DB.ElementId Interior_Major_Bar_Type
{
get
{
return m_interiorMajorBarType.AsElementId();
}
set
{
m_interiorMajorBarType.Set(value);
}
}
[CategoryAttribute("Interior Major Layers"), TypeConverter(typeof(HookTypeItem))]
public Autodesk.Revit.DB.ElementId Interior_Major_Hook_Type
{
get
{
return m_interiorMajorHookType.AsElementId();
}
set
{
m_interiorMajorHookType.Set(value);
}
}
[CategoryAttribute("Interior Major Layers")]
public WallHookOrientations Interior_Major_Hook_Orientation
{
get
{
int index = m_interiorMajorHookOrientation.AsInteger();
return (WallHookOrientations)index;
}
set
{
int index = (int)value;
m_interiorMajorHookOrientation.Set(index);
}
}
#endregion
#region interior minor layer
[CategoryAttribute("Interior Minor Layers"), TypeConverter(typeof(BarTypeItem))]
public Autodesk.Revit.DB.ElementId Interior_Minor_Bar_Type
{
get
{
return m_interiorMinorBarType.AsElementId();
}
set
{
m_interiorMinorBarType.Set(value);
}
}
[CategoryAttribute("Interior Minor Layers"), TypeConverter(typeof(HookTypeItem))]
public Autodesk.Revit.DB.ElementId Interior_Minor_Hook_Type
{
get
{
return m_interiorMinorHookType.AsElementId();
}
set
{
m_interiorMinorHookType.Set(value);
}
}
[CategoryAttribute("Interior Minor Layers"),]
public WallHookOrientations Interior_Minor_Hook_Orientation
{
get
{
int index = m_interiorMinorHookOrientation.AsInteger();
return (WallHookOrientations)index;
}
set
{
int index = (int)value;
m_interiorMinorHookOrientation.Set(index);
}
}
#endregion
}
}