added Revit 2022 SDK minus except *rvt and *rfa

This commit is contained in:
Jeremy Tammik
2021-04-20 11:36:21 +02:00
parent 1133a82dc5
commit 7e327986e8
3034 changed files with 1245318 additions and 0 deletions
@@ -0,0 +1,38 @@
//
// (C) Copyright 2003-2013 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.Linq;
using System.Text;
namespace CodeCheckingConcreteExample.UIComponents.CalculationPointsSelector
{
#pragma warning disable 1591
public class CalculationPointsSelectorAttribute : Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes.SubSchemaEmbeddedControlAttribute
{
public CalculationPointsSelectorAttribute()
{
ServerUI = typeof(CalculationPointsSelectorServerUI);
}
}
}
@@ -0,0 +1,191 @@
//
// (C) Copyright 2003-2013 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.Linq;
using System.Text;
using Autodesk.Revit.DB.CodeChecking.Engineering;
using Autodesk.Revit.DB.CodeChecking.Engineering.Tools;
using Autodesk.Revit.DB.ExtensibleStorage;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes;
using Autodesk.Revit.UI.ExtensibleStorage.Framework;
namespace CodeCheckingConcreteExample.UIComponents.CalculationPointsSelector
{
/// <summary>
/// Component for calculation points selection
/// Available selection methods are: UniformDistribution,UserCoordinates,UserSegmentDivision,Points of extreme values
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.Schema("CalculationPointsSelectorSchema", "88b169e5-cfb4-440a-830f-20958f71663b")]
public class CalculationPointsSelectorSchema : Autodesk.Revit.DB.ExtensibleStorage.Framework.SchemaClass
{
// UniformDistribution
/// <summary>
/// Division type
/// </summary>
public enum DivisionType
{
/// <summary>
/// Uniform distribution defined by a given number of points
/// </summary>
Points,
/// <summary>
/// Uniform distribution defined by segments
/// </summary>
Segments
}
/// <summary>
/// How the bar should be divided into calculation points
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.SchemaProperty(FieldName = "ElementDivisionType")]
[EnumControl(Description = "ElementDivisionType", EnumType = typeof(ConcreteTypes.EnabledInternalForces), Presentation = PresentationMode.OptionList, Item = PresentationItem.Text, Localizable = true, Context = "CalculationPointsSelector")]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.Attributes.DefaultElement(Localizable = true)]
public DivisionType ElementDivisionType { get; set; }
/// <summary>
/// Number points in Uniform distribution
/// </summary>
[Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes.TextBox(Description = "UniformDistribution", Index = 2)]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.SchemaProperty]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.Attributes.ValueWithName(Name = "UniformDistribution", Localizable = true, LocalizableValue = true)]
public int UniformDistribution { get; set; }
/// <summary>
/// Length of user segment(Absolute)
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.SchemaProperty(Unit = UnitType.UT_Length, DisplayUnit = DisplayUnitType.DUT_METERS)]
[Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes.UnitTextBox(Description = "UserSegmentDivision", Index = 3, MinimumValue = 1.0e-12, ValidateMinimumValue = true)]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.Attributes.ValueWithName(Name = "UserSegmentDivision", Localizable = true, LocalizableValue = true, Level = Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.DetailLevel.General)]
public double UserSegmentDivision { get; set; }
/// <summary>
/// Points of extreme values flag
/// </summary>
[Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes.CheckBox(Description = "IsPointsOfExtremeValues", Index = 4)]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.SchemaProperty]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.Attributes.ValueWithDescription(Description = "IsPointsOfExtremeValues", Localizable = true, LocalizableValue = true, Level = Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.DetailLevel.General)]
public bool IsPointsOfExtremeValues { get; set; }
/// <summary>
/// Creates default CalculationPointsSelectorSchema
/// </summary>
public CalculationPointsSelectorSchema()
{
UserSegmentDivision = 1.0;
}
/// <summary>
///
/// </summary>
/// <param name="doc">Revit document</param>
/// <param name="isOutputRelative">Flag indicating whether returned points should have relative coordinates</param>
/// <param name="absoluteElementLength">Element length</param>
/// <param name="elementId">Revit ElementId</param>
/// <param name="combinations">List of Revit ElementId for combinations</param>
/// <param name="forceTypes">Force type vector</param>
/// <returns></returns>
public List<double> GetPointCoordinates(Document doc, bool isOutputRelative, double absoluteElementLength, ElementId elementId, List<ElementId> combinations, List<ForceType> forceTypes)
{
List<double> coordinates = new List<double>();
bool isNonzeroElement = absoluteElementLength > 0.01;
// don't calculate if element length is zero and coordinates in absolute points
if (!isOutputRelative || isNonzeroElement)
{
// get points from uniform distribution
if (ElementDivisionType == DivisionType.Points)
{
int numberOfPoints = UniformDistribution,
lastId = numberOfPoints - 1;
if (lastId > 0)
{
double segmentLength = ( isOutputRelative ? 1.0 : absoluteElementLength ) / (lastId);
for (int i = 0; i <= lastId; i++)
{
coordinates.Add(i * segmentLength);
}
}
}
// get points from user segment division
else if (ElementDivisionType == DivisionType.Segments)
{
if ( isNonzeroElement)
{
double segmentLength = (UserSegmentDivision / absoluteElementLength),
distance = 0.0;
while (distance < 1.0)
{
coordinates.Add(distance);
distance += segmentLength;
}
coordinates.Add(1.0);
}
}
// get points where forces have extreme values
if (IsPointsOfExtremeValues && forceTypes!=null && forceTypes.Count!=0)
{
List<double> extremeValueCoordinates = (ForceResultsUtils.GetExtremumValueCoordinates(doc, combinations, forceTypes, new List<ElementId>() { elementId }).Select(s => s.Item4)).ToList();
if (isOutputRelative)
{
if (isNonzeroElement)
{
for (int i = 0; i < extremeValueCoordinates.Count; i++)
{
extremeValueCoordinates[i] /= absoluteElementLength;
}
}
else
{
throw new ArgumentException("Nonzero element length required for relative output");
}
}
coordinates.AddRange(extremeValueCoordinates);
}
coordinates.Sort();
}
return coordinates.Distinct(new DoubleComparer()).ToList();
}
}
internal class DoubleComparer : IEqualityComparer<double>
{
public bool Equals(double a, double b) { return Math.Abs(a - b) < 0.0001; }
public int GetHashCode(double a) { return (int)Math.Floor(a * 100000 + 0.5); }
}
}
@@ -0,0 +1,92 @@
//
// (C) Copyright 2003-2013 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.Linq;
using System.Text;
namespace CodeCheckingConcreteExample.UIComponents.CalculationPointsSelector
{
#pragma warning disable 1591
class CalculationPointsSelectorServerUI : Autodesk.Revit.UI.ExtensibleStorage.Framework.IServerUI
{
#region IServerUI Members
public System.Collections.IList GetDataSource(string key, Autodesk.Revit.DB.Document document, Autodesk.Revit.DB.DisplayUnitType unitType)
{
return null;
}
public void LayoutInitialized(object sender, Autodesk.Revit.UI.ExtensibleStorage.Framework.LayoutInitializedEventArgs e)
{
onChange(e);
}
public void ValueChanged(object sender, Autodesk.Revit.UI.ExtensibleStorage.Framework.ValueChangedEventArgs e)
{
onChange(e);
}
private void onChange(Autodesk.Revit.UI.ExtensibleStorage.Framework.SchemaEditorEventArgs e)
{
CalculationPointsSelectorSchema pointsSelectorSchema = new CalculationPointsSelectorSchema();
pointsSelectorSchema.SetProperties(e.Entity as Autodesk.Revit.DB.ExtensibleStorage.Entity);
CalculationPointsSelectorSchema.DivisionType divisionType = pointsSelectorSchema.ElementDivisionType;
bool isUniformDistance = divisionType == CalculationPointsSelectorSchema.DivisionType.Points,
isUserSegmentDistance = divisionType == CalculationPointsSelectorSchema.DivisionType.Segments;
e.Editor.SetAttribute("UniformDistribution", Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes.FieldUIAttribute.PropertyIsVisible, isUniformDistance, Autodesk.Revit.DB.DisplayUnitType.DUT_UNDEFINED);
e.Editor.SetAttribute("UserSegmentDivision", Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes.FieldUIAttribute.PropertyIsVisible, isUserSegmentDistance, Autodesk.Revit.DB.DisplayUnitType.DUT_UNDEFINED);
}
#endregion
#region IResource Members
public string GetResource(string key, string context)
{
String txt = null;
if (context == "CalculationPointsSelector")
{
if (key == "Points" || key == "Segments")
{
txt = CodeCheckingConcreteExample.Properties.Resources.ResourceManager.GetString(key);
}
}
return txt != null ? txt : key;
}
public Uri GetResourceImage(string key, string context)
{
return null;
}
#endregion
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

@@ -0,0 +1,38 @@
//
// (C) Copyright 2003-2013 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.Linq;
using System.Text;
namespace CodeCheckingConcreteExample.UIComponents.RCSteelParameters
{
#pragma warning disable 1591
public class RCSteelParametersAttribute : Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes.SubSchemaEmbeddedControlAttribute
{
public RCSteelParametersAttribute()
{
ServerUI = typeof(RCSteelParametersServerUI);
}
}
}
@@ -0,0 +1,148 @@
//
// (C) Copyright 2003-2013 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.Linq;
using System.Text;
using Autodesk.Revit.DB.ExtensibleStorage;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Structure;
using CodeCheckingConcreteExample.Properties;
namespace CodeCheckingConcreteExample.UIComponents.RCSteelParameters
{
/// <summary>
/// Component for rebar parameters selection
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.Schema("RCSteelParametersSchema", "9afbd3c6-5eff-4712-adce-e8eef1788081")]
public class RCSteelParametersSchema : Autodesk.Revit.DB.ExtensibleStorage.Framework.SchemaClass
{
Material _Material;
/// <summary>
/// Revit ElementId of Revit material
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.SchemaProperty(FieldName = "Material")]
[Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes.ElementComboBox(Description = "Material", Index = 0, IsVisible = true, IsEnabled = true, Localizable = true)]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.Attributes.ValueWithName(LocalizableValue = true, Name = "Material", Level = Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.DetailLevel.General, Localizable = true)]
public Material Material
{
get
{
return _Material;
}
set
{
if (value != null && value.MaterialClass == "Metal")
{
_Material = value;
double yield = Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.RebarUtility.GetMaterialStructuralAsset(value).MinimumYieldStress;
MinimumYieldStress = Autodesk.Revit.DB.UnitUtils.ConvertFromInternalUnits(yield, DisplayUnitType.DUT_PASCALS);
}
else
{
_Material = null;
MinimumYieldStress = 0.0;
}
}
}
/// <summary>
/// Steel yield stress
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.Unit(Unit = Autodesk.Revit.DB.UnitType.UT_Stress, DisplayUnit = Autodesk.Revit.DB.DisplayUnitType.DUT_NEWTONS_PER_SQUARE_METER)]
[Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes.UnitTextBox(Description = "MinimumYieldStress", Index = 1, ValidateMinimumValue = false, ValidateMaximumValue = false, AttributeUnit = Autodesk.Revit.DB.DisplayUnitType.DUT_NEWTONS_PER_SQUARE_METER, Category = "Trans reinforcement parameters", IsVisible = true, IsEnabled = false, Localizable = true)]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.Attributes.ValueWithName(LocalizableValue = true, Name = "MinimumYieldStress", Level = Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.DetailLevel.General, Localizable = true)]
public Double MinimumYieldStress { get; set; }
RebarBarType _RebarBarType;
/// <summary>
/// RebarBarType element representing the selected rebar
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.SchemaProperty(FieldName = "RebarBarType")]
[Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes.ElementComboBox(Description = "RebarBarType", Index = 2, IsVisible = true, IsEnabled = true, Localizable = true)]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.Attributes.ValueWithName(LocalizableValue = true, Name = "RebarBarType", Level = Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.DetailLevel.General, Localizable = true)]
public RebarBarType RebarBarType
{
get
{
return _RebarBarType;
}
set
{
if (value != null && Material != null && value.get_Parameter(Autodesk.Revit.DB.BuiltInParameter.MATERIAL_ID_PARAM).AsElementId().IntegerValue == Material.Id.IntegerValue)
{
_RebarBarType = value;
BarDiameter = Autodesk.Revit.DB.UnitUtils.ConvertFromInternalUnits(value.BarDiameter, DisplayUnitType.DUT_METERS);
DeformationType = value.DeformationType == RebarDeformationType.Plain ? Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.ConcreteTypes.SteelSurface.Plain : Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.ConcreteTypes.SteelSurface.Deformed;
}
else
{
_RebarBarType = null;
BarDiameter = 0.0;
DeformationType = Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.ConcreteTypes.SteelSurface.Unknown;
}
}
}
/// <summary>
/// Steel surface(Ribbed/Plain) for the selected rebar
/// </summary>
[Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes.TextBox(Description = "DeformationType", Index = 3, IsVisible = true, IsEnabled = false, Localizable = true)]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.Attributes.ValueWithName(LocalizableValue = true, Name = "DeformationType", Level = Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.DetailLevel.General, Localizable = true)]
public Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.ConcreteTypes.SteelSurface DeformationType { get; set; }
/// <summary>
/// Rebar diameter
/// </summary>
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Attributes.Unit(Unit = Autodesk.Revit.DB.UnitType.UT_Bar_Diameter, DisplayUnit = Autodesk.Revit.DB.DisplayUnitType.DUT_METERS)]
[Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes.UnitTextBox(Description = "BarDiameter", Index = 4, ValidateMinimumValue = false, ValidateMaximumValue = false, AttributeUnit = Autodesk.Revit.DB.DisplayUnitType.DUT_METERS, IsVisible = true, IsEnabled = false, Localizable = true)]
[Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.Attributes.ValueWithName(LocalizableValue = true, Name = "BarDiameter", Level = Autodesk.Revit.DB.ExtensibleStorage.Framework.Documentation.DetailLevel.General, Localizable = true)]
public Double BarDiameter { get; set; }
/// <summary>
/// Rebar crosssection area
/// </summary>
public Double Area { get { return BarDiameter * BarDiameter * System.Math.PI / 4; } }
/// <summary>
/// Creates default RCSteelParametersSchema
/// </summary>
public RCSteelParametersSchema()
{
}
/// <summary>
/// Creates default RCSteelParametersSchema
/// </summary>
/// <param name="entity"></param>
/// <param name="document"></param>
public RCSteelParametersSchema(Entity entity, Document document)
: base(entity, document)
{
}
}
}
@@ -0,0 +1,149 @@
//
// (C) Copyright 2003-2013 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.Linq;
using System.Text;
using Autodesk.Revit.DB.ExtensibleStorage;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Structure;
namespace CodeCheckingConcreteExample.UIComponents.RCSteelParameters
{
#pragma warning disable 1591
class RCSteelParametersServerUI : Autodesk.Revit.UI.ExtensibleStorage.Framework.IServerUI
{
#region IServerUI Members
private RCSteelParametersSchema schema = null;
private void resetSchema( Autodesk.Revit.UI.ExtensibleStorage.Framework.SchemaEditorEventArgs e )
{
schema = new RCSteelParametersSchema(e.Entity as Entity, e.Document);
}
public System.Collections.IList GetDataSource(string key, Autodesk.Revit.DB.Document document, Autodesk.Revit.DB.DisplayUnitType unitType)
{
return null;
}
public void LayoutInitialized(object sender, Autodesk.Revit.UI.ExtensibleStorage.Framework.LayoutInitializedEventArgs e)
{
resetMaterialCombo(e);
}
public void ValueChanged(object sender, Autodesk.Revit.UI.ExtensibleStorage.Framework.ValueChangedEventArgs e)
{
switch((e as Autodesk.Revit.UI.ExtensibleStorage.Framework.ValueChangedEventArgs).FieldName)
{
case "Material":
onMaterialComboChange(e);
break;
case "RebarBarType":
onBarChange(e);
break;
}
}
private void resetMaterialCombo(Autodesk.Revit.UI.ExtensibleStorage.Framework.SchemaEditorEventArgs e)
{
resetSchema(e);
IList<ElementId> materials = Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.RebarUtility.GetListMaterialOfRebars(e.Document);
e.Editor.SetAttribute("Material", Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes.ComboBoxAttribute.PropertyDataSource, materials, DisplayUnitType.DUT_UNDEFINED);
e.Editor.SetValue("Material", schema.Material, DisplayUnitType.DUT_UNDEFINED);
onMaterialComboChange(e);
}
private void onMaterialComboChange(Autodesk.Revit.UI.ExtensibleStorage.Framework.SchemaEditorEventArgs e)
{
resetSchema(e);
// update barTypeCombo
// update strength field
if (schema.Material != null)
{
double yield = Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.RebarUtility.GetMaterialStructuralAsset(schema.Material).MinimumYieldStress;
yield = Autodesk.Revit.DB.UnitUtils.ConvertFromInternalUnits(yield, DisplayUnitType.DUT_PASCALS);
e.Editor.SetValue("MinimumYieldStress", yield, DisplayUnitType.DUT_PASCALS);
IList<ElementId> barsIds = Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.RebarUtility.GetListRebarForMaterial(e.Document, schema.Material.Id);
List<RebarBarType> barTypesSource = (from elementId in barsIds select e.Document.GetElement(elementId) as RebarBarType).ToList();
var btypes = barTypesSource.Select(s => new { myDiam = s.BarDiameter, mybType=s }).OrderBy(s => s.myDiam);
List<RebarBarType> bars = btypes.Select(s => s.mybType).ToList();
RebarBarType currentBar = schema.RebarBarType;
e.Editor.SetAttribute("RebarBarType", Autodesk.Revit.UI.ExtensibleStorage.Framework.Attributes.ComboBoxAttribute.PropertyDataSource, bars, DisplayUnitType.DUT_UNDEFINED);
if (currentBar == null || !barsIds.Contains(currentBar.Id))
{
e.Editor.SetValue("RebarBarType", null, DisplayUnitType.DUT_UNDEFINED);
}
else
{
e.Editor.SetValue("RebarBarType", currentBar, DisplayUnitType.DUT_UNDEFINED);
onBarChange(e);
}
}
else
{
e.Editor.SetValue("MinimumYieldStress", 0.0, DisplayUnitType.DUT_PASCALS);
}
}
private void onBarChange(Autodesk.Revit.UI.ExtensibleStorage.Framework.SchemaEditorEventArgs e)
{
resetSchema(e);
if (schema.RebarBarType != null)
{
double diameter = Autodesk.Revit.DB.UnitUtils.ConvertFromInternalUnits(schema.RebarBarType.BarDiameter, DisplayUnitType.DUT_METERS);
e.Editor.SetValue("BarDiameter", diameter, DisplayUnitType.DUT_METERS);
e.Editor.SetValue("DeformationType", schema.RebarBarType.DeformationType == RebarDeformationType.Plain ? Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.ConcreteTypes.SteelSurface.Plain : Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.ConcreteTypes.SteelSurface.Deformed, DisplayUnitType.DUT_UNDEFINED);
}
else
{
e.Editor.SetValue("BarDiameter", 0.0, DisplayUnitType.DUT_METERS);
e.Editor.SetValue("DeformationType", Autodesk.Revit.DB.CodeChecking.Engineering.Concrete.ConcreteTypes.SteelSurface.Unknown, DisplayUnitType.DUT_UNDEFINED);
}
}
#endregion
#region IResource Members
public string GetResource(string key, string context)
{
return key;
}
public Uri GetResourceImage(string key, string context)
{
return null;
}
#endregion
}
}