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,294 @@
//
// (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.CreateSimpleAreaRein.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;
using GeoElement = Autodesk.Revit.DB.GeometryElement;
using Element = Autodesk.Revit.DB.Element;
/// <summary>
/// data of the AreaReinforcement
/// </summary>
public class AreaReinData
{
/// <summary>
/// constructor
/// </summary>
public AreaReinData()
{}
private LayoutRules m_layoutRule = LayoutRules.Maximum_Spacing;
/// <summary>
/// Parameter LayoutRule of AreaReinforcement
/// </summary>
[CategoryAttribute("Construction"), DefaultValueAttribute(
LayoutRules.Maximum_Spacing)]
public LayoutRules LayoutRule
{
get
{
return m_layoutRule;
}
set
{
m_layoutRule = value;
}
}
/// <summary>
/// set the parameters to given AreaReinforcement
/// </summary>
/// <param name="areaRein"></param>
public virtual void FillIn(AreaReinforcement areaRein)
{
int temp = (int)m_layoutRule;
bool flag = ParameterUtil.SetParaInt(areaRein,
BuiltInParameter.REBAR_SYSTEM_LAYOUT_RULE, temp);
if(!flag)
{
Parameter paraLayout = ParameterUtil.FindParaByName(
areaRein.Parameters, "Layout Rule");
if (null != paraLayout)
{
paraLayout.Set(temp);
}
}
}
}
/// <summary>
/// data of AreaReinforcement which created on wall
/// </summary>
public class AreaReinDataOnWall:AreaReinData
{
private bool m_exteriorMajorDirection = true;
private bool m_exteriorMinorDirection = true;
private bool m_interiorMajorDirection = true;
private bool m_interiorMinorDirection = true;
/// <summary>
/// Parameter of AreaReinforcement
/// </summary>
[CategoryAttribute("Layers")]
public bool ExteriorMajorDirection
{
get
{
return m_exteriorMajorDirection;
}
set
{
m_exteriorMajorDirection = value;
}
}
/// <summary>
/// Parameter of AreaReinforcement
/// </summary>
[CategoryAttribute("Layers")]
public bool ExteriorMinorDirection
{
get
{
return m_exteriorMinorDirection;
}
set
{
m_exteriorMinorDirection = value;
}
}
/// <summary>
/// Parameter of AreaReinforcement
/// </summary>
[CategoryAttribute("Layers")]
public bool InteriorMajorDirection
{
get
{
return m_interiorMajorDirection;
}
set
{
m_interiorMajorDirection = value;
}
}
/// <summary>
/// Parameter of AreaReinforcement
/// </summary>
[CategoryAttribute("Layers")]
public bool InteriorMinorDirection
{
get
{
return m_interiorMinorDirection;
}
set
{
m_interiorMinorDirection = value;
}
}
/// <summary>
/// set the parameters to given AreaReinforcement
/// </summary>
/// <param name="areaRein"></param>
public override void FillIn(AreaReinforcement areaRein)
{
base.FillIn(areaRein);
foreach (Parameter para in areaRein.Parameters)
{
if (para.Definition.Name == "Exterior Major Direction")
{
para.Set(Convert.ToInt32(m_exteriorMajorDirection));
}
if (para.Definition.Name == "Interior Major Direction")
{
para.Set(Convert.ToInt32(m_interiorMajorDirection));
}
if (para.Definition.Name == "Exterior Minor Direction")
{
para.Set(Convert.ToInt32(m_exteriorMinorDirection));
}
if (para.Definition.Name == "Interior Minor Direction")
{
para.Set(Convert.ToInt32(m_interiorMinorDirection));
}
}
}
}
/// <summary>
/// data of AreaReinforcement which created on floor
/// </summary>
public class AreaReinDataOnFloor : AreaReinData
{
private bool m_topMajorDirection = true;
private bool m_topMinorDirection = true;
private bool m_bottomMajorDirection = true;
private bool m_bottomMinorDirection = true;
/// <summary>
/// Parameter of AreaReinforcement
/// </summary>
[CategoryAttribute("Layers")]
public bool TopMajorDirection
{
get
{
return m_topMajorDirection;
}
set
{
m_topMajorDirection = value;
}
}
/// <summary>
/// Parameter of AreaReinforcement
/// </summary>
[CategoryAttribute("Layers")]
public bool TopMinorDirection
{
get
{
return m_topMinorDirection;
}
set
{
m_topMinorDirection = value;
}
}
/// <summary>
/// Parameter of AreaReinforcement
/// </summary>
[CategoryAttribute("Layers")]
public bool BottomMajorDirection
{
get
{
return m_bottomMajorDirection;
}
set
{
m_bottomMajorDirection = value;
}
}
/// <summary>
/// Parameter of AreaReinforcement
/// </summary>
[CategoryAttribute("Layers")]
public bool BottomMinorDirection
{
get
{
return m_bottomMinorDirection;
}
set
{
m_bottomMinorDirection = value;
}
}
/// <summary>
/// set the parameters to given AreaReinforcement
/// </summary>
/// <param name="areaRein"></param>
public override void FillIn(AreaReinforcement areaRein)
{
base.FillIn(areaRein);
ParameterUtil.SetParaInt(areaRein,
BuiltInParameter.REBAR_SYSTEM_ACTIVE_BOTTOM_DIR_1,
Convert.ToInt32(m_bottomMajorDirection));
ParameterUtil.SetParaInt(areaRein,
BuiltInParameter.REBAR_SYSTEM_ACTIVE_BOTTOM_DIR_2,
Convert.ToInt32(m_bottomMinorDirection));
ParameterUtil.SetParaInt(areaRein,
BuiltInParameter.REBAR_SYSTEM_ACTIVE_TOP_DIR_1,
Convert.ToInt32(m_topMajorDirection));
ParameterUtil.SetParaInt(areaRein,
BuiltInParameter.REBAR_SYSTEM_ACTIVE_TOP_DIR_2,
Convert.ToInt32(m_topMinorDirection));
}
}
}
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<RevitAddIns>
<AddIn Type="Command">
<Assembly>CreateSimpleAreaRein.dll</Assembly>
<ClientId>81dafcfd-c1d7-48e1-8816-a155fc414df2</ClientId>
<FullClassName>Revit.SDK.Samples.CreateSimpleAreaRein.CS.Command</FullClassName>
<Text>Create simple area reinforcement</Text>
<Description>Create simple AreaReinforcement on selected wall or floor.</Description>
<VisibilityMode>AlwaysVisible</VisibilityMode>
<VendorId>ADSK</VendorId>
<VendorDescription>Autodesk, www.autodesk.com</VendorDescription>
</AddIn>
</RevitAddIns>
@@ -0,0 +1,259 @@
//
// (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 Autodesk.Revit.UI;
namespace Revit.SDK.Samples.CreateSimpleAreaRein.CS
{
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Structure;
using DocCreator = Autodesk.Revit.Creation.Document;
/// <summary>
/// main class to create simple AreaReinforcement on selected wall or floor
/// </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
{
private UIDocument m_currentDoc;
private static ExternalCommandData m_revit;
///<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, Autodesk.Revit.DB.ElementSet elements)
{
Transaction trans = new Transaction(revit.Application.ActiveUIDocument.Document, "Revit.SDK.Samples.CreateSimpleAreaRein");
trans.Start();
//initialize necessary data
m_revit = revit;
m_currentDoc = revit.Application.ActiveUIDocument;
//create AreaReinforcement
try
{
if (Create())
{
trans.Start();
return Autodesk.Revit.UI.Result.Succeeded;
}
}
catch (ApplicationException appEx)
{
TaskDialog.Show("Revit", appEx.Message);
trans.RollBack();
return Autodesk.Revit.UI.Result.Failed;
}
catch
{
TaskDialog.Show("Revit", "Unknow Errors.");
trans.RollBack();
return Autodesk.Revit.UI.Result.Failed;
}
trans.RollBack();
return Autodesk.Revit.UI.Result.Cancelled;
}
/// <summary>
/// ExternalCommandData
/// </summary>
public static ExternalCommandData CommandData
{
get
{
return m_revit;
}
}
/// <summary>
/// create simple AreaReinforcement on selected wall or floor
/// </summary>
/// <returns></returns>
private bool Create()
{
ElementSet elems = new ElementSet();
foreach (ElementId elementId in m_currentDoc.Selection.GetElementIds())
{
elems.Insert(m_currentDoc.Document.GetElement(elementId));
}
//selected 0 or more than 1 element
if (elems.Size != 1)
{
TaskDialog.Show("Error", "Please select exactly one wall or floor.");
return false;
}
foreach (object o in elems)
{
//create on floor
Floor floor = o as Floor;
if (null != floor)
{
bool flag = CreateAreaReinOnFloor(floor);
return flag;
}
//create on wall
Wall wall = o as Wall;
if (null != wall)
{
bool flag = CreateAreaReinOnWall(wall);
return flag;
}
//selected element is neither wall nor floor
TaskDialog.Show("Error", "Please select exactly one wall or floor.");
}
return false;
}
/// <summary>
/// create simple AreaReinforcement on horizontal floor
/// </summary>
/// <param name="floor"></param>
/// <returns>is successful</returns>
private bool CreateAreaReinOnFloor(Floor floor)
{
GeomHelper helper = new GeomHelper();
Reference refer = null;
IList<Curve> curves = new List<Curve>();
//check whether floor is horizontal rectangular
//and prepare necessary to create AreaReinforcement
if (!helper.GetFloorGeom(floor, ref refer, ref curves))
{
ApplicationException appEx = new ApplicationException(
"Your selection is not a horizontal rectangular slab.");
throw appEx;
}
AreaReinDataOnFloor dataOnFloor = new AreaReinDataOnFloor();
CreateSimpleAreaReinForm createForm =
new CreateSimpleAreaReinForm(dataOnFloor);
//allow use select parameters to create
if (createForm.ShowDialog() == DialogResult.OK)
{
//define the Major Direction of AreaReinforcement,
//we get direction of first Line on the Floor as the Major Direction
Line firstLine = (Line)(curves[0]);
Autodesk.Revit.DB.XYZ majorDirection = new Autodesk.Revit.DB.XYZ(
firstLine.GetEndPoint(1).X - firstLine.GetEndPoint(0).X,
firstLine.GetEndPoint(1).Y - firstLine.GetEndPoint(0).Y,
firstLine.GetEndPoint(1).Z - firstLine.GetEndPoint(0).Z);
//Create AreaReinforcement
ElementId areaReinforcementTypeId = AreaReinforcementType.CreateDefaultAreaReinforcementType(m_revit.Application.ActiveUIDocument.Document);
ElementId rebarBarTypeId = RebarBarType.CreateDefaultRebarBarType(m_revit.Application.ActiveUIDocument.Document);
ElementId rebarHookTypeId = RebarHookType.CreateDefaultRebarHookType(m_revit.Application.ActiveUIDocument.Document);
AreaReinforcement areaRein = AreaReinforcement.Create(m_revit.Application.ActiveUIDocument.Document, floor, curves, majorDirection, areaReinforcementTypeId, rebarBarTypeId, rebarHookTypeId);
//set AreaReinforcement and it's AreaReinforcementCurves parameters
dataOnFloor.FillIn(areaRein);
return true;
}
return false;
}
/// <summary>
/// create simple AreaReinforcement on vertical straight rectangular wall
/// </summary>
/// <param name="wall"></param>
/// <returns>is successful</returns>
private bool CreateAreaReinOnWall(Wall wall)
{
//make sure selected is basic wall
if (wall.WallType.Kind != WallKind.Basic)
{
TaskDialog.Show("Revit", "Selected wall is not a basic wall.");
return false;
}
GeomHelper helper = new GeomHelper();
Reference refer = null;
IList<Curve> curves = new List<Curve>();
//check whether wall is vertical rectangular and analytical model shape is line
if (!helper.GetWallGeom(wall, ref refer, ref curves))
{
ApplicationException appEx = new ApplicationException(
"Your selection is not a structural straight rectangular wall.");
throw appEx;
}
AreaReinDataOnWall dataOnWall = new AreaReinDataOnWall();
CreateSimpleAreaReinForm createForm = new
CreateSimpleAreaReinForm(dataOnWall);
//allow use select parameters to create
if (createForm.ShowDialog() == DialogResult.OK)
{
DocCreator creator = m_revit.Application.ActiveUIDocument.Document.Create;
//define the Major Direction of AreaReinforcement,
//we get direction of first Line on the Floor as the Major Direction
Line firstLine = (Line)(curves[0]);
Autodesk.Revit.DB.XYZ majorDirection = new Autodesk.Revit.DB.XYZ(
firstLine.GetEndPoint(1).X - firstLine.GetEndPoint(0).X,
firstLine.GetEndPoint(1).Y - firstLine.GetEndPoint(0).Y,
firstLine.GetEndPoint(1).Z - firstLine.GetEndPoint(0).Z);
//create AreaReinforcement
IList<Curve> curveList = new List<Curve>();
foreach (Curve curve in curves)
{
curveList.Add(curve);
}
ElementId areaReinforcementTypeId = AreaReinforcementType.CreateDefaultAreaReinforcementType(m_revit.Application.ActiveUIDocument.Document);
ElementId rebarBarTypeId = RebarBarType.CreateDefaultRebarBarType(m_revit.Application.ActiveUIDocument.Document);
ElementId rebarHookTypeId = RebarHookType.CreateDefaultRebarHookType(m_revit.Application.ActiveUIDocument.Document);
AreaReinforcement areaRein = AreaReinforcement.Create(m_revit.Application.ActiveUIDocument.Document, wall, curveList, majorDirection, areaReinforcementTypeId, rebarBarTypeId, rebarHookTypeId);
dataOnWall.FillIn(areaRein);
return true;
}
return false;
}
}
}
@@ -0,0 +1,109 @@
<?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>{F60E3E5A-71C8-449A-8B2F-1046B6F0D93D}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Revit.SDK.Samples.CreateSimpleAreaRein.CS</RootNamespace>
<AssemblyName>CreateSimpleAreaRein</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="CreateSimpleAreaRein.cs" />
<Compile Include="CreateSimpleAreaReinForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="CreateSimpleAreaReinForm.Designer.cs">
<DependentUpon>CreateSimpleAreaReinForm.cs</DependentUpon>
</Compile>
<Compile Include="GeomHelper.cs" />
<Compile Include="GeomUtil.cs" />
<Compile Include="ParameterUtil.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="CreateSimpleAreaReinForm.resx">
<SubType>Designer</SubType>
<DependentUpon>CreateSimpleAreaReinForm.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,113 @@
//
// (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.CreateSimpleAreaRein.CS
{
partial class CreateSimpleAreaReinForm
{
/// <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.areaReinPropertyGrid = new System.Windows.Forms.PropertyGrid();
this.okButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// areaReinPropertyGrid
//
this.areaReinPropertyGrid.Location = new System.Drawing.Point(12, 12);
this.areaReinPropertyGrid.Name = "areaReinPropertyGrid";
this.areaReinPropertyGrid.Size = new System.Drawing.Size(372, 401);
this.areaReinPropertyGrid.TabIndex = 1;
//
// okButton
//
this.okButton.Location = new System.Drawing.Point(228, 419);
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.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(309, 419);
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);
//
// CreateSimpleAreaReinForm
//
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(396, 453);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.Controls.Add(this.areaReinPropertyGrid);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "CreateSimpleAreaReinForm";
this.ShowInTaskbar = false;
this.Text = "Create Simple AreaReinforcement";
this.Load += new System.EventHandler(this.CreateSimpleAreaReinForm_Load);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.PropertyGrid areaReinPropertyGrid;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Button cancelButton;
}
}
@@ -0,0 +1,81 @@
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
namespace Revit.SDK.Samples.CreateSimpleAreaRein.CS
{
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
/// <summary>
/// simple business process of UI
/// </summary>
public partial class CreateSimpleAreaReinForm : System.Windows.Forms.Form
{
private AreaReinData m_dataBuffer;
/// <summary>
/// constructor; initialize member data
/// </summary>
/// <param name="dataBuffer"></param>
public CreateSimpleAreaReinForm(AreaReinData dataBuffer)
{
InitializeComponent();
m_dataBuffer = dataBuffer;
}
/// <summary>
/// bind data to controls
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void CreateSimpleAreaReinForm_Load(object sender, EventArgs e)
{
areaReinPropertyGrid.SelectedObject = m_dataBuffer;
}
/// <summary>
/// to create
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void okButton_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.OK;
}
/// <summary>
/// cancel the command
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void cancelButton_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
}
}
}
@@ -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,147 @@
//
// (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.CreateSimpleAreaRein.CS
{
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Structure;
using GeoElement = Autodesk.Revit.DB.GeometryElement;
using Element = Autodesk.Revit.DB.Element;
/// <summary>
/// provide utility method to get geometry data for
/// creating AreaReinforcement on wall or floor
/// </summary>
class GeomHelper
{
private Document m_currentDoc; //active document
/// <summary>
/// constructor, initialize m_currentDoc
/// </summary>
public GeomHelper()
{
m_currentDoc = Command.CommandData.Application.ActiveUIDocument.Document;
}
/// <summary>
/// get necessary data when create AreaReinforcement on a straight wall
/// </summary>
/// <param name="wall">wall on which to create AreaReinforcemen</param>
/// <param name="refer">reference of the vertical straight face on the wall</param>
/// <param name="curves">curves compose the vertical face of the wall</param>
/// <returns>is successful</returns>
public bool GetWallGeom(Wall wall, ref Reference refer, ref IList<Curve> curves)
{
FaceArray faces = GeomUtil.GetFaces(wall);
LocationCurve locCurve = wall.Location as LocationCurve;
//unless API has bug, locCurve can't be null
if (null == locCurve)
{
return false;
}
//check the location is line
Line locLine = locCurve.Curve as Line;
if (null == locLine)
{
return false;
}
//get the face reference
foreach (Face face in faces)
{
if (GeomUtil.IsParallel(face, locLine))
{
refer = face.Reference;
break;
}
}
//can't find proper reference
if (null == refer)
{
return false;
}
//check the analytical model profile is rectangular
AnalyticalModel model = wall.GetAnalyticalModel();
if (null == model)
{
return false;
}
curves = model.GetCurves(AnalyticalCurveType.ActiveCurves);
if (!GeomUtil.IsRectangular(curves))
{
return false;
}
return true;
}
/// <summary>
/// get necessary data when create AreaReinforcement on a horizontal floor
/// </summary>
/// <param name="floor">floor on which to create AreaReinforcemen</param>
/// <param name="refer">reference of the horizontal face on the floor</param>
/// <param name="curves">curves compose the horizontal face of the floor</param>
/// <returns>is successful</returns>
public bool GetFloorGeom(Floor floor, ref Reference refer, ref IList<Curve> curves)
{
//get horizontal face reference
FaceArray faces = GeomUtil.GetFaces(floor);
foreach (Face face in faces)
{
if (GeomUtil.IsHorizontalFace(face))
{
refer = face.Reference;
break;
}
}
//no proper reference
if (null == refer)
{
return false;
}
//check the analytical model profile is rectangular
AnalyticalModel model = floor.GetAnalyticalModel();
if (null == model)
{
return false;
}
curves = model.GetCurves(AnalyticalCurveType.ActiveCurves);
if (!GeomUtil.IsRectangular(curves))
{
return false;
}
return true;
}
}
}
@@ -0,0 +1,283 @@
//
// (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.CreateSimpleAreaRein.CS
{
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Structure;
using GeoElement = Autodesk.Revit.DB.GeometryElement;
using GeoSolid = Autodesk.Revit.DB.Solid;
using Element = Autodesk.Revit.DB.Element;
/// <summary>
/// provide some common geometry judgement and calculate method
/// </summary>
class GeomUtil
{
const double PRECISION = 0.00001; //precision when judge whether two doubles are equal
/// <summary>
/// get all faces that compose the geometry solid of given element
/// </summary>
/// <param name="elem">element to be calculated</param>
/// <returns>all faces</returns>
public static FaceArray GetFaces(Element elem)
{
List<Face> faces = new List<Face>();
Autodesk.Revit.DB.Options geoOptions =
Command.CommandData.Application.Application.Create.NewGeometryOptions();
geoOptions.ComputeReferences = true;
GeoElement geoElem = elem.get_Geometry(geoOptions);
//GeometryObjectArray geoElems = geoElem.Objects;
IEnumerator<GeometryObject> Objects = geoElem.GetEnumerator();
//foreach (object o in geoElems)
while (Objects.MoveNext())
{
object o = Objects.Current;
GeoSolid geoSolid = o as GeoSolid;
if (null == geoSolid)
{
continue;
}
return geoSolid.Faces;
}
return null;
}
/// <summary>
/// get all points proximate to the given face
/// </summary>
/// <param name="face">face to be calculated</param>
/// <returns></returns>
public static List<Autodesk.Revit.DB.XYZ> GetPoints(Face face)
{
List<Autodesk.Revit.DB.XYZ> points = new List<Autodesk.Revit.DB.XYZ>();
List<Autodesk.Revit.DB.XYZ> XYZs = face.Triangulate().Vertices as List<Autodesk.Revit.DB.XYZ>;
foreach (Autodesk.Revit.DB.XYZ point in XYZs)
{
points.Add(point);
}
return points;
}
/// <summary>
/// judge whether the given face is horizontal
/// </summary>
/// <param name="face">face to be judged</param>
/// <returns>is horizontal</returns>
public static bool IsHorizontalFace(Face face)
{
List<Autodesk.Revit.DB.XYZ> points = GetPoints(face);
double z1 = points[0].Z;
double z2 = points[1].Z;
double z3 = points[2].Z;
double z4 = points[3].Z;
bool flag = IsEqual(z1, z2);
flag = flag && IsEqual(z2, z3);
flag = flag && IsEqual(z3, z4);
flag = flag && IsEqual(z4, z1);
return flag;
}
/// <summary>
/// judge whether a face and a line are parallel
/// </summary>
/// <param name="face"></param>
/// <param name="line"></param>
/// <returns></returns>
public static bool IsParallel(Face face, Line line)
{
List<Autodesk.Revit.DB.XYZ> points = GetPoints(face);
Autodesk.Revit.DB.XYZ vector1 = SubXYZ(points[0], points[1]);
Autodesk.Revit.DB.XYZ vector2 = SubXYZ(points[1], points[2]);
Autodesk.Revit.DB.XYZ refer = SubXYZ(line.GetEndPoint(0), line.GetEndPoint(1));
Autodesk.Revit.DB.XYZ cross = CrossMatrix(vector1, vector2);
double result = DotMatrix(cross, refer);
if (result < PRECISION)
{
return true;
}
return false;
}
/// <summary>
/// judge whether given 4 lines can form a rectangular
/// </summary>
/// <param name="lines"></param>
/// <returns>is rectangular</returns>
public static bool IsRectangular(IList<Curve> curves)
{
//make sure the CurveArray contains 4 line
if (curves.Count != 4)
{
return false;
}
Line[] lines = new Line[4];
for (int i = 0; i < 4; i++)
{
lines[i] = curves[i] as Line;
if (null == lines[i])
{
return false;
}
}
//make sure the first line is vertical to 2 lines and parallel to another line
Line iniLine = lines[0];
Line[] verticalLines = new Line[2];
Line paraLine = null;
int index = 0;
for (int i = 1; i < 4; i++)
{
if (IsVertical(lines[0], lines[i]))
{
verticalLines[index] = lines[i];
index++;
}
else
{
paraLine = lines[i];
}
}
if (index != 2)
{
return false;
}
bool flag = IsVertical(paraLine, verticalLines[0]);
return flag;
}
/// <summary>
/// judge whether two lines are vertical
/// </summary>
/// <param name="line1"></param>
/// <param name="line2"></param>
/// <returns></returns>
private static bool IsVertical(Line line1, Line line2)
{
Autodesk.Revit.DB.XYZ vector1 = SubXYZ(line1.GetEndPoint(0), line1.GetEndPoint(1));
Autodesk.Revit.DB.XYZ vector2 = SubXYZ(line2.GetEndPoint(0), line2.GetEndPoint(1));
double result = DotMatrix(vector1, vector2);
if (Math.Abs(result) < PRECISION)
{
return true;
}
return false;
}
/// <summary>
/// subtraction of two Autodesk.Revit.DB.XYZ as Matrix
/// </summary>
/// <param name="p1"></param>
/// <param name="p2"></param>
/// <returns></returns>
private static Autodesk.Revit.DB.XYZ SubXYZ(Autodesk.Revit.DB.XYZ p1, Autodesk.Revit.DB.XYZ p2)
{
double x = p1.X - p2.X;
double y = p1.Y - p2.Y;
double z = p1.Z - p2.Z;
Autodesk.Revit.DB.XYZ result = new Autodesk.Revit.DB.XYZ(x, y, z);
return result;
}
/// <summary>
/// multiplication cross of two Autodesk.Revit.DB.XYZ as Matrix
/// </summary>
/// <param name="p1"></param>
/// <param name="p2"></param>
/// <returns></returns>
private static Autodesk.Revit.DB.XYZ CrossMatrix(Autodesk.Revit.DB.XYZ p1, Autodesk.Revit.DB.XYZ p2)
{
double v1 = p1.X;
double v2 = p1.Y;
double v3 = p1.Z;
double u1 = p2.X;
double u2 = p2.Y;
double u3 = p2.Z;
double x = v3 * u2 - v2 * u3;
double y = -v3 * u1 + v1 * u3;
double z = v2 * u1 - v1 * u2;
Autodesk.Revit.DB.XYZ point = new Autodesk.Revit.DB.XYZ(x, y, z);
return point;
}
/// <summary>
/// dot product of two Autodesk.Revit.DB.XYZ as Matrix
/// </summary>
/// <param name="p1"></param>
/// <param name="p2"></param>
/// <returns></returns>
private static double DotMatrix(Autodesk.Revit.DB.XYZ p1, Autodesk.Revit.DB.XYZ p2)
{
double v1 = p1.X;
double v2 = p1.Y;
double v3 = p1.Z;
double u1 = p2.X;
double u2 = p2.Y;
double u3 = p2.Z;
double result = v1 * u1 + v2 * u2 + v3 * u3;
return result;
}
/// <summary>
/// judge whether the subtraction of two doubles is less than
/// the internal decided precision
/// </summary>
/// <param name="d1"></param>
/// <param name="d2"></param>
/// <returns></returns>
private static bool IsEqual(double d1, double d2)
{
double diff = Math.Abs(d1 - d2);
if (diff < PRECISION)
{
return true;
}
return false;
}
}
}
@@ -0,0 +1,90 @@
//
// (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.CreateSimpleAreaRein.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 GeoElement = Autodesk.Revit.DB.GeometryElement;
using Element = Autodesk.Revit.DB.Element;
/// <summary>
/// enum of AreaReinforcement's parameter Layout Rules
/// </summary>
public enum LayoutRules
{
Fixed_Number = 2,
Maximum_Spacing = 3
}
/// <summary>
/// contain utility methods find or set certain parameter
/// </summary>
public class 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 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;
}
para.Set(value);
return true;
}
}
}
@@ -0,0 +1,56 @@
//
// (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("CreateSimpleAreaReinforcement")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CreateSimpleAreaReinforcement")]
[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("20be0b7c-2316-4763-9863-4ae4b392b002")]
// 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")]