应用程序:NewRebar
Revit平台:框架结构
Revit版本:2011.0
首次发布于:2009.0
编程语言:C#
技能级别:高
分类:结构
类型:ExternalCommand
主题:创建钢筋和钢筋形状。
总结:本示例将演示如何通过 NewRebar (RebarShape rebarShape、RebarBarType rebarType、Element host、XYZ origin、XYZ xVec、XYZ yVec) 创建钢筋,并演示如何自定义 RebarShape(包括直线和弧形)。
类:
Autodesk.Revit.UI.IExternalCommand
Autodesk.Revit.Creation.Document
Autodesk.Revit.DB.FamilyInstance
Autodesk.Revit.DB.Structure.Rebar
Autodesk.Revit.DB.Structure.RebarShape
Autodesk.Revit.DB.Structure.RebarShapeDefinition
Autodesk.Revit.DB.Structure.RebarShapeDefinitionByArc
Autodesk.Revit.DB.Structure.RebarShapeDefinitionBySegments
Autodesk.Revit.DB.Structure.StructuralType
Autodesk.Revit.DB.Parameter
Autodesk.Revit.DB.DefinitionGroup
Autodesk.Revit.DB.ExternalDefinition
Autodesk.Revit.DB.Solid
项目文件:
Command.cs:这是示例的入口,它实现了 IExternalCommand 接口中的 Execute 方法。
RebarCreator.cs:此文件中定义了 RebarCreator 类,它封装了 Rebar 的创建。它的 "Execute" 方法显示用户的主要对话框,然后如果用户在主要对话框上单击 "OK" 按钮,则会创建 Rebar。
RebarShapeDef.cs:此文件中定义了 RebarShapeDef 类,它封装了 RebarShapeDefinition 对象。它将被两个类继承:RebarShapeDefByArc 和 RebarShapeDefBySegment。
RebarShapeDefByArc.cs:此文件中定义了 RebarShapeDefByArc 类,它封装了 RebarShapeDefinitionByArc 对象。
RebarShapeDefBySegment.cs:此文件中定义了 RebarShapeDefBySegment 类,它封装了 RebarShapeDefinitionBySegments 对象。
RebarShapeParameter.cs:此文件中定义了 RebarShapeParameter 类,它封装了将添加到 RebarShape 定义中的 Autodesk.Revit.Parameter 对象。这是一个抽象类,它将被两个类继承:RebarShapeParameterDouble 和 RebarShapeParameterFormula。
RebarShapeParameterDouble.cs:此文件中定义了 RebarShapeParameterDouble 类,它封装了将添加到 RebarShape 定义中的 double 参数。
RebarShapeParameterFormula.cs:此文件中定义了 RebarShapeParameterFormula 类,它封装了将添加到 RebarShape 定义中的公式参数。
ConstraintOnRebarShape.cs:此文件中定义了 ConstraintOnRebarShape 类,它封装了对 Rebar Shape 的约束。它将被两个类继承:ConstraintOnSegmentShape 和 ConstraintOnArcShape。
ConstraintOnSegmentShape.cs:该文件定义了一系列从 ConstraintOnSegmentShape 继承的类。每个类可以向 RebarShapeDefinitionBySegments 添加约束。
ConstraintOnArcShape.cs:该文件定义了一系列从 ConstraintOnArcShape 继承的类。每个类可以向 RebarShapeDefinitionByArc 添加约束。
GeometrySupport.cs:此文件中定义了 GeometrySupport 类,它可用于计算和存储几何信息。
GeomUtil.cs:此文件中定义了 GeomUtil 类,它提供基本的几何运算。
NewRebarForm.cs:此窗体是用户进行 Rebar 创建操作的主要入口。
NewRebarShapeForm.cs:此窗体提供给用户定义新的 RebarShape。
AddParameterForm.cs:此窗体提供给用户添加参数到 RebarShape 的入口。
AddConstraintForm.cs:此窗体提供给用户添加约束到 RebarShape 的入口。
描述:本示例将演示如何通过 NewRebar (RebarShape rebarShape、RebarBarType rebarType、Element host、XYZ origin、XYZ xVec、XYZ yVec) 创建钢筋,并演示如何自定义 RebarShape(包括直线和弧形)。本示例将涵盖 Rebar 的 ScaleToBox 和 SetLayoutRuleWithoutExaminingHost 方法以及 RebarShape 的几乎所有方法和属性。
说明:
1. 如何创建钢筋?
1) 打开或新建一个 Revit 项目,并确保放置了一些具有矩形形状但没有任何钢筋的混凝土横梁或柱子。示例项目文件 NewRebar.rvt 可在示例文件夹中找到。
2) 选择一个没有任何钢筋且具有矩形形状的混凝土横梁或柱子。
3) 调用此命令,主要对话框将显示出来。
4) 在主要对话框中,从 ComboBox 中选择 RebarShape 和 RebarBarType,然后单击 OK 按钮,钢筋将被创建在所选的梁或柱上。
2. 如何通过线段自定义钢筋形状?
1) 在主要对话框中,提供一个钢筋形状名称,单击“Segments”单选按钮并在文本框中输入段数,然后单击“Create Rebar Shape”按钮,将出现一个名为“Create RebarShape”的窗体。
2) 在“Create RebarShape”窗体中,可以添加参数和约束以自定义钢筋形状。单击“Add parameter”按钮将显示一个对话框以添加参数,单击“Add Constraint”按钮将显示一个对话框以添加约束。之后,参数或约束将在属性网格中显示出来,可以从属性网格中更改参数值和约束值。
3) 关于如何添加参数和约束,这里有一些建议:
a) 每个边必须有一个长度约束和一个方向约束。
b) 每个顶点必须有一个弯曲约束。
c) Listening 约束并非必要的。
4) 添加参数和约束后,单击 OK 按钮提交自定义钢筋形状。
3. 如何通过弧线自定义钢筋形状?
1) 在主要对话框中,提供一个钢筋形状名称,单击“Arc”单选按钮并从 ComboBox 中选择弧线类型,然后单击“Create rebar shape”按钮,将出现一个名为“Create RebarShape”的窗体。
2) 在“Create RebarShape”窗体中,可以添加参数和约束以自定义钢筋形状。单击“Add Parameter”按钮将显示一个对话框以添加参数,单击“Add Constraint”按钮将显示一个对话框以添加约束。之后,参数或约束将在属性网格中显示出来,可以从属性网格中更改参数值和约束值。
3) 添加参数和约束后,单击 OK 按钮提交自定义钢筋形状。
逐步自定义钢筋形状:
在“逐步自定义钢筋形状”文件夹中,有四个帮助文档,可帮助用户逐步自定义钢筋形状。
源代码
完整的源代码请加入QQ群649037449,在群文件中下载RevitSDK.exe,解压后在文件夹中搜索本文中应用程序名称即可获得完整源码
RebarCreator.cs
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using Autodesk.Revit.DB.Structure;
namespace Revit.SDK.Samples.NewRebar.CS
{
/// <summary>
/// This class wraps the creation of Rebar. Its "Execute" method shows
/// the main dialog for user and after that a Rebar will be created
/// if user click OK button on the main dialog.
/// </summary>
class RebarCreator
{
/// <summary>
/// Revit UI document
/// </summary>
Autodesk.Revit.UI.UIDocument m_rvtUIDoc;
/// <summary>
/// Revit FamilyInstance object, it will be the host of Rebar.
/// </summary>
FamilyInstance m_rebarHost;
/// <summary>
/// GeometrySupport object.
/// </summary>
GeometrySupport m_geometryData;
/// <summary>
/// Newly created Rebar.
/// </summary>
Rebar m_createdRebar = null;
/// <summary>
/// Constructor, initialize fields and do some assert.
/// If the Assert throw exception, creation will fail.
/// </summary>
/// <param name="commandData">ExternalCommandData</param>
public RebarCreator(ExternalCommandData commandData)
{
m_rvtUIDoc = commandData.Application.ActiveUIDocument;
Assert();
}
/// <summary>
/// Do some check for the selection elements, includes geometry check.
/// If the data doesn't meet our need, Exception will be thrown.
/// </summary>
private void Assert()
{
// Reserve all element ids for following iteration
List<ElementId> selectedIds = new List<ElementId>();
foreach (Autodesk.Revit.DB.ElementId elemId in m_rvtUIDoc.Selection.GetElementIds())
{
Autodesk.Revit.DB.Element elem = m_rvtUIDoc.Document.GetElement(elemId);
selectedIds.Add(elem.Id);
}
if (selectedIds.Count == 0)
throw new Exception("Please select a concrete beam or column to create rebar.");
//
// Construct filter to find expected rebar host
// Structural type filters firstly
LogicalOrFilter stFilter = new LogicalOrFilter(
new ElementStructuralTypeFilter(StructuralType.Beam),
new ElementStructuralTypeFilter(StructuralType.Column));
// + StructuralMaterial
LogicalAndFilter hostFilter = new LogicalAndFilter(stFilter,
new StructuralMaterialTypeFilter(StructuralMaterialType.Concrete));
// Expected rebar host: it should be family instance
FilteredElementCollector collector = new FilteredElementCollector(m_rvtUIDoc.Document, selectedIds);
FamilyInstance rebarHost = collector.OfClass(typeof(FamilyInstance)).WherePasses(hostFilter).FirstElement() as FamilyInstance;
// Make sure the selected beam or column is rectangular.
try
{
m_geometryData = new GeometrySupport(rebarHost);
}
catch
{
throw new Exception("Please select a beam or column in rectangular shape.");
}
m_rebarHost = rebarHost;
// Judge the rebar host is a valid host.
RebarHostData rebarHostData = RebarHostData.GetRebarHostData(rebarHost);
if (rebarHostData == null || !rebarHostData.IsValidHost())
{
throw new Exception("The selected element is not a valid rebar host.");
}
// Make sure the selected beam or column doesn't contain any rebar.
if (rebarHostData.GetRebarsInHost().Count > 0)
{
throw new Exception("Please select a beam or a column which doesn't contain any rebar.");
}
}
/// <summary>
/// Present the main dialog for user to prepare the parameters for Rebar creation,
/// and after that if user click the OK button, a new Rebar will be created.
/// </summary>
public void Execute()
{
using (NewRebarForm form = new NewRebarForm(m_rvtUIDoc.Document))
{
if (DialogResult.OK == form.ShowDialog())
{
RebarBarType barType = form.RebarBarType;
RebarShape barShape = form.RebarShape;
List<Autodesk.Revit.DB.XYZ> profilePoints = m_geometryData.ProfilePoints;
Autodesk.Revit.DB.XYZ origin = profilePoints[0];
Autodesk.Revit.DB.XYZ yVec = profilePoints[1] - origin;
Autodesk.Revit.DB.XYZ xVec = profilePoints[3] - origin;
m_createdRebar = Rebar.CreateFromRebarShape(m_rvtUIDoc.Document, barShape, barType, m_rebarHost, origin, xVec, yVec);
LayoutRebar();
}
}
}
/// <summary>
/// Move and Scale the created Rebar to specified box.
/// </summary>
private void LayoutRebar()
{
List<Autodesk.Revit.DB.XYZ> profilePoints = m_geometryData.OffsetPoints(0.1);
Autodesk.Revit.DB.XYZ origin = profilePoints[0];
Autodesk.Revit.DB.XYZ yVec = profilePoints[1] - origin;
Autodesk.Revit.DB.XYZ xVec = profilePoints[3] - origin;
RebarShapeDefinitionByArc arcDef =
(m_createdRebar.Document.GetElement(m_createdRebar.GetShapeId()) as RebarShape).GetRebarShapeDefinition() as RebarShapeDefinitionByArc;
RebarShapeDrivenAccessor rebarShapeDrivenAccessor = m_createdRebar.GetShapeDrivenAccessor();
if (arcDef != null && arcDef.Type == RebarShapeDefinitionByArcType.Spiral)
{
rebarShapeDrivenAccessor.ScaleToBoxFor3D(origin, xVec, yVec, 10.0);
rebarShapeDrivenAccessor.Height = m_geometryData.DrivingLength - 0.1;
rebarShapeDrivenAccessor.Pitch = 0.1;
rebarShapeDrivenAccessor.BaseFinishingTurns = 3;
rebarShapeDrivenAccessor.TopFinishingTurns = 3;
}
else
{
rebarShapeDrivenAccessor.ScaleToBox(origin, xVec, yVec);
double barSpacing = 0.1;
int barNum = (int)(m_geometryData.DrivingLength / barSpacing);
rebarShapeDrivenAccessor.SetLayoutAsNumberWithSpacing(
barNum, barSpacing, true, true, true);
}
}
}
}
RebarShapeDef.cs
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Text;
using Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Structure;
using System.Windows.Forms;
namespace Revit.SDK.Samples.NewRebar.CS
{
/// <summary>
/// This class wraps RebarShapeDefinition object.
/// </summary>
public abstract class RebarShapeDef
{
/// <summary>
/// RebarShape definition, the real object to be wrapped.
/// </summary>
protected RebarShapeDefinition m_rebarshapeDefinition;
/// <summary>
/// All the parameters will be added to RebarShapeDefinition.
/// </summary>
protected List<RebarShapeParameter> m_parameters;
/// <summary>
/// All the dimensions will be added to RebarShapeDefinition.
/// </summary>
protected List<ConstraintOnRebarShape> m_constraints;
/// <summary>
/// Return the real object RebarShapeDefinition.
/// </summary>
public RebarShapeDefinition RebarshapeDefinition
{
get { return m_rebarshapeDefinition; }
}
/// <summary>
/// Return all the parameters.
/// </summary>
public List<RebarShapeParameter> Parameters
{
get { return m_parameters; }
}
/// <summary>
/// Return all the dimensions.
/// </summary>
public List<ConstraintOnRebarShape> Constraints
{
get { return m_constraints; }
}
/// <summary>
/// Constructor, initialize the fields.
/// </summary>
/// <param name="shapeDef">RebarShapeDefinition object to be wrapped</param>
public RebarShapeDef(RebarShapeDefinition shapeDef)
{
m_rebarshapeDefinition = shapeDef;
m_parameters = new List<RebarShapeParameter>();
m_constraints = new List<ConstraintOnRebarShape>();
}
/// <summary>
/// Add a parameter to RebarShapeDefinition.
/// </summary>
/// <param name="parameterType">Parameter type:
/// (type of RebarShapeParameterDouble or type of RebarShapeParameterFormula)</param>
/// <param name="name">Parameter name</param>
/// <param name="value">Parameter value (double value or formula string)</param>
/// <returns></returns>
public RebarShapeParameter AddParameter(Type parameterType, object name, object value)
{
RebarShapeParameter param =
Activator.CreateInstance(parameterType, this, name, value) as RebarShapeParameter;
m_parameters.Add(param);
return param;
}
/// <summary>
/// Add a constraint to RebarShapeDefinition.
/// </summary>
/// <param name="constraintType">Type of constraint
/// (the class must be subclass of ConstraintOnRebarShape).</param>
/// <returns></returns>
public ConstraintOnRebarShape AddConstraint(Type constraintType)
{
ConstraintOnRebarShape constraintIns =
Activator.CreateInstance(constraintType, this) as ConstraintOnRebarShape;
m_constraints.Add(constraintIns);
return constraintIns;
}
/// <summary>
/// Submit RebarShapeDefinition. All the parameters and constraints
/// will be added to RebarShape. The RebarShape will be added to Revit document after
/// successfully submitted.
/// </summary>
/// <param name="defGroup">Parameter definition group</param>
public void Commit(Document rvtDoc, DefinitionGroup defGroup)
{
// Submit all the parameters.
foreach (RebarShapeParameter param in m_parameters)
{
param.Commit(rvtDoc, defGroup);
}
// Submit all the constraints.
foreach (ConstraintOnRebarShape constraint in m_constraints)
{
constraint.Commit();
}
// Submit the RebarShape.
if (m_rebarshapeDefinition.Complete)
{
m_rebarshapeDefinition.CheckDefaultParameterValues(0, 0);
}
else
{
throw new Exception("The Rebar shape definition is not completed.");
}
}
/// <summary>
/// Return all the parameter types supported by RebarShape definition.
/// </summary>
/// <returns>All the parameter types supported by RebarShape definition</returns>
public List<Type> AllParameterTypes()
{
List<Type> types = new List<Type>();
types.Add(typeof(RebarShapeParameterDouble));
types.Add(typeof(RebarShapeParameterFormula));
return types;
}
/// <summary>
/// Return all the constraint types supported by RebarShapeDefinition.
/// </summary>
/// <returns>all the constraint types supported by RebarShapeDefinition</returns>
public virtual List<Type> AllowedConstraintTypes()
{
return new List<Type>();
}
}
}
RebarShapeDefByArc.cs
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Text;
using Autodesk.Revit.DB.Structure;
namespace Revit.SDK.Samples.NewRebar.CS
{
/// <summary>
/// This class wraps RebarShapeDefinitionByArc.
/// </summary>
class RebarShapeDefByArc : RebarShapeDef
{
public RebarShapeDefByArc(RebarShapeDefinitionByArc arcShapeDef)
: base(arcShapeDef)
{
}
/// <summary>
/// Get all the constraint types supported by RebarShapeDefinitionByArc.
/// </summary>
/// <returns>all the constraint types supported by RebarShapeDefinitionByArc</returns>
public override List<Type> AllowedConstraintTypes()
{
RebarShapeDefinitionByArc definitionByArc = RebarshapeDefinition as RebarShapeDefinitionByArc;
List<Type> allowedTypes = base.AllowedConstraintTypes();
allowedTypes.Add(typeof(ConstraintRadius));
allowedTypes.Add(typeof(ConstraintDiameter));
allowedTypes.Add(typeof(ConstraintArcLength));
allowedTypes.Add(typeof(ConstraintCircumference));
allowedTypes.Add(typeof(ConstraintChordLength));
allowedTypes.Add(typeof(ConstraintSagittaLength));
return allowedTypes;
}
}
}
RebarShapeDefBySegment.cs
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Text;
using Autodesk.Revit.DB.Structure;
namespace Revit.SDK.Samples.NewRebar.CS
{
/// <summary>
/// This class wraps RebarShapeDefinitionBySegments.
/// </summary>
class RebarShapeDefBySegment : RebarShapeDef
{
public RebarShapeDefBySegment(RebarShapeDefinitionBySegments segmentShapeDef)
:base(segmentShapeDef)
{
}
/// <summary>
/// Get all the constraints supported by RebarShapeDefinitionBySegments.
/// </summary>
/// <returns>all the constraints supported by RebarShapeDefinitionBySegments</returns>
public override List<Type> AllowedConstraintTypes()
{
List<Type> allowedTypes = base.AllowedConstraintTypes();
allowedTypes.Add(typeof(ConstraintBendDefaultRadius));
allowedTypes.Add(typeof(ConstraintBendVariableRadius));
allowedTypes.Add(typeof(ConstraintParallelToSegment));
allowedTypes.Add(typeof(ConstraintToSegment));
allowedTypes.Add(typeof(ListeningDimensionBendToBend));
allowedTypes.Add(typeof(ListeningDimensionSegmentToBend));
allowedTypes.Add(typeof(ListeningDimensionSegmentToSegment));
allowedTypes.Add(typeof(RemoveParameterFromSegment));
allowedTypes.Add(typeof(SetSegmentAs180DegreeBend));
allowedTypes.Add(typeof(SetSegmentFixedDirection));
allowedTypes.Add(typeof(SetSegmentVariableDirection));
return allowedTypes;
}
}
}
RebarShapeParameter.cs
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Text;
using Autodesk.Revit;
using Autodesk.Revit.DB;
using System.ComponentModel;
namespace Revit.SDK.Samples.NewRebar.CS
{
/// <summary>
/// This class wraps an Parameter object which will be added
/// to RebarShape definition. This is a abstract class and it will be inherited
/// by two classes: RebarShapeParameterDouble and RebarShapeParameterFormula.
/// </summary>
public abstract class RebarShapeParameter
{
/// <summary>
/// Parameter id. It is the result of commit.
/// </summary>
protected ElementId m_parameterId;
/// <summary>
/// RebarShape definition proxy object.
/// </summary>
protected RebarShapeDef m_rebarShapeDef;
/// <summary>
/// Parameter name string.
/// </summary>
protected String m_name;
/// <summary>
/// Constructor.
/// </summary>
/// <param name="shapeDef">RebarShapeDefinition proxy</param>
/// <param name="name">Parameter name</param>
protected RebarShapeParameter(RebarShapeDef shapeDef, string name)
{
m_rebarShapeDef = shapeDef;
m_name = name;
m_parameterId = null;
}
/// <summary>
/// Parameter, it is the result of commit.
/// </summary>
[Browsable(false)]
public ElementId Parameter
{
get { return m_parameterId; }
}
/// <summary>
/// Parameter name string.
/// </summary>
public String Name
{
get { return m_name; }
}
/// <summary>
/// Get a external definition if there exists one, otherwise create a new one.
/// </summary>
/// <param name="group">Definition group</param>
/// <returns>External definition</returns>
protected ExternalDefinition GetOrCreateDef(DefinitionGroup group)
{
ExternalDefinition Bdef =
group.Definitions.get_Item(m_name) as ExternalDefinition;
if (Bdef == null)
{
ExternalDefinitionCreationOptions ExternalDefinitionCreationOptions = new ExternalDefinitionCreationOptions(m_name, ParameterType.ReinforcementLength);
Bdef = group.
Definitions.Create(ExternalDefinitionCreationOptions) as ExternalDefinition;
}
return Bdef;
}
/// <summary>
/// Yield the Parameter.
/// </summary>
/// <param name="defGroup">Definition group</param>
public abstract void Commit(Autodesk.Revit.DB.Document doc, DefinitionGroup defGroup);
}
}
RebarShapeParameterDouble.cs
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Text;
using Autodesk.Revit.DB;
namespace Revit.SDK.Samples.NewRebar.CS
{
/// <summary>
/// This class wraps a double parameter which will be the dimension of
/// RebarShape definition.
/// </summary>
class RebarShapeParameterDouble : RebarShapeParameter
{
/// <summary>
/// Parameter double value.
/// </summary>
private Double m_value;
/// <summary>
/// Parameter double value.
/// </summary>
public Double Value
{
get { return m_value; }
set { m_value = value; }
}
/// <summary>
/// Constructor.
/// </summary>
/// <param name="shapeDef">RebarShapeDefinition proxy</param>
/// <param name="name">Parameter name</param>
/// <param name="value">Parameter double value</param>
public RebarShapeParameterDouble(RebarShapeDef shapeDef, String name, Double value)
: base(shapeDef, name)
{
m_value = value;
}
/// <summary>
/// Add a double parameter to RebarShapeDefinition.
/// </summary>
/// <param name="defGroup">Definition group</param>
public override void Commit(Autodesk.Revit.DB.Document doc, DefinitionGroup defGroup)
{
ExternalDefinition def = GetOrCreateDef(defGroup);
m_parameterId = Autodesk.Revit.DB.Structure.RebarShapeParameters.GetOrCreateElementIdForExternalDefinition(doc, def);
m_rebarShapeDef.RebarshapeDefinition.AddParameter(m_parameterId, m_value);
}
}
}
RebarShapeParameterFormula.cs
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Text;
using Autodesk.Revit.DB;
namespace Revit.SDK.Samples.NewRebar.CS
{
/// <summary>
/// This class wraps a formula parameter which will be the dimension of
/// RebarShape definition.
/// </summary>
class RebarShapeParameterFormula : RebarShapeParameter
{
/// <summary>
/// Parameter formula sting.
/// </summary>
private string m_formula;
/// <summary>
/// Parameter formula sting.
/// </summary>
public string Formula
{
get { return m_formula; }
set { m_formula = value; }
}
/// <summary>
/// Constructor.
/// </summary>
/// <param name="shapeDef">RebarShapeDefinition proxy</param>
/// <param name="name">Parameter name</param>
/// <param name="formula">Parameter formula sting</param>
public RebarShapeParameterFormula(RebarShapeDef shapeDef, string name, string formula)
:base(shapeDef,name)
{
m_formula = formula;
}
/// <summary>
/// Add a formula parameter to RebarShapeDefinition.
/// </summary>
/// <param name="defGroup">Definition group</param>
public override void Commit(Autodesk.Revit.DB.Document doc, DefinitionGroup defGroup)
{
ExternalDefinition def = GetOrCreateDef(defGroup);
m_parameterId = Autodesk.Revit.DB.Structure.RebarShapeParameters.GetOrCreateElementIdForExternalDefinition(doc, def);
m_rebarShapeDef.RebarshapeDefinition.AddFormulaParameter(m_parameterId, m_formula);
}
}
}
ConstraintOnRebarShape.cs
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Text;
using Autodesk.Revit;
using System.ComponentModel;
namespace Revit.SDK.Samples.NewRebar.CS
{
/// <summary>
/// Dimension on RebarShape.
/// </summary>
public abstract class ConstraintOnRebarShape
{
/// <summary>
/// A wrapper of RebarShapeDefinition.
/// </summary>
protected RebarShapeDef m_shapeDef;
/// <summary>
/// Constructor, initialize fields.
/// </summary>
/// <param name="def">RebarShapeDef object</param>
protected ConstraintOnRebarShape(RebarShapeDef def)
{
m_shapeDef = def;
}
/// <summary>
/// Update the parameter list value for property grid.
/// </summary>
protected void UpdateParameterTypeConverter()
{
TypeConverterRebarShapeParameter.RebarShapeParameters = m_shapeDef.Parameters;
}
/// <summary>
/// Name of the constraint.
/// </summary>
public String Name
{
get
{
return this.GetType().Name;
}
}
/// <summary>
/// Commit the dimension.
/// </summary>
public abstract void Commit();
}
}
ConstraintOnSegmentShape.cs
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using Autodesk.Revit.DB.Structure;
namespace Revit.SDK.Samples.NewRebar.CS
{
/// <summary>
/// Segment's ends reference enum.
/// </summary>
enum EndReference
{
/// <summary>
/// Segment's start reference.
/// </summary>
Begin = 0,
/// <summary>
/// Segment's end reference.
/// </summary>
End = 1
}
/// <summary>
/// Constraint to be added to RebarShapeDefBySegment.
/// </summary>
abstract class ConstraintOnSegmentShape : ConstraintOnRebarShape
{
public ConstraintOnSegmentShape(RebarShapeDefBySegment def)
: base(def)
{
}
/// <summary>
/// Update list value for property grid.
/// </summary>
protected void UpdateSegmentIdTypeConverter()
{
TypeConverterSegmentId.SegmentCount = GetRebarShapeDefinitionBySegments.NumberOfSegments;
}
/// <summary>
/// Get RebarShapeDefinitionBySegments object.
/// </summary>
protected RebarShapeDefinitionBySegments GetRebarShapeDefinitionBySegments
{
get
{
return m_shapeDef.RebarshapeDefinition as RebarShapeDefinitionBySegments;
}
}
}
/// <summary>
/// Default radius dimension of bend.
/// </summary>
class ConstraintBendDefaultRadius : ConstraintOnSegmentShape
{
/// <summary>
/// Segment to be added constraint on.
/// </summary>
private int m_segment;
/// <summary>
/// Bend orientation field.
/// </summary>
private RebarShapeVertexTurn m_turn;
/// <summary>
/// Bend angle field.
/// </summary>
private RebarShapeBendAngle m_bendAngle;
/// <summary>
/// Constructor
/// </summary>
/// <param name="def"></param>
public ConstraintBendDefaultRadius(RebarShapeDefBySegment def)
: base(def)
{
m_turn = RebarShapeVertexTurn.Left;
m_bendAngle = RebarShapeBendAngle.Obtuse;
}
/// <summary>
/// Segment to be added constraint on.
/// </summary>
[TypeConverter(typeof(TypeConverterSegmentId))]
public int Segment
{
get
{
UpdateSegmentIdTypeConverter();
return m_segment;
}
set
{
m_segment = value;
}
}
/// <summary>
/// Bend orientation property.
/// </summary>
public RebarShapeVertexTurn Turn
{
get
{
return m_turn;
}
set
{
m_turn = value;
}
}
/// <summary>
/// Bend angle property.
/// </summary>
public RebarShapeBendAngle BendAngle
{
get
{
return m_bendAngle;
}
set
{
m_bendAngle = value;
}
}
/// <summary>
/// Add bend default radius constraint to RebarShapeDefinitionBySegments.
/// </summary>
public override void Commit()
{
GetRebarShapeDefinitionBySegments.AddBendDefaultRadius(
m_segment, m_turn, m_bendAngle);
}
}
/// <summary>
/// Variable radius dimension of bend.
/// </summary>
class ConstraintBendVariableRadius : ConstraintOnSegmentShape
{
/// <summary>
/// Segment to be added constraint on.
/// </summary>
private int m_segment;
/// <summary>
/// Bend orientation field.
/// </summary>
private RebarShapeVertexTurn m_turn;
/// <summary>
/// Bend angle field.
/// </summary>
private RebarShapeBendAngle m_bendAngle;
/// <summary>
/// Radius dimension field.
/// </summary>
private RebarShapeParameter m_radiusParameter;
/// <summary>
/// Measure length including bar thickness or not.
/// </summary>
private bool m_measureIncludingBarThickness;
public ConstraintBendVariableRadius(RebarShapeDefBySegment def)
: base(def)
{
m_bendAngle = RebarShapeBendAngle.Obtuse;
m_turn = RebarShapeVertexTurn.Left;
m_measureIncludingBarThickness = true;
}
/// <summary>
/// Segment to be added constraint on.
/// </summary>
[TypeConverter(typeof(TypeConverterSegmentId))]
public int Segment
{
get
{
UpdateSegmentIdTypeConverter();
return m_segment;
}
set
{
m_segment = value;
}
}
/// <summary>
/// Bend orientation property.
/// </summary>
public RebarShapeVertexTurn Turn
{
get { return m_turn; }
set { m_turn = value; }
}
/// <summary>
/// Bend angle property.
/// </summary>
public RebarShapeBendAngle BendAngle
{
get { return m_bendAngle; }
set { m_bendAngle = value; }
}
/// <summary>
/// Radius dimension property.
/// </summary>
[TypeConverter(typeof(TypeConverterRebarShapeParameter))]
public RebarShapeParameter RadiusParameter
{
get
{
UpdateParameterTypeConverter();
return m_radiusParameter;
}
set
{
m_radiusParameter = value;
}
}
/// <summary>
/// Measure including bar thickness or not.
/// </summary>
public bool MeasureIncludingBarThickness
{
get
{
return m_measureIncludingBarThickness;
}
set
{
m_measureIncludingBarThickness = value;
}
}
/// <summary>
/// Add Dimension to constrain the bend radius.
/// </summary>
public override void Commit()
{
GetRebarShapeDefinitionBySegments.AddBendVariableRadius(
m_segment, m_turn, m_bendAngle, m_radiusParameter.Parameter,
m_measureIncludingBarThickness);
}
}
/// <summary>
/// Parallel dimension to segment.
/// </summary>
class ConstraintParallelToSegment : ConstraintOnSegmentShape
{
/// <summary>
/// Segment to be added constraint on.
/// </summary>
private int m_segment;
/// <summary>
/// Dimension to constrain the length of segment.
/// </summary>
private RebarShapeParameter m_parameter;
/// <summary>
/// Measure segment's length to outside of bend 0 or not.
/// </summary>
private bool m_measureToOutsideOfBend0;
/// <summary>
/// Measure segment's length to outside of bend 1 or not.
/// </summary>
private bool m_measureToOutsideOfBend1;
/// <summary>
/// Constructor
/// </summary>
/// <param name="def"></param>
public ConstraintParallelToSegment(RebarShapeDefBySegment def)
: base(def)
{
m_measureToOutsideOfBend0 = true;
m_measureToOutsideOfBend1 = true;
}
/// <summary>
/// Segment to be added constraint on.
/// </summary>
[TypeConverter(typeof(TypeConverterSegmentId))]
public int Segment
{
get
{
UpdateSegmentIdTypeConverter();
return m_segment;
}
set
{
m_segment = value;
}
}
/// <summary>
/// Dimension to constrain the length of segment.
/// </summary>
[TypeConverter(typeof(TypeConverterRebarShapeParameter))]
public RebarShapeParameter Parameter
{
get
{
UpdateParameterTypeConverter();
return m_parameter;
}
set { m_parameter = value; }
}
/// <summary>
/// Measure segment's length to outside of bend 0 or not.
/// </summary>
public bool MeasureToOutsideOfBend0
{
get { return m_measureToOutsideOfBend0; }
set { m_measureToOutsideOfBend0 = value; }
}
/// <summary>
/// Measure segment's length to outside of bend 1 or not.
/// </summary>
public bool MeasureToOutsideOfBend1
{
get { return m_measureToOutsideOfBend1; }
set { m_measureToOutsideOfBend1 = value; }
}
/// <summary>
/// Add Dimension to constrain the segment length.
/// </summary>
public override void Commit()
{
GetRebarShapeDefinitionBySegments.AddConstraintParallelToSegment(
m_segment, m_parameter.Parameter, m_measureToOutsideOfBend0,
m_measureToOutsideOfBend1);
}
}
/// <summary>
/// Length dimension of segment in specified direction.
/// </summary>
class ConstraintToSegment : ConstraintOnSegmentShape
{
/// <summary>
/// Segment to be added constraint on.
/// </summary>
private int m_segment;
/// <summary>
/// Dimension to constraint the length of segment in specified direction.
/// </summary>
private RebarShapeParameter m_parameter;
/// <summary>
/// X coordinate of constraint direction.
/// </summary>
private double m_constraintDirCoordX;
/// <summary>
/// Y coordinate of constraint direction.
/// </summary>
private double m_constraintDirCoordY;
/// <summary>
/// Sign of Z coordinate of cross product of constraint direction by segment direction.
/// </summary>
private int m_signOfZCoordOfCrossProductOfConstraintDirBySegmentDir;
/// <summary>
/// Measure segment's length to outside of bend 0 or not.
/// </summary>
private bool m_measureToOutsideOfBend0;
/// <summary>
/// Measure segment's length to outside of bend 1 or not.
/// </summary>
private bool m_measureToOutsideOfBend1;
public ConstraintToSegment(RebarShapeDefBySegment def)
: base(def)
{
m_measureToOutsideOfBend0 = true;
m_measureToOutsideOfBend1 = false;
m_signOfZCoordOfCrossProductOfConstraintDirBySegmentDir = -1;
}
/// <summary>
/// Segment to be added constraint on.
/// </summary>
[TypeConverter(typeof(TypeConverterSegmentId))]
public int Segment
{
get
{
UpdateSegmentIdTypeConverter();
return m_segment;
}
set
{
m_segment = value;
}
}
/// <summary>
/// Dimension to constraint the length of segment in specified direction.
/// </summary>
[TypeConverter(typeof(TypeConverterRebarShapeParameter))]
public RebarShapeParameter Parameter
{
get
{
UpdateParameterTypeConverter();
return m_parameter;
}
set { m_parameter = value; }
}
/// <summary>
/// X coordinate of constraint direction.
/// </summary>
public double ConstraintDirCoordX
{
get { return m_constraintDirCoordX; }
set { m_constraintDirCoordX = value; }
}
/// <summary>
/// Y coordinate of constraint direction.
/// </summary>
public double ConstraintDirCoordY
{
get { return m_constraintDirCoordY; }
set { m_constraintDirCoordY = value; }
}
/// <summary>
/// Sign of Z coordinate of cross product of constraint direction by segment direction.
/// </summary>
public int SignOfZCoordOfCrossProductOfConstraintDirBySegmentDir
{
get { return m_signOfZCoordOfCrossProductOfConstraintDirBySegmentDir; }
set { m_signOfZCoordOfCrossProductOfConstraintDirBySegmentDir = value; }
}
/// <summary>
/// Measure segment's length to outside of bend 0 or not.
/// </summary>
public bool MeasureToOutsideOfBend0
{
get { return m_measureToOutsideOfBend0; }
set { m_measureToOutsideOfBend0 = value; }
}
/// <summary>
/// Measure segment's length to outside of bend 1 or not.
/// </summary>
public bool MeasureToOutsideOfBend1
{
get { return m_measureToOutsideOfBend1; }
set { m_measureToOutsideOfBend1 = value; }
}
/// <summary>
/// Add dimension to constrain the length of segment in the specified direction.
/// </summary>
public override void Commit()
{
GetRebarShapeDefinitionBySegments.AddConstraintToSegment(m_segment,
m_parameter.Parameter, m_constraintDirCoordX, m_constraintDirCoordY,
m_signOfZCoordOfCrossProductOfConstraintDirBySegmentDir,
m_measureToOutsideOfBend0, m_measureToOutsideOfBend1);
}
}
/// <summary>
/// Listening length dimension between two bends.
/// </summary>
class ListeningDimensionBendToBend : ConstraintOnSegmentShape
{
/// <summary>
/// Dimension to constraint the length of two bends in the specified direction.
/// </summary>
private RebarShapeParameter m_parameter;
/// <summary>
/// X coordinate of constraint direction.
/// </summary>
private double m_constraintDirCoordX;
/// <summary>
/// Y coordinate of constraint direction.
/// </summary>
private double m_constraintDirCoordY;
/// <summary>
/// Reference of segment 0.
/// </summary>
private int m_segment;
/// <summary>
/// End reference of segment 0.
/// </summary>
private EndReference m_end;
/// <summary>
/// Reference of segment 1.
/// </summary>
private int m_segment1;
/// <summary>
/// End reference of segment 1.
/// </summary>
private EndReference m_end1;
public ListeningDimensionBendToBend(RebarShapeDefBySegment def)
: base(def)
{
m_end = EndReference.Begin;
m_end1 = EndReference.End;
m_constraintDirCoordX = 0;
m_constraintDirCoordY = 0;
}
/// <summary>
/// Dimension to constraint the length of two bends in the specified direction.
/// </summary>
[TypeConverter(typeof(TypeConverterRebarShapeParameter))]
public RebarShapeParameter Parameter
{
get
{
UpdateParameterTypeConverter();
return m_parameter;
}
set { m_parameter = value; }
}
/// <summary>
/// X coordinate of constraint direction.
/// </summary>
public double ConstraintDirCoordX
{
get { return m_constraintDirCoordX; }
set { m_constraintDirCoordX = value; }
}
/// <summary>
/// Y coordinate of constraint direction.
/// </summary>
public double ConstraintDirCoordY
{
get { return m_constraintDirCoordY; }
set { m_constraintDirCoordY = value; }
}
/// <summary>
/// Reference of segment 0.
/// </summary>
[TypeConverter(typeof(TypeConverterSegmentId))]
public int Segment0
{
get
{
UpdateSegmentIdTypeConverter();
return m_segment;
}
set
{
m_segment = value;
}
}
/// <summary>
/// End reference of segment 0.
/// </summary>
public EndReference End0
{
get { return m_end; }
set { m_end = value; }
}
/// <summary>
/// Reference of segment 1.
/// </summary>
[TypeConverter(typeof(TypeConverterSegmentId))]
public int Segment1
{
get
{
UpdateSegmentIdTypeConverter();
return m_segment1;
}
set { m_segment1 = value; }
}
/// <summary>
/// End reference of segment 1.
/// </summary>
public EndReference End1
{
get { return m_end1; }
set { m_end1 = value; }
}
/// <summary>
/// Add listening dimension to constrain the length of two bend in the specified direction.
/// </summary>
public override void Commit()
{
GetRebarShapeDefinitionBySegments.AddListeningDimensionBendToBend(
m_parameter.Parameter, m_constraintDirCoordX, m_constraintDirCoordY,
m_segment, (int)m_end, m_segment1, (int)m_end1);
}
}
/// <summary>
/// Listening length dimension between a segment and a bend.
/// </summary>
class ListeningDimensionSegmentToBend : ConstraintOnSegmentShape
{
/// <summary>
/// Dimension to constrain the length between a segment and a bend
/// in the specified direction.
/// </summary>
private RebarShapeParameter m_parameter;
/// <summary>
/// X coordinate of constraint direction.
/// </summary>
private double m_constraintDirCoordX;
/// <summary>
/// Y coordinate of constraint direction.
/// </summary>
private double m_constraintDirCoordY;
/// <summary>
/// Reference of segment 0.
/// </summary>
private int m_segment;
/// <summary>
/// Reference of segment 1.
/// </summary>
private int m_segment1;
/// <summary>
/// End reference of segment 1.
/// </summary>
private EndReference m_end1;
public ListeningDimensionSegmentToBend(RebarShapeDefBySegment def)
: base(def)
{
m_constraintDirCoordX = 0;
m_constraintDirCoordY = 0;
m_end1 = EndReference.End;
}
/// <summary>
/// Dimension to constrain the length between a segment and a bend
/// in the specified direction.
/// </summary>
[TypeConverter(typeof(TypeConverterRebarShapeParameter))]
public RebarShapeParameter Parameter
{
get
{
UpdateParameterTypeConverter();
return m_parameter;
}
set
{
m_parameter = value;
}
}
/// <summary>
/// X coordinate of constraint direction.
/// </summary>
public double ConstraintDirCoordX
{
get
{
return m_constraintDirCoordX;
}
set
{
m_constraintDirCoordX = value;
}
}
/// <summary>
/// Y coordinate of constraint direction.
/// </summary>
public double ConstraintDirCoordY
{
get
{
return m_constraintDirCoordY;
}
set
{
m_constraintDirCoordY = value;
}
}
/// <summary>
/// Reference of segment 0.
/// </summary>
[TypeConverter(typeof(TypeConverterSegmentId))]
public int Segment0
{
get
{
UpdateSegmentIdTypeConverter();
return m_segment;
}
set { m_segment = value; }
}
/// <summary>
/// Reference of segment 1.
/// </summary>
[TypeConverter(typeof(TypeConverterSegmentId))]
public int Segment1
{
get
{
UpdateSegmentIdTypeConverter();
return m_segment1;
}
set { m_segment1 = value; }
}
/// <summary>
/// End reference of segment 1.
/// </summary>
public EndReference End1
{
get { return m_end1; }
set { m_end1 = value; }
}
/// <summary>
/// Add listening dimension to constrain the length between a segment and a bend
/// in the specified direction.
/// </summary>
public override void Commit()
{
GetRebarShapeDefinitionBySegments.AddListeningDimensionSegmentToBend(
m_parameter.Parameter, m_constraintDirCoordX, m_constraintDirCoordY,
m_segment, m_segment1, (int)m_end1);
}
}
/// <summary>
/// Listening length dimension between two segments.
/// </summary>
class ListeningDimensionSegmentToSegment : ConstraintOnSegmentShape
{
/// <summary>
/// Dimension to constrain the perpendicular distance between two segment.
/// The two segment should be parallel.
/// </summary>
private RebarShapeParameter m_parameter;
/// <summary>
/// X coordinate of constraint direction.
/// </summary>
private double m_constraintDirCoordX;
/// <summary>
/// Y coordinate of constraint direction.
/// </summary>
private double m_constraintDirCoordY;
/// <summary>
/// The first segment to be constrained.
/// </summary>
private int m_segment;
/// <summary>
/// The second segment to be constrained.
/// </summary>
private int m_segment1;
public ListeningDimensionSegmentToSegment(RebarShapeDefBySegment def)
: base(def)
{
m_constraintDirCoordX = 1;
m_constraintDirCoordY = 0;
}
/// <summary>
/// Dimension to constrain the perpendicular distance between two segment.
/// </summary>
[TypeConverter(typeof(TypeConverterRebarShapeParameter))]
public RebarShapeParameter Parameter
{
get
{
UpdateParameterTypeConverter();
return m_parameter;
}
set
{
m_parameter = value;
}
}
/// <summary>
/// X coordinate of constraint direction.
/// </summary>
public double ConstraintDirCoordX
{
get
{
return m_constraintDirCoordX;
}
set
{
m_constraintDirCoordX = value;
}
}
/// <summary>
/// Y coordinate of constraint direction.
/// </summary>
public double ConstraintDirCoordY
{
get
{
return m_constraintDirCoordY;
}
set
{
m_constraintDirCoordY = value;
}
}
/// <summary>
/// The second segment to be constrained.
/// </summary>
[TypeConverter(typeof(TypeConverterSegmentId))]
public int Segment0
{
get
{
UpdateSegmentIdTypeConverter();
return m_segment;
}
set { m_segment = value; }
}
/// <summary>
/// The second segment to be constrained.
/// </summary>
[TypeConverter(typeof(TypeConverterSegmentId))]
public int Segment1
{
get
{
UpdateSegmentIdTypeConverter();
return m_segment1;
}
set { m_segment1 = value; }
}
/// <summary>
/// Add dimension to constrain the perpendicular distance between two segment.
/// </summary>
public override void Commit()
{
GetRebarShapeDefinitionBySegments.AddListeningDimensionSegmentToSegment(
m_parameter.Parameter, m_constraintDirCoordX, m_constraintDirCoordY,
m_segment, m_segment1);
}
}
/// <summary>
/// Remove a dimension from a segment.
/// </summary>
class RemoveParameterFromSegment : ConstraintOnSegmentShape
{
/// <summary>
/// Reference of segment.
/// </summary>
private int m_segment;
/// <summary>
/// Dimension to be removed.
/// </summary>
private RebarShapeParameter m_radiusParameter;
public RemoveParameterFromSegment(RebarShapeDefBySegment def)
: base(def)
{
}
/// <summary>
/// Reference of segment.
/// </summary>
[TypeConverter(typeof(TypeConverterSegmentId))]
public int Segment
{
get
{
UpdateSegmentIdTypeConverter();
return m_segment;
}
set
{
m_segment = value;
}
}
/// <summary>
/// Dimension to be removed.
/// </summary>
[TypeConverter(typeof(TypeConverterRebarShapeParameter))]
public RebarShapeParameter RadiusParameter
{
get
{
UpdateParameterTypeConverter();
return m_radiusParameter;
}
set
{
m_radiusParameter = value;
}
}
/// <summary>
/// Remove dimension from Rebar shape.
/// </summary>
public override void Commit()
{
GetRebarShapeDefinitionBySegments.RemoveParameterFromSegment(
m_segment, m_radiusParameter.Parameter);
}
}
/// <summary>
/// A 180 degree bend dimension.
/// </summary>
class SetSegmentAs180DegreeBend : ConstraintOnSegmentShape
{
/// <summary>
/// Reference of segment.
/// </summary>
private int m_segment;
/// <summary>
/// Dimension to constrain the bend's radius.
/// </summary>
private RebarShapeParameter m_radiusParameter;
/// <summary>
/// If measure to outside of bend.
/// </summary>
private bool m_measureToOutsideOfBend;
public SetSegmentAs180DegreeBend(RebarShapeDefBySegment def)
: base(def)
{
m_measureToOutsideOfBend = true;
}
/// <summary>
/// Reference of segment.
/// </summary>
[TypeConverter(typeof(TypeConverterSegmentId))]
public int Segment
{
get
{
UpdateSegmentIdTypeConverter();
return m_segment;
}
set
{
m_segment = value;
}
}
/// <summary>
/// Dimension to constrain the bend's radius.
/// </summary>
[TypeConverter(typeof(TypeConverterRebarShapeParameter))]
public RebarShapeParameter RadiusParameter
{
get
{
UpdateParameterTypeConverter();
return m_radiusParameter;
}
set { m_radiusParameter = value; }
}
/// <summary>
/// If measure the length to outside of bend.
/// </summary>
public bool MeasureToOutsideOfBend
{
get { return m_measureToOutsideOfBend; }
set { m_measureToOutsideOfBend = value; }
}
/// <summary>
/// Add a dimension of 180 degree bend for a segment.
/// </summary>
public override void Commit()
{
GetRebarShapeDefinitionBySegments.SetSegmentAs180DegreeBend(
m_segment, m_radiusParameter.Parameter, m_measureToOutsideOfBend);
}
}
/// <summary>
/// Length dimension of segment in its parallel direction.
/// </summary>
class SetSegmentFixedDirection : ConstraintOnSegmentShape
{
/// <summary>
/// Reference of segment.
/// </summary>
private int m_segment;
/// <summary>
/// X coordinate of constraint direction.
/// </summary>
private double m_vecCoordX;
/// <summary>
/// Y coordinate of constraint direction.
/// </summary>
private double m_vecCoordY;
public SetSegmentFixedDirection(RebarShapeDefBySegment def)
: base(def)
{
m_vecCoordX = 1;
m_vecCoordY = 0;
}
/// <summary>
/// Reference of segment.
/// </summary>
[TypeConverter(typeof(TypeConverterSegmentId))]
public int Segment
{
get
{
UpdateSegmentIdTypeConverter();
return m_segment;
}
set
{
m_segment = value;
}
}
/// <summary>
/// X coordinate of constraint direction.
/// </summary>
public double VecCoordX
{
get
{
return m_vecCoordX;
}
set
{
m_vecCoordX = value;
}
}
/// <summary>
/// Y coordinate of constraint direction.
/// </summary>
public double VecCoordY
{
get
{
return m_vecCoordY;
}
set
{
m_vecCoordY = value;
}
}
/// <summary>
/// Add dimension to constrain the direction of the segment.
/// </summary>
public override void Commit()
{
GetRebarShapeDefinitionBySegments.SetSegmentFixedDirection(
m_segment, m_vecCoordX, m_vecCoordY);
}
}
/// <summary>
/// Remove a dimension from a segment.
/// </summary>
class SetSegmentVariableDirection : ConstraintOnSegmentShape
{
/// <summary>
/// Reference of segment.
/// </summary>
private int m_segment;
public SetSegmentVariableDirection(RebarShapeDefBySegment def)
: base(def)
{
}
/// <summary>
/// Reference of segment.
/// </summary>
[TypeConverter(typeof(TypeConverterSegmentId))]
public int Segment
{
get
{
UpdateSegmentIdTypeConverter();
return m_segment;
}
set
{
m_segment = value;
}
}
/// <summary>
/// Remove the direction dimension of segment.
/// </summary>
public override void Commit()
{
GetRebarShapeDefinitionBySegments.SetSegmentVariableDirection(m_segment);
}
}
}
ConstraintOnArcShape.cs
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using Autodesk.Revit.DB.Structure;
namespace Revit.SDK.Samples.NewRebar.CS
{
/// <summary>
/// Dimension on RebarShapeDefByArc.
/// </summary>
abstract class ConstraintOnArcShape : ConstraintOnRebarShape
{
/// <summary>
/// Dimension to constrain the arc shape.
/// </summary>
protected RebarShapeParameter m_rebarShapeParameter;
public ConstraintOnArcShape(RebarShapeDefByArc def)
: base(def)
{
}
/// <summary>
/// Dimension to constrain the arc shape.
/// </summary>
[DisplayName("RebarShape parameter"), TypeConverter(typeof(TypeConverterRebarShapeParameter)), ReadOnly(false)]
public virtual RebarShapeParameter RebarShapeParameter
{
get
{
UpdateParameterTypeConverter();
return m_rebarShapeParameter;
}
set
{
m_rebarShapeParameter = value;
}
}
/// <summary>
/// Get RebarShapeDefinitionByArc object.
/// </summary>
protected RebarShapeDefinitionByArc GetRebarShapeDefinitionByArc
{
get
{
return m_shapeDef.RebarshapeDefinition as RebarShapeDefinitionByArc;
}
}
}
/// <summary>
/// Arc length dimension.
/// </summary>
class ConstraintArcLength : ConstraintOnArcShape
{
public ConstraintArcLength(RebarShapeDefByArc def)
: base(def)
{
}
/// <summary>
/// Add dimension to constrain the arc length.
/// </summary>
public override void Commit()
{
GetRebarShapeDefinitionByArc.AddConstraintArcLength(
RebarShapeParameter.Parameter);
}
}
/// <summary>
/// Arc chord length dimension.
/// </summary>
class ConstraintChordLength : ConstraintOnArcShape
{
public ConstraintChordLength(RebarShapeDefByArc def)
: base(def)
{
}
/// <summary>
/// Add dimension to constrain the arc chord length.
/// </summary>
public override void Commit()
{
GetRebarShapeDefinitionByArc.AddConstraintChordLength(
RebarShapeParameter.Parameter);
}
}
/// <summary>
/// Arc circumference dimension.
/// </summary>
class ConstraintCircumference : ConstraintOnArcShape
{
/// <summary>
/// Arc reference type.
/// </summary>
private RebarShapeArcReferenceType m_arcReferenceType;
public ConstraintCircumference(RebarShapeDefByArc def)
: base(def)
{
m_arcReferenceType = RebarShapeArcReferenceType.External;
}
/// <summary>
/// Arc reference type.
/// </summary>
public RebarShapeArcReferenceType ArcReferenceType
{
get { return m_arcReferenceType; }
set { m_arcReferenceType = value; }
}
/// <summary>
/// Add dimension to constrain the arc circumference.
/// </summary>
public override void Commit()
{
GetRebarShapeDefinitionByArc.AddConstraintCircumference(
RebarShapeParameter.Parameter, ArcReferenceType);
}
}
/// <summary>
/// Arc diameter dimension.
/// </summary>
class ConstraintDiameter : ConstraintOnArcShape
{
/// <summary>
/// Arc reference type.
/// </summary>
private RebarShapeArcReferenceType m_arcReferenceType;
public ConstraintDiameter(RebarShapeDefByArc def)
: base(def)
{
m_arcReferenceType = RebarShapeArcReferenceType.External;
}
/// <summary>
/// Arc reference type.
/// </summary>
public RebarShapeArcReferenceType ArcReferenceType
{
get { return m_arcReferenceType; }
set { m_arcReferenceType = value; }
}
/// <summary>
/// Add dimension to constrain arc diameter.
/// </summary>
public override void Commit()
{
GetRebarShapeDefinitionByArc.AddConstraintDiameter(
RebarShapeParameter.Parameter, ArcReferenceType);
}
}
/// <summary>
/// Arc radius dimension.
/// </summary>
class ConstraintRadius : ConstraintOnArcShape
{
/// <summary>
/// Arc reference type.
/// </summary>
private RebarShapeArcReferenceType m_arcReferenceType;
public ConstraintRadius(RebarShapeDefByArc def)
: base(def)
{
m_arcReferenceType = RebarShapeArcReferenceType.External;
}
/// <summary>
/// Arc reference type.
/// </summary>
public RebarShapeArcReferenceType ArcReferenceType
{
get { return m_arcReferenceType; }
set { m_arcReferenceType = value; }
}
/// <summary>
/// Add dimension to constrain the radius of arc.
/// </summary>
public override void Commit()
{
GetRebarShapeDefinitionByArc.AddConstraintRadius(
RebarShapeParameter.Parameter, ArcReferenceType);
}
}
/// <summary>
/// Arc Sagittarius length dimension.
/// </summary>
class ConstraintSagittaLength : ConstraintOnArcShape
{
public ConstraintSagittaLength(RebarShapeDefByArc def)
: base(def)
{
}
/// <summary>
/// Add dimension to constrain the Sagittarius length of arc.
/// </summary>
public override void Commit()
{
GetRebarShapeDefinitionByArc.AddConstraintSagittaLength(
RebarShapeParameter.Parameter);
}
}
}
GeometrySupport.cs
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using Autodesk.Revit;
using Autodesk.Revit.DB;
namespace Revit.SDK.Samples.NewRebar.CS
{
// using GeoInstance as Autodesk.Revit.DB.Instance
using GeoInstance = Autodesk.Revit.DB.GeometryInstance;
using Autodesk.Revit.DB.Structure;
/// <summary>
/// Compute geometry information and store geometry information.
/// </summary>
public class GeometrySupport
{
/// <summary>
/// store the solid of beam or column
/// </summary>
protected Solid m_solid;
/// <summary>
/// the extend or sweep path of the beam or column
/// </summary>
protected Line m_drivingLine;
/// <summary>
/// the director vector of beam or column
/// </summary>
protected Autodesk.Revit.DB.XYZ m_drivingVector;
/// <summary>
/// a list to store the edges
/// </summary>
protected List<Line> m_edges = new List<Line>();
/// <summary>
/// a list to store the point
/// </summary>
private List<Autodesk.Revit.DB.XYZ> m_points = new List<Autodesk.Revit.DB.XYZ>();
/// <summary>
/// Return profile points
/// </summary>
public List<Autodesk.Revit.DB.XYZ> ProfilePoints
{
get { return m_points; }
set { m_points = value; }
}
/// <summary>
/// the transform value of the solid
/// </summary>
protected Transform m_transform;
/// <summary>
/// Driving length field
/// </summary>
private double m_drivingLength;
/// <summary>
/// Return driving length
/// </summary>
public double DrivingLength
{
get
{
return m_drivingLength;
}
}
/// <summary>
/// constructor
/// </summary>
/// <param name="element">The host object, must be family instance</param>
public GeometrySupport(FamilyInstance element)
{
// get the geometry element of the selected element
Autodesk.Revit.DB.GeometryElement geoElement = element.get_Geometry(new Options());
IEnumerator<GeometryObject> Objects = geoElement.GetEnumerator();
//if (null == geoElement || 0 == geoElement.Objects.Size)
if (null == geoElement || !Objects.MoveNext())
{
throw new Exception("Can't get the geometry of selected element.");
}
SweptProfile swProfile = element.GetSweptProfile();
if (swProfile == null || !(swProfile.GetDrivingCurve() is Line))
{
throw new Exception("The selected element driving curve is not a line.");
}
// get the driving path and vector of the beam or column
Line line = swProfile.GetDrivingCurve() as Line;
if (null != line)
{
m_drivingLine = line; // driving path
m_drivingVector = GeomUtil.SubXYZ(line.GetEndPoint(1), line.GetEndPoint(0));
m_drivingLength = m_drivingVector.GetLength();
}
//get the geometry object
//foreach (GeometryObject geoObject in geoElement.Objects)
Objects.Reset();
while (Objects.MoveNext())
{
GeometryObject geoObject = Objects.Current;
//get the geometry instance which contains the geometry information
GeoInstance instance = geoObject as GeoInstance;
if (null != instance)
{
//foreach (GeometryObject o in instance.SymbolGeometry.Objects)
IEnumerator<GeometryObject> Objects1 = instance.SymbolGeometry.GetEnumerator();
while (Objects1.MoveNext())
{
GeometryObject o = Objects1.Current;
// get the solid of beam of column
Solid solid = o as Solid;
// do some checks.
if (null == solid)
{
continue;
}
if (0 == solid.Faces.Size || 0 == solid.Edges.Size)
{
continue;
}
m_solid = solid;
//get the transform value of instance
m_transform = instance.Transform;
// Get the swept profile curves information
if (!GetSweptProfile(solid))
{
throw new Exception("Can't get the swept profile curves.");
}
break;
}
}
}
// do some checks about profile curves information
if (null == m_edges)
{
throw new Exception("Can't get the geometry edge information.");
}
if (4 != m_points.Count)
{
throw new Exception("The sample only works for rectangle beam or column.");
}
}
/// <summary>
/// Transform the point to new coordinates
/// </summary>
/// <param name="point">The point need to transform</param>
/// <returns>The changed point</returns>
protected Autodesk.Revit.DB.XYZ Transform(Autodesk.Revit.DB.XYZ point)
{
// only invoke the TransformPoint() method.
return GeomUtil.TransformPoint(point, m_transform);
}
/// <summary>
/// Get the length of driving line
/// </summary>
/// <returns>The length of the driving line</returns>
protected double GetDrivingLineLength()
{
return GeomUtil.GetLength(m_drivingVector);
}
/// <summary>
/// Get two vectors, which indicate some edge direction which contain given point,
/// set the given point as the start point, the other end point of the edge as end
/// </summary>
/// <param name="point">A point of the swept profile</param>
/// <returns>Two vectors indicate edge direction</returns>
protected List<Autodesk.Revit.DB.XYZ> GetRelatedVectors(Autodesk.Revit.DB.XYZ point)
{
// Initialize the return vector list.
List<Autodesk.Revit.DB.XYZ> vectors = new List<Autodesk.Revit.DB.XYZ>();
// Get all the edges which contain this point.
// And get the vector from this point to another point
foreach (Line line in m_edges)
{
if (GeomUtil.IsEqual(point, line.GetEndPoint(0)))
{
Autodesk.Revit.DB.XYZ vector = GeomUtil.SubXYZ(line.GetEndPoint(1), line.GetEndPoint(0));
vectors.Add(vector);
}
if (GeomUtil.IsEqual(point, line.GetEndPoint(1)))
{
Autodesk.Revit.DB.XYZ vector = GeomUtil.SubXYZ(line.GetEndPoint(0), line.GetEndPoint(1));
vectors.Add(vector);
}
}
// only two vectors(directions) should be found
if (2 != vectors.Count)
{
throw new Exception("A point on swept profile should have only two directions.");
}
return vectors;
}
/// <summary>
/// Offset the points of the swept profile to make the points inside swept profile
/// </summary>
/// <param name="offset">Indicate how long to offset on two directions</param>
/// <returns>The offset points</returns>
public List<Autodesk.Revit.DB.XYZ> OffsetPoints(double offset)
{
// Initialize the offset point list.
List<Autodesk.Revit.DB.XYZ> points = new List<Autodesk.Revit.DB.XYZ>();
// Get all points of the swept profile, and offset it in two related directions
foreach (Autodesk.Revit.DB.XYZ point in m_points)
{
// Get two related directions
List<Autodesk.Revit.DB.XYZ> directions = GetRelatedVectors(point);
Autodesk.Revit.DB.XYZ firstDir = directions[0];
Autodesk.Revit.DB.XYZ secondDir = directions[1];
// offset the point in two directions
Autodesk.Revit.DB.XYZ movedPoint = GeomUtil.OffsetPoint(point, firstDir, offset);
movedPoint = GeomUtil.OffsetPoint(movedPoint, secondDir, offset);
// add the offset point into the array
points.Add(movedPoint);
}
return points;
}
/// <summary>
/// Find the information of the swept profile(face),
/// and store the points and edges of the profile(face)
/// </summary>
/// <param name="solid">The solid reference</param>
/// <returns>True if the swept profile can be gotten, otherwise false</returns>
private bool GetSweptProfile(Solid solid)
{
// get the swept face
Face sweptFace = GetSweptProfileFace(solid);
// do some checks
if (null == sweptFace || 1 != sweptFace.EdgeLoops.Size)
{
return false;
}
// get the points of the swept face
foreach (Autodesk.Revit.DB.XYZ point in sweptFace.Triangulate().Vertices)
{
m_points.Add(Transform(point));
}
// get the edges of the swept face
m_edges = ChangeEdgeToLine(sweptFace.EdgeLoops.get_Item(0));
// do some checks
return (null != m_edges);
}
/// <summary>
/// Get the swept profile(face) of the host object(family instance)
/// </summary>
/// <param name="solid">The solid reference</param>
/// <returns>The swept profile</returns>
private Face GetSweptProfileFace(Solid solid)
{
// Get a point on the swept profile from all points in solid
Autodesk.Revit.DB.XYZ refPoint = new Autodesk.Revit.DB.XYZ(); // the point on swept profile
foreach (Edge edge in solid.Edges)
{
List<XYZ> points = edge.Tessellate() as List<XYZ>; //get end points of the edge
if (2 != points.Count) // make sure all edges are lines
{
throw new Exception("Each edge should be a line.");
}
// get two points of the edge. All points in solid should be transformed first
Autodesk.Revit.DB.XYZ first = Transform(points[0]); // start point of edge
Autodesk.Revit.DB.XYZ second = Transform(points[1]); // end point of edge
// some edges should be paralleled with the driving line,
// and the start point of that edge should be the wanted point
Autodesk.Revit.DB.XYZ edgeVector = GeomUtil.SubXYZ(second, first);
if (GeomUtil.IsSameDirection(edgeVector, m_drivingVector))
{
refPoint = first;
break;
}
if (GeomUtil.IsOppositeDirection(edgeVector, m_drivingVector))
{
refPoint = second;
break;
}
}
// Find swept profile(face)
Face sweptFace = null; // define the swept face
foreach (Face face in solid.Faces)
{
if (null != sweptFace)
{
break;
}
// the swept face should be perpendicular with the driving line
if (!GeomUtil.IsVertical(face, m_drivingLine, m_transform, null))
{
continue;
}
// use the point to get the swept face
foreach (Autodesk.Revit.DB.XYZ point in face.Triangulate().Vertices)
{
Autodesk.Revit.DB.XYZ pnt = Transform(point); // all points in solid should be transformed
if (GeomUtil.IsEqual(refPoint, pnt))
{
sweptFace = face;
break;
}
}
}
return sweptFace;
}
/// <summary>
/// Change the swept profile edges from EdgeArray type to line list
/// </summary>
/// <param name="edges">The swept profile edges</param>
/// <returns>The line list which stores the swept profile edges</returns>
private List<Line> ChangeEdgeToLine(EdgeArray edges)
{
// create the line list instance.
List<Line> edgeLines = new List<Line>();
// get each edge from swept profile,
// and change the geometry information in line list
foreach (Edge edge in edges)
{
//get the two points of each edge
List<XYZ> points = edge.Tessellate() as List<XYZ>;
Autodesk.Revit.DB.XYZ first = Transform(points[0]);
Autodesk.Revit.DB.XYZ second = Transform(points[1]);
// create new line and add them into line list
edgeLines.Add(Line.CreateBound(first, second));
}
return edgeLines;
}
}
}
GeomUtil.cs
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Text;
using Autodesk.Revit;
using Autodesk.Revit.DB;
namespace Revit.SDK.Samples.NewRebar.CS
{
using GeoElement = Autodesk.Revit.DB.GeometryElement;
using GeoSolid = Autodesk.Revit.DB.Solid;
using Element = Autodesk.Revit.DB.Element;
/// <summary>
/// The class which gives the base geometry operation, it is a static class.
/// </summary>
static class GeomUtil
{
// Private members
const double Precision = 0.00001; //precision when judge whether two doubles are equal
/// <summary>
/// Judge whether the two double data are equal
/// </summary>
/// <param name="d1">The first double data</param>
/// <param name="d2">The second double data</param>
/// <returns>true if two double data is equal, otherwise false</returns>
public static bool IsEqual(double d1, double d2)
{
//get the absolute value;
double diff = Math.Abs(d1 - d2);
return diff < Precision;
}
/// <summary>
/// Judge whether the two Autodesk.Revit.DB.XYZ point are equal
/// </summary>
/// <param name="first">The first Autodesk.Revit.DB.XYZ point</param>
/// <param name="second">The second Autodesk.Revit.DB.XYZ point</param>
/// <returns>true if two Autodesk.Revit.DB.XYZ point is equal, otherwise false</returns>
public static bool IsEqual(Autodesk.Revit.DB.XYZ first, Autodesk.Revit.DB.XYZ second)
{
bool flag = true;
flag = flag && IsEqual(first.X, second.X);
flag = flag && IsEqual(first.Y, second.Y);
flag = flag && IsEqual(first.Z, second.Z);
return flag;
}
/// <summary>
/// Judge whether the line is perpendicular to the face
/// </summary>
/// <param name="face">The face reference</param>
/// <param name="line">The line reference</param>
/// <param name="faceTrans">The transform for the face</param>
/// <param name="lineTrans">The transform for the line</param>
/// <returns>True if line is perpendicular to the face, otherwise false</returns>
public static bool IsVertical(Face face, Line line,
Transform faceTrans, Transform lineTrans)
{
//get points which the face contains
List<XYZ> points = face.Triangulate().Vertices as List<XYZ>;
if (3 > points.Count) // face's point number should be above 2
{
return false;
}
// get three points from the face points
Autodesk.Revit.DB.XYZ first = points[0];
Autodesk.Revit.DB.XYZ second = points[1];
Autodesk.Revit.DB.XYZ third = points[2];
// get start and end point of line
Autodesk.Revit.DB.XYZ lineStart = line.GetEndPoint(0);
Autodesk.Revit.DB.XYZ lineEnd = line.GetEndPoint(1);
// transForm the three points if necessary
if (null != faceTrans)
{
first = TransformPoint(first, faceTrans);
second = TransformPoint(second, faceTrans);
third = TransformPoint(third, faceTrans);
}
// transform the start and end points if necessary
if (null != lineTrans)
{
lineStart = TransformPoint(lineStart, lineTrans);
lineEnd = TransformPoint(lineEnd, lineTrans);
}
// form two vectors from the face and a vector stand for the line
// Use SubXYZ() method to get the vectors
Autodesk.Revit.DB.XYZ vector1 = SubXYZ(first, second); // first vector of face
Autodesk.Revit.DB.XYZ vector2 = SubXYZ(first, third); // second vector of face
Autodesk.Revit.DB.XYZ vector3 = SubXYZ(lineStart, lineEnd); // line vector
// get two dot products of the face vectors and line vector
double result1 = DotMatrix(vector1, vector3);
double result2 = DotMatrix(vector2, vector3);
// if two dot products are all zero, the line is perpendicular to the face
return (IsEqual(result1, 0) && IsEqual(result2, 0));
}
/// <summary>
/// Judge whether the two vectors have the same direction
/// </summary>
/// <param name="firstVec">The first vector</param>
/// <param name="secondVec">The second vector</param>
/// <returns>True if the two vector is in same direction, otherwise false</returns>
public static bool IsSameDirection(Autodesk.Revit.DB.XYZ firstVec, Autodesk.Revit.DB.XYZ secondVec)
{
// get the unit vector for two vectors
Autodesk.Revit.DB.XYZ first = UnitVector(firstVec);
Autodesk.Revit.DB.XYZ second = UnitVector(secondVec);
// if the dot product of two unit vectors is equal to 1, return true
double dot = DotMatrix(first, second);
return (IsEqual(dot, 1));
}
/// <summary>
/// Judge whether the two vectors have the opposite direction
/// </summary>
/// <param name="firstVec">The first vector</param>
/// <param name="secondVec">The second vector</param>
/// <returns>True if the two vector is in opposite direction, otherwise false</returns>
public static bool IsOppositeDirection(Autodesk.Revit.DB.XYZ firstVec, Autodesk.Revit.DB.XYZ secondVec)
{
// get the unit vector for two vectors
Autodesk.Revit.DB.XYZ first = UnitVector(firstVec);
Autodesk.Revit.DB.XYZ second = UnitVector(secondVec);
// if the dot product of two unit vectors is equal to -1, return true
double dot = DotMatrix(first, second);
return (IsEqual(dot, -1));
}
/// <summary>
/// Set the vector into unit length
/// </summary>
/// <param name="vector">The input vector</param>
/// <returns>The vector in unit length</returns>
public static Autodesk.Revit.DB.XYZ UnitVector(Autodesk.Revit.DB.XYZ vector)
{
// calculate the distance from grid origin to the XYZ
double length = GetLength(vector);
// changed the vector into the unit length
double x = vector.X / length;
double y = vector.Y / length;
double z = vector.Z / length;
return new Autodesk.Revit.DB.XYZ (x, y, z);
}
/// <summary>
/// Calculate the distance from grid origin to the XYZ(vector length)
/// </summary>
/// <param name="vector">The input vector</param>
/// <returns>The length of the vector</returns>
public static double GetLength(Autodesk.Revit.DB.XYZ vector)
{
double x = vector.X;
double y = vector.Y;
double z = vector.Z;
return Math.Sqrt(x * x + y * y + z * z);
}
/// <summary>
/// Subtraction of two points(or vectors), get a new vector
/// </summary>
/// <param name="p1">The first point(vector)</param>
/// <param name="p2">The second point(vector)</param>
/// <returns>Return a new vector from point p2 to p1</returns>
public 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;
return new Autodesk.Revit.DB.XYZ (x, y, z);
}
/// <summary>
/// Add of two points(or vectors), get a new point(vector)
/// </summary>
/// <param name="p1">The first point(vector)</param>
/// <param name="p2">The first point(vector)</param>
/// <returns>A new vector(point)</returns>
public static Autodesk.Revit.DB.XYZ AddXYZ(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;
return new Autodesk.Revit.DB.XYZ (x, y, z);
}
/// <summary>
/// Multiply a vector with a number
/// </summary>
/// <param name="vector">A vector</param>
/// <param name="rate">The rate number</param>
/// <returns></returns>
public static Autodesk.Revit.DB.XYZ MultiplyVector(Autodesk.Revit.DB.XYZ vector, double rate)
{
double x = vector.X * rate;
double y = vector.Y * rate;
double z = vector.Z * rate;
return new Autodesk.Revit.DB.XYZ (x, y, z);
}
/// <summary>
/// Transform old coordinate system in the new coordinate system
/// </summary>
/// <param name="point">The Autodesk.Revit.DB.XYZ which need to be transformed</param>
/// <param name="transform">The value of the coordinate system to be transformed</param>
/// <returns>The new Autodesk.Revit.DB.XYZ which has been transformed</returns>
public static Autodesk.Revit.DB.XYZ TransformPoint(Autodesk.Revit.DB.XYZ point, Transform transform)
{
//get the coordinate value in X, Y, Z axis
double x = point.X;
double y = point.Y;
double z = point.Z;
//transform basis of the old coordinate system in the new coordinate system
Autodesk.Revit.DB.XYZ b0 = transform.get_Basis(0);
Autodesk.Revit.DB.XYZ b1 = transform.get_Basis(1);
Autodesk.Revit.DB.XYZ b2 = transform.get_Basis(2);
Autodesk.Revit.DB.XYZ origin = transform.Origin;
//transform the origin of the old coordinate system in the new coordinate system
double xTemp = x * b0.X + y * b1.X + z * b2.X + origin.X;
double yTemp = x * b0.Y + y * b1.Y + z * b2.Y + origin.Y;
double zTemp = x * b0.Z + y * b1.Z + z * b2.Z + origin.Z;
return new Autodesk.Revit.DB.XYZ (xTemp, yTemp, zTemp);
}
/// <summary>
/// Move a point a give offset along a given direction
/// </summary>
/// <param name="point">The point need to move</param>
/// <param name="direction">The direction the point move to</param>
/// <param name="offset">Tndicate how long to move</param>
/// <returns>The moved point</returns>
public static Autodesk.Revit.DB.XYZ OffsetPoint(Autodesk.Revit.DB.XYZ point, Autodesk.Revit.DB.XYZ direction, double offset)
{
Autodesk.Revit.DB.XYZ directUnit = UnitVector(direction);
Autodesk.Revit.DB.XYZ offsetVect = MultiplyVector(directUnit, offset);
return AddXYZ(point, offsetVect);
}
/// <summary>
/// Dot product of two Autodesk.Revit.DB.XYZ as Matrix
/// </summary>
/// <param name="p1">The first XYZ</param>
/// <param name="p2">The second XYZ</param>
/// <returns>The cosine value of the angle between vector p1 an p2</returns>
private static double DotMatrix(Autodesk.Revit.DB.XYZ p1, Autodesk.Revit.DB.XYZ p2)
{
//get the coordinate of the Autodesk.Revit.DB.XYZ
double v1 = p1.X;
double v2 = p1.Y;
double v3 = p1.Z;
double u1 = p2.X;
double u2 = p2.Y;
double u3 = p2.Z;
return v1 * u1 + v2 * u2 + v3 * u3;
}
}
}
NewRebarForm.cs
//
// (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.NewRebar.CS
{
partial class NewRebarForm
{
/// <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.okButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.rebarShapesGroupBox = new System.Windows.Forms.GroupBox();
this.shapesComboBox = new System.Windows.Forms.ComboBox();
this.createShapeButton = new System.Windows.Forms.Button();
this.rebarBarTypeGroupBox = new System.Windows.Forms.GroupBox();
this.barTypesComboBox = new System.Windows.Forms.ComboBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.nameLabel = new System.Windows.Forms.Label();
this.nameTextBox = new System.Windows.Forms.TextBox();
this.arcTypecomboBox = new System.Windows.Forms.ComboBox();
this.segmentCountTextBox = new System.Windows.Forms.TextBox();
this.bySegmentsradioButton = new System.Windows.Forms.RadioButton();
this.byArcradioButton = new System.Windows.Forms.RadioButton();
this.rebarShapesGroupBox.SuspendLayout();
this.rebarBarTypeGroupBox.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// okButton
//
this.okButton.Location = new System.Drawing.Point(141, 233);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(89, 26);
this.okButton.TabIndex = 4;
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(252, 233);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(89, 26);
this.cancelButton.TabIndex = 5;
this.cancelButton.Text = "&Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
//
// rebarShapesGroupBox
//
this.rebarShapesGroupBox.Controls.Add(this.shapesComboBox);
this.rebarShapesGroupBox.Location = new System.Drawing.Point(26, 12);
this.rebarShapesGroupBox.Name = "rebarShapesGroupBox";
this.rebarShapesGroupBox.Size = new System.Drawing.Size(204, 77);
this.rebarShapesGroupBox.TabIndex = 7;
this.rebarShapesGroupBox.TabStop = false;
this.rebarShapesGroupBox.Text = "RebarShape";
//
// shapesComboBox
//
this.shapesComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.shapesComboBox.FormattingEnabled = true;
this.shapesComboBox.Location = new System.Drawing.Point(31, 31);
this.shapesComboBox.Name = "shapesComboBox";
this.shapesComboBox.Size = new System.Drawing.Size(149, 21);
this.shapesComboBox.TabIndex = 8;
//
// createShapeButton
//
this.createShapeButton.Location = new System.Drawing.Point(20, 151);
this.createShapeButton.Name = "createShapeButton";
this.createShapeButton.Size = new System.Drawing.Size(162, 29);
this.createShapeButton.TabIndex = 9;
this.createShapeButton.Text = "Create Rebar &Shape ...";
this.createShapeButton.UseVisualStyleBackColor = true;
this.createShapeButton.Click += new System.EventHandler(this.createShapeButton_Click);
//
// rebarBarTypeGroupBox
//
this.rebarBarTypeGroupBox.Controls.Add(this.barTypesComboBox);
this.rebarBarTypeGroupBox.Location = new System.Drawing.Point(26, 116);
this.rebarBarTypeGroupBox.Name = "rebarBarTypeGroupBox";
this.rebarBarTypeGroupBox.Size = new System.Drawing.Size(204, 82);
this.rebarBarTypeGroupBox.TabIndex = 8;
this.rebarBarTypeGroupBox.TabStop = false;
this.rebarBarTypeGroupBox.Text = "RebarBarType";
//
// barTypesComboBox
//
this.barTypesComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.barTypesComboBox.FormattingEnabled = true;
this.barTypesComboBox.Location = new System.Drawing.Point(30, 35);
this.barTypesComboBox.Name = "barTypesComboBox";
this.barTypesComboBox.Size = new System.Drawing.Size(150, 21);
this.barTypesComboBox.TabIndex = 1;
//
// groupBox2
//
this.groupBox2.Controls.Add(this.nameLabel);
this.groupBox2.Controls.Add(this.nameTextBox);
this.groupBox2.Controls.Add(this.arcTypecomboBox);
this.groupBox2.Controls.Add(this.segmentCountTextBox);
this.groupBox2.Controls.Add(this.bySegmentsradioButton);
this.groupBox2.Controls.Add(this.byArcradioButton);
this.groupBox2.Controls.Add(this.createShapeButton);
this.groupBox2.Location = new System.Drawing.Point(249, 12);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(213, 186);
this.groupBox2.TabIndex = 11;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Create Rebar Shape";
//
// nameLabel
//
this.nameLabel.AutoSize = true;
this.nameLabel.Location = new System.Drawing.Point(20, 36);
this.nameLabel.Name = "nameLabel";
this.nameLabel.Size = new System.Drawing.Size(35, 13);
this.nameLabel.TabIndex = 21;
this.nameLabel.Text = "Name";
//
// nameTextBox
//
this.nameTextBox.Location = new System.Drawing.Point(79, 31);
this.nameTextBox.Name = "nameTextBox";
this.nameTextBox.Size = new System.Drawing.Size(103, 20);
this.nameTextBox.TabIndex = 20;
//
// arcTypecomboBox
//
this.arcTypecomboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.arcTypecomboBox.FormattingEnabled = true;
this.arcTypecomboBox.Location = new System.Drawing.Point(79, 68);
this.arcTypecomboBox.Name = "arcTypecomboBox";
this.arcTypecomboBox.Size = new System.Drawing.Size(103, 21);
this.arcTypecomboBox.TabIndex = 19;
//
// segmentCountTextBox
//
this.segmentCountTextBox.Enabled = false;
this.segmentCountTextBox.Location = new System.Drawing.Point(108, 103);
this.segmentCountTextBox.Name = "segmentCountTextBox";
this.segmentCountTextBox.Size = new System.Drawing.Size(74, 20);
this.segmentCountTextBox.TabIndex = 18;
//
// bySegmentsradioButton
//
this.bySegmentsradioButton.AutoSize = true;
this.bySegmentsradioButton.Location = new System.Drawing.Point(20, 104);
this.bySegmentsradioButton.Name = "bySegmentsradioButton";
this.bySegmentsradioButton.Size = new System.Drawing.Size(87, 17);
this.bySegmentsradioButton.TabIndex = 17;
this.bySegmentsradioButton.Text = "By Segments";
this.bySegmentsradioButton.UseVisualStyleBackColor = true;
this.bySegmentsradioButton.CheckedChanged += new System.EventHandler(this.bySegmentsradioButton_CheckedChanged);
//
// byArcradioButton
//
this.byArcradioButton.AutoSize = true;
this.byArcradioButton.Checked = true;
this.byArcradioButton.Location = new System.Drawing.Point(20, 72);
this.byArcradioButton.Name = "byArcradioButton";
this.byArcradioButton.Size = new System.Drawing.Size(56, 17);
this.byArcradioButton.TabIndex = 16;
this.byArcradioButton.TabStop = true;
this.byArcradioButton.Text = "By Arc";
this.byArcradioButton.UseVisualStyleBackColor = true;
this.byArcradioButton.CheckedChanged += new System.EventHandler(this.byArcradioButton_CheckedChanged);
//
// NewRebarForm
//
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(484, 281);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.rebarBarTypeGroupBox);
this.Controls.Add(this.rebarShapesGroupBox);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "NewRebarForm";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Create Rebar";
this.Load += new System.EventHandler(this.NewRebarForm_Load);
this.rebarShapesGroupBox.ResumeLayout(false);
this.rebarBarTypeGroupBox.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.GroupBox rebarShapesGroupBox;
private System.Windows.Forms.Button createShapeButton;
private System.Windows.Forms.ComboBox shapesComboBox;
private System.Windows.Forms.GroupBox rebarBarTypeGroupBox;
private System.Windows.Forms.ComboBox barTypesComboBox;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Label nameLabel;
private System.Windows.Forms.TextBox nameTextBox;
private System.Windows.Forms.ComboBox arcTypecomboBox;
private System.Windows.Forms.TextBox segmentCountTextBox;
private System.Windows.Forms.RadioButton bySegmentsradioButton;
private System.Windows.Forms.RadioButton byArcradioButton;
}
}
NewRebarShapeForm.cs
//
// (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.NewRebar.CS
{
partial class NewRebarShapeForm
{
/// <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.addParameterButton = new System.Windows.Forms.Button();
this.addConstraintButton = new System.Windows.Forms.Button();
this.parameterListBox = new System.Windows.Forms.ListBox();
this.propertyGrid = new System.Windows.Forms.PropertyGrid();
this.constraintListBox = new System.Windows.Forms.ListBox();
this.okButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.parameterGroupBox = new System.Windows.Forms.GroupBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.hookGroupBox = new System.Windows.Forms.GroupBox();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.endHookOrientationcomboBox = new System.Windows.Forms.ComboBox();
this.startHookOrientationComboBox = new System.Windows.Forms.ComboBox();
this.endHookAngleComboBox = new System.Windows.Forms.ComboBox();
this.startHookAngleComboBox = new System.Windows.Forms.ComboBox();
this.useHooksCheckBox = new System.Windows.Forms.CheckBox();
this.parameterGroupBox.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
this.hookGroupBox.SuspendLayout();
this.SuspendLayout();
//
// addParameterButton
//
this.addParameterButton.Dock = System.Windows.Forms.DockStyle.Bottom;
this.addParameterButton.Location = new System.Drawing.Point(3, 195);
this.addParameterButton.Name = "addParameterButton";
this.addParameterButton.Size = new System.Drawing.Size(137, 31);
this.addParameterButton.TabIndex = 2;
this.addParameterButton.Text = "Add &Parameter";
this.addParameterButton.UseVisualStyleBackColor = true;
this.addParameterButton.Click += new System.EventHandler(this.addParameterButton_Click);
//
// addConstraintButton
//
this.addConstraintButton.Dock = System.Windows.Forms.DockStyle.Bottom;
this.addConstraintButton.Location = new System.Drawing.Point(3, 195);
this.addConstraintButton.Name = "addConstraintButton";
this.addConstraintButton.Size = new System.Drawing.Size(200, 31);
this.addConstraintButton.TabIndex = 3;
this.addConstraintButton.Text = "Add Con&straint";
this.addConstraintButton.UseVisualStyleBackColor = true;
this.addConstraintButton.Click += new System.EventHandler(this.addConstraintButton_Click);
//
// parameterListBox
//
this.parameterListBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.parameterListBox.FormattingEnabled = true;
this.parameterListBox.HorizontalScrollbar = true;
this.parameterListBox.Location = new System.Drawing.Point(3, 16);
this.parameterListBox.Name = "parameterListBox";
this.parameterListBox.Size = new System.Drawing.Size(137, 173);
this.parameterListBox.TabIndex = 4;
this.parameterListBox.SelectedIndexChanged += new System.EventHandler(this.parameterListBox_SelectedIndexChanged);
//
// propertyGrid
//
this.propertyGrid.Dock = System.Windows.Forms.DockStyle.Fill;
this.propertyGrid.Location = new System.Drawing.Point(3, 16);
this.propertyGrid.Name = "propertyGrid";
this.propertyGrid.Size = new System.Drawing.Size(222, 365);
this.propertyGrid.TabIndex = 5;
//
// constraintListBox
//
this.constraintListBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.constraintListBox.FormattingEnabled = true;
this.constraintListBox.Location = new System.Drawing.Point(3, 16);
this.constraintListBox.Name = "constraintListBox";
this.constraintListBox.Size = new System.Drawing.Size(200, 173);
this.constraintListBox.TabIndex = 6;
this.constraintListBox.SelectedIndexChanged += new System.EventHandler(this.constraintListBox_SelectedIndexChanged);
//
// okButton
//
this.okButton.Location = new System.Drawing.Point(237, 425);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 29);
this.okButton.TabIndex = 7;
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(342, 425);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 29);
this.cancelButton.TabIndex = 8;
this.cancelButton.Text = "&Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
//
// parameterGroupBox
//
this.parameterGroupBox.Controls.Add(this.parameterListBox);
this.parameterGroupBox.Controls.Add(this.addParameterButton);
this.parameterGroupBox.Location = new System.Drawing.Point(12, 26);
this.parameterGroupBox.Name = "parameterGroupBox";
this.parameterGroupBox.Size = new System.Drawing.Size(143, 229);
this.parameterGroupBox.TabIndex = 9;
this.parameterGroupBox.TabStop = false;
this.parameterGroupBox.Text = "Parameters";
//
// groupBox2
//
this.groupBox2.Controls.Add(this.constraintListBox);
this.groupBox2.Controls.Add(this.addConstraintButton);
this.groupBox2.Location = new System.Drawing.Point(181, 26);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(206, 229);
this.groupBox2.TabIndex = 10;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Constraints";
//
// groupBox3
//
this.groupBox3.Controls.Add(this.propertyGrid);
this.groupBox3.Location = new System.Drawing.Point(413, 26);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(228, 384);
this.groupBox3.TabIndex = 11;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Properties";
//
// hookGroupBox
//
this.hookGroupBox.Controls.Add(this.label4);
this.hookGroupBox.Controls.Add(this.label3);
this.hookGroupBox.Controls.Add(this.label2);
this.hookGroupBox.Controls.Add(this.label1);
this.hookGroupBox.Controls.Add(this.endHookOrientationcomboBox);
this.hookGroupBox.Controls.Add(this.startHookOrientationComboBox);
this.hookGroupBox.Controls.Add(this.endHookAngleComboBox);
this.hookGroupBox.Controls.Add(this.startHookAngleComboBox);
this.hookGroupBox.Controls.Add(this.useHooksCheckBox);
this.hookGroupBox.Location = new System.Drawing.Point(15, 257);
this.hookGroupBox.Name = "hookGroupBox";
this.hookGroupBox.Size = new System.Drawing.Size(368, 153);
this.hookGroupBox.TabIndex = 12;
this.hookGroupBox.TabStop = false;
this.hookGroupBox.Text = "Rebar Hook";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(222, 100);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(109, 13);
this.label4.TabIndex = 8;
this.label4.Text = "End Hook Orientation";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(23, 100);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(85, 13);
this.label3.TabIndex = 7;
this.label3.Text = "End Hook Angle";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(222, 42);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(112, 13);
this.label2.TabIndex = 6;
this.label2.Text = "Start Hook Orientation";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(23, 42);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(88, 13);
this.label1.TabIndex = 5;
this.label1.Text = "Start Hook Angle";
//
// endHookOrientationcomboBox
//
this.endHookOrientationcomboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.endHookOrientationcomboBox.Enabled = false;
this.endHookOrientationcomboBox.FormattingEnabled = true;
this.endHookOrientationcomboBox.Location = new System.Drawing.Point(222, 120);
this.endHookOrientationcomboBox.Name = "endHookOrientationcomboBox";
this.endHookOrientationcomboBox.Size = new System.Drawing.Size(121, 21);
this.endHookOrientationcomboBox.TabIndex = 4;
//
// startHookOrientationComboBox
//
this.startHookOrientationComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.startHookOrientationComboBox.Enabled = false;
this.startHookOrientationComboBox.FormattingEnabled = true;
this.startHookOrientationComboBox.Location = new System.Drawing.Point(222, 62);
this.startHookOrientationComboBox.Name = "startHookOrientationComboBox";
this.startHookOrientationComboBox.Size = new System.Drawing.Size(121, 21);
this.startHookOrientationComboBox.TabIndex = 3;
//
// endHookAngleComboBox
//
this.endHookAngleComboBox.Enabled = false;
this.endHookAngleComboBox.FormattingEnabled = true;
this.endHookAngleComboBox.Location = new System.Drawing.Point(23, 120);
this.endHookAngleComboBox.Name = "endHookAngleComboBox";
this.endHookAngleComboBox.Size = new System.Drawing.Size(121, 21);
this.endHookAngleComboBox.TabIndex = 2;
//
// startHookAngleComboBox
//
this.startHookAngleComboBox.Enabled = false;
this.startHookAngleComboBox.FormattingEnabled = true;
this.startHookAngleComboBox.Location = new System.Drawing.Point(23, 62);
this.startHookAngleComboBox.Name = "startHookAngleComboBox";
this.startHookAngleComboBox.Size = new System.Drawing.Size(121, 21);
this.startHookAngleComboBox.TabIndex = 1;
//
// useHooksCheckBox
//
this.useHooksCheckBox.AutoSize = true;
this.useHooksCheckBox.Location = new System.Drawing.Point(23, 20);
this.useHooksCheckBox.Name = "useHooksCheckBox";
this.useHooksCheckBox.Size = new System.Drawing.Size(103, 17);
this.useHooksCheckBox.TabIndex = 0;
this.useHooksCheckBox.Text = "Set Rebar Hook";
this.useHooksCheckBox.UseVisualStyleBackColor = true;
this.useHooksCheckBox.CheckedChanged += new System.EventHandler(this.useHooksCheckBox_CheckedChanged);
//
// NewRebarShapeForm
//
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(661, 465);
this.Controls.Add(this.hookGroupBox);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.parameterGroupBox);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "NewRebarShapeForm";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Create RebarShape";
this.Load += new System.EventHandler(this.NewRebarShapeForm_Load);
this.parameterGroupBox.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.hookGroupBox.ResumeLayout(false);
this.hookGroupBox.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button addParameterButton;
private System.Windows.Forms.Button addConstraintButton;
private System.Windows.Forms.ListBox parameterListBox;
private System.Windows.Forms.PropertyGrid propertyGrid;
private System.Windows.Forms.ListBox constraintListBox;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.GroupBox parameterGroupBox;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.GroupBox hookGroupBox;
private System.Windows.Forms.ComboBox endHookOrientationcomboBox;
private System.Windows.Forms.ComboBox startHookOrientationComboBox;
private System.Windows.Forms.ComboBox endHookAngleComboBox;
private System.Windows.Forms.ComboBox startHookAngleComboBox;
private System.Windows.Forms.CheckBox useHooksCheckBox;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
}
}
AddParameterForm.cs
//
// (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.NewRebar.CS
{
partial class AddParameter
{
/// <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.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.paramValueTextBox = new System.Windows.Forms.TextBox();
this.paramNameTextBox = new System.Windows.Forms.TextBox();
this.okButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.groupBox = new System.Windows.Forms.GroupBox();
this.paramFormulaRadioButton = new System.Windows.Forms.RadioButton();
this.paramDoubleRadioButton = new System.Windows.Forms.RadioButton();
this.groupBox.SuspendLayout();
this.SuspendLayout();
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(43, 112);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(34, 13);
this.label2.TabIndex = 8;
this.label2.Text = "Value";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(43, 79);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(35, 13);
this.label1.TabIndex = 7;
this.label1.Text = "Name";
//
// paramValueTextBox
//
this.paramValueTextBox.Location = new System.Drawing.Point(102, 105);
this.paramValueTextBox.Name = "paramValueTextBox";
this.paramValueTextBox.Size = new System.Drawing.Size(142, 20);
this.paramValueTextBox.TabIndex = 6;
//
// paramNameTextBox
//
this.paramNameTextBox.Location = new System.Drawing.Point(102, 79);
this.paramNameTextBox.Name = "paramNameTextBox";
this.paramNameTextBox.Size = new System.Drawing.Size(142, 20);
this.paramNameTextBox.TabIndex = 5;
//
// okButton
//
this.okButton.Location = new System.Drawing.Point(64, 146);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(72, 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(159, 146);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(72, 23);
this.cancelButton.TabIndex = 10;
this.cancelButton.Text = "&Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
//
// groupBox
//
this.groupBox.Controls.Add(this.paramFormulaRadioButton);
this.groupBox.Controls.Add(this.paramDoubleRadioButton);
this.groupBox.Location = new System.Drawing.Point(43, 12);
this.groupBox.Name = "groupBox";
this.groupBox.Size = new System.Drawing.Size(201, 47);
this.groupBox.TabIndex = 11;
this.groupBox.TabStop = false;
this.groupBox.Text = "Parameter Type";
//
// paramFormulaRadioButton
//
this.paramFormulaRadioButton.AutoSize = true;
this.paramFormulaRadioButton.Location = new System.Drawing.Point(116, 19);
this.paramFormulaRadioButton.Name = "paramFormulaRadioButton";
this.paramFormulaRadioButton.Size = new System.Drawing.Size(62, 17);
this.paramFormulaRadioButton.TabIndex = 1;
this.paramFormulaRadioButton.Text = "Formula";
this.paramFormulaRadioButton.UseVisualStyleBackColor = true;
//
// paramDoubleRadioButton
//
this.paramDoubleRadioButton.AutoSize = true;
this.paramDoubleRadioButton.Checked = true;
this.paramDoubleRadioButton.Location = new System.Drawing.Point(21, 19);
this.paramDoubleRadioButton.Name = "paramDoubleRadioButton";
this.paramDoubleRadioButton.Size = new System.Drawing.Size(59, 17);
this.paramDoubleRadioButton.TabIndex = 0;
this.paramDoubleRadioButton.TabStop = true;
this.paramDoubleRadioButton.Text = "Double";
this.paramDoubleRadioButton.UseVisualStyleBackColor = true;
//
// AddParameter
//
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(285, 181);
this.Controls.Add(this.groupBox);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.Controls.Add(this.label2);
this.Controls.Add(this.paramValueTextBox);
this.Controls.Add(this.label1);
this.Controls.Add(this.paramNameTextBox);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "AddParameter";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Add Parameter";
this.groupBox.ResumeLayout(false);
this.groupBox.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox paramValueTextBox;
private System.Windows.Forms.TextBox paramNameTextBox;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.GroupBox groupBox;
private System.Windows.Forms.RadioButton paramFormulaRadioButton;
private System.Windows.Forms.RadioButton paramDoubleRadioButton;
}
}
AddConstraintForm.cs
//
// (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.NewRebar.CS
{
partial class AddConstraint
{
/// <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.cancelButton = new System.Windows.Forms.Button();
this.okButton = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.constraintTypesComboBox = new System.Windows.Forms.ComboBox();
this.SuspendLayout();
//
// cancelButton
//
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(164, 76);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(72, 23);
this.cancelButton.TabIndex = 16;
this.cancelButton.Text = "&Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
//
// okButton
//
this.okButton.Location = new System.Drawing.Point(74, 76);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(72, 23);
this.okButton.TabIndex = 15;
this.okButton.Text = "&OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(67, 17);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(81, 13);
this.label1.TabIndex = 14;
this.label1.Text = "ConstraintType:";
//
// constraintTypesComboBox
//
this.constraintTypesComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.constraintTypesComboBox.FormattingEnabled = true;
this.constraintTypesComboBox.Location = new System.Drawing.Point(65, 41);
this.constraintTypesComboBox.Name = "constraintTypesComboBox";
this.constraintTypesComboBox.Size = new System.Drawing.Size(188, 21);
this.constraintTypesComboBox.TabIndex = 13;
//
// AddConstraint
//
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(323, 114);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.Controls.Add(this.label1);
this.Controls.Add(this.constraintTypesComboBox);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "AddConstraint";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Add Constraint";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ComboBox constraintTypesComboBox;
}
}
版权所有 :无锡模信建筑科技有限公司 苏ICP备2021028830号-1 BIM建模|BIM技术应用|BIM软件开发
联系地址:江苏省无锡市新吴区龙山路4号B座705 手机:18761516598