added Revit 2020 SDK files

This commit is contained in:
Jeremy Tammik
2019-09-11 14:43:53 +02:00
parent fbb29172ed
commit 8b8832b7be
2956 changed files with 938523 additions and 0 deletions
@@ -0,0 +1,335 @@
//
// (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;
/// <structural_toolkit_2015>
namespace CodeCheckingConcreteExample.Utility
{
/// <summary>
/// Simple utility class for creation maps in the report.
/// </summary>
class MapDataGenerator
{
/// <summary>
/// Transformation flag
/// </summary>
bool isTransformed = false;
/// <summary>
/// List of values
/// </summary>
private List<double> _Values = new List<double>();
/// <summary>
/// List of oryginal 3D points
/// </summary>
private List<XYZ> _Points = new List<XYZ>();
/// <summary>
/// List of indexes of points on the contour (map edge)
/// </summary>
private List<int> _PointsOnContour = new List<int>();
/// <summary>
/// List of indexes of points on the edge of holes
/// </summary>
private List<List<int>> _PointsOnHoles = new List<List<int>>();
/// <summary>
/// List of transformed 3D points
/// </summary>
private List<XYZ> _vPointsTransformed = new List<XYZ>();
/// <summary>
/// List of transformed 2D points
/// </summary>
private List<UV> _vPoints2d = new List<UV>();
/// <summary>
/// Returns result values for all points
/// </summary>
public List<double> Values { get { return _Values; } }
/// <summary>
/// Returns number of holes
/// </summary>
public int HolesCount { get { return _PointsOnHoles.Count; } }
/// <summary>
/// returns number of points
/// </summary>
public int Count { get { return _Values.Count; } }
/// <summary>
/// Returns indexes of points for all holes
/// </summary>
public List<List<int>>Holes { get { return _PointsOnHoles; } }
/// <summary>
/// Returns indexes of points for external contour (edge of map)
/// </summary>
public List<int> Contour { get { return _PointsOnContour; } }
/// <summary>
/// Creates default MapDataGenerator
/// </summary>
public MapDataGenerator() {}
/// <summary>
/// Clear all internal data
/// </summary>
public void Clear()
{
_Points.Clear();
_Values.Clear();
_PointsOnContour.Clear();
_PointsOnHoles.Clear();
isTransformed = false;
}
/// <summary>
/// Adds new point with value to the colection.
/// </summary>
/// <param name="point">Position of point</param>
/// <param name="value">Result values in the point</param>
public void AddPoint (XYZ point, double value)
{
_Points.Add(point);
_Values.Add(value);
isTransformed = false;
}
/// <summary>
/// Adds new points to the colection of external contour (map edge).
/// </summary>
/// <param name="points">Position of points</param>
public void AddContour(List<XYZ> points)
{
foreach (XYZ point in points)
{
AddPointToContour(point);
}
}
/// <summary>
/// Adds new point to the colection of external contour (map edge).
/// </summary>
/// <param name="point">Position of point</param>
/// <remarks>If point exist in the points collection is taken into accout as edge of hole. If not new point is adds and set zero value for it.</remarks>
/// <remarks>Sets the transformation flag on "false" if necessary</remarks>
public void AddPointToContour(XYZ point)
{
int indexPoints = _PointsOnContour.FindIndex(o => _Points[o].IsAlmostEqualTo(point, 1e-6));
if (indexPoints < 0)
{
indexPoints = _Points.FindIndex(o => o.IsAlmostEqualTo(point, 1e-6));
if (indexPoints < 0)
{
_PointsOnContour.Add(_Points.Count());
_Points.Add(point);
_Values.Add(0.0);
isTransformed = false;
}
else
_PointsOnContour.Add(indexPoints);
}
}
/// <summary>
/// Creates new hole and adds new points to this hole
/// </summary>
/// <param name="points">Position of points</param>
public void AddHole(List<XYZ> points)
{
int nextHole = _PointsOnHoles.Count;
foreach (XYZ point in points)
{
AddPointToHole(point,nextHole);
}
}
/// <summary>
/// Creates new or modifies existing hole and adds new point to this hole
/// </summary>
/// <param name="point">Position of point</param>
/// <param name="holeItem">Hole number</param>
/// <remarks>If point exist in the points collection is taken into accout as edge of hole. If not new point is adds and set zero value for it.</remarks>
/// <remarks>Sets the transformation flag on "false" if necessary</remarks>
public void AddPointToHole(XYZ point, int holeItem)
{
if (holeItem > _PointsOnHoles.Count())
throw new ArgumentException("Item out of range", "holeItem");
List<int> hole = (holeItem == _PointsOnHoles.Count()) ? new List<int>() : _PointsOnHoles[holeItem];
int indexPoints = hole.FindIndex(o => _Points[o].IsAlmostEqualTo(point, 1e-6));
if (indexPoints < 0)
{
indexPoints = _Points.FindIndex(o => o.IsAlmostEqualTo(point, 1e-6));
if (indexPoints < 0)
{
hole.Add(_Points.Count());
_Points.Add(point);
_Values.Add(0.0);
isTransformed = false;
}
else
hole.Add(indexPoints);
}
if (holeItem == _PointsOnHoles.Count())
_PointsOnHoles.Add(hole);
}
/// <summary>
/// Returns 2D position for point on the map
/// </summary>
/// <param name="item">Points number</param>
public UV GetPoint(int item)
{
if (!isTransformed)
transform();
return _vPoints2d[item];
}
/// <summary>
/// Returns value for point on the map
/// </summary>
/// <param name="item">Points number</param>
public double GetValue(int item)
{
if (!isTransformed)
transform();
return _Values[item];
}
/// <summary>
/// Transform if necessary, and returns transformed points.
/// </summary>
/// <returns>Transformed points to maps LCS</returns>
public List<XYZ> PointsTransformed()
{
if (!isTransformed)
transform();
return _vPointsTransformed;
}
/// <summary>
/// Transform if necessary, and returns 2D transformed points.
/// </summary>
/// <returns>Transformed points to maps LCS in 2D</returns>
public List<UV> Points2d()
{
if (!isTransformed)
transform();
return _vPoints2d;
}
/// <summary>
/// Transform all points.
/// </summary>
/// <remarks>Sets the transformation flag on "true"</remarks>
private void transform()
{
transform2Plane();
transform22D();
isTransformed = true;
}
/// <summary>
/// Transform all 3D points to the plane.
/// </summary>
private void transform2Plane()
{
if (_Points.Count > 2)
{
if ((_Points.Max(s => s.Z) - _Points.Min(s => s.Z)) < 1.0e-6)
{
_vPointsTransformed = new List<XYZ>(_Points);
}
else
{
XYZ v1 = _Points[1] - _Points[0],
v2 = _Points[2] - _Points[1],
n = v1.CrossProduct(v2).Normalize(),
p0 = _Points[0];
for (int i = 0; i < 2; i++)
{
bool bContour = i == 0;
List<XYZ> vSrc = _Points,
vTar = _vPointsTransformed;
foreach (XYZ pt in vSrc)
{
XYZ u = pt - p0,
u1 = u - n.Multiply(u.DotProduct(n));
vTar.Add(p0 + u1);
}
}
}
}
}
/// <summary>
/// Transform all 3D points to the 2D points.
/// </summary>
private void transform22D()
{
if (_Points.Count > 2)
{
var zdist = _Points.Select(s => s.Z).Distinct();
if ((_Points.Max(s => s.Z) - _Points.Min(s => s.Z)) < 1.0e-6 )
{
_vPoints2d = _Points.Select(s => new UV(s.X, s.Y)).ToList();
UV move = new UV(_vPoints2d.Min(s => s.U), _vPoints2d.Min(s => s.V));
_vPoints2d = _vPoints2d.Select( s=>( new UV( s.U-move.U, s.V-move.V))).ToList();
}
else
{
int indLast = _Points.Count - 1;
XYZ vX = null;
for (int i = 0; i <= indLast; i++)
{
vX = (_Points[i] - _Points[0]).Normalize();
if (!vX.IsZeroLength())
{
break;
}
}
XYZ vY = null;
for (int i = indLast; i >= 0; i--)
{
XYZ v2 = _Points[0] - _Points[i],
vZ = vX.CrossProduct(v2).Normalize();
if (!vZ.IsZeroLength())
{
vY = vZ.CrossProduct(vX);
break;
}
}
{
XYZ p0 = _Points[0];
List<XYZ> vSrc = _vPointsTransformed;
List<UV> vTar = _vPoints2d;
foreach (XYZ pt in vSrc)
{
XYZ u = pt - p0;
vTar.Add( new UV(u.DotProduct(vX), u.DotProduct(vY) ) );
}
}
}
}
}
}
}
/// </structural_toolkit_2015>
@@ -0,0 +1,378 @@
//
// (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;
namespace CodeCheckingConcreteExample.Utility
{
/// <summary>
/// Type of results for rc section
/// </summary>
public enum ResultTypeLinear
{
/// <summary>
/// linear position(absolute)
/// </summary>
X,
/// <summary>
/// linear position(relative)
/// </summary>
X_Rel,
/// <summary>
/// Bending moment , x-axis, min value
/// </summary>
MxMin,
/// <summary>
/// Bending moment , x-axis, max value
/// </summary>
MxMax,
/// <summary>
/// Bending moment , y-axis, min value
/// </summary>
MyMin,
/// <summary>
/// Bending moment , y-axis, max value
/// </summary>
MyMax,
/// <summary>
/// Bending moment , z-axis, min value
/// </summary>
MzMin,
/// <summary>
/// Bending moment , z-axis, max value
/// </summary>
MzMax,
/// <summary>
/// Transversal force , x-direction, min value
/// </summary>
FxMin,
/// <summary>
/// Transversal force , x-direction, max value
/// </summary>
FxMax,
/// <summary>
/// Transversal force , y-direction, min value
/// </summary>
FyMin,
/// <summary>
/// Transversal force , y-direction, max value
/// </summary>
FyMax,
/// <summary>
/// Transversal force , z-direction, min value
/// </summary>
FzMin,
/// <summary>
/// Transversal force , z-direction, max value
/// </summary>
FzMax,
/// <summary>
/// Longitudinal reinforcement, bottom
/// </summary>
Abottom,
/// <summary>
/// Longitudinal reinforcement, top
/// </summary>
Atop,
/// <summary>
/// Longitudinal reinforcement, left
/// </summary>
Aleft,
/// <summary>
/// Longitudinal reinforcement, right
/// </summary>
Aright,
/// <summary>
/// Stirrups spacing
/// </summary>
StirrupsSpacing,
/// <summary>
/// Transversal reinforcement density
/// </summary>
TransversalReinforcemenDensity,
/// <summary>
/// Deflection, x-direction, min value
/// </summary>
UxMin,
/// <summary>
/// Deflection, x-direction, max value
/// </summary>
UxMax,
/// <summary>
/// Deflection, y-direction, min value
/// </summary>
UyMin,
/// <summary>
/// Deflection, y-direction, max value
/// </summary>
UyMax,
/// <summary>
/// Deflection, z-direction, min value
/// </summary>
UzMin,
/// <summary>
/// Deflection, z-direction, max value
/// </summary>
UzMax,
/// <summary>
/// Calculated deflection, x-direction, max value
/// </summary>
UxRealMin,
/// <summary>
/// Calculated deflection, x-direction, min value
/// </summary>
UxRealMax,
/// <summary>
/// Calculated deflection, y-direction, max value
/// </summary>
UyRealMin,
/// <summary>
/// Calculated deflection, y-direction, min value
/// </summary>
UyRealMax,
/// <summary>
/// Calculated deflection, z-direction, max value
/// </summary>
UzRealMin,
/// <summary>
/// Calculated deflection, z-direction, min value
/// </summary>
UzRealMax,
}
static class ResultTypeLinearHelper
{
/// <summary>
/// Converts value from cref="ResultTypeLinear" into value from cref="ResultType".
/// </summary>
/// <param name="forceType">Type of force.</param>
/// <returns>Type of result.</returns>
static public Autodesk.Revit.DB.CodeChecking.Engineering.ResultType GetResultType(this ResultTypeLinear forceType)
{
Autodesk.Revit.DB.CodeChecking.Engineering.ResultType resultType = Autodesk.Revit.DB.CodeChecking.Engineering.ResultType.Unknown;
switch (forceType)
{
// reinforcement
case ResultTypeLinear.Abottom: resultType = Autodesk.Revit.DB.CodeChecking.Engineering.ResultType.Abottom; break;
case ResultTypeLinear.Atop: resultType = Autodesk.Revit.DB.CodeChecking.Engineering.ResultType.Atop; break;
case ResultTypeLinear.Aleft: resultType = Autodesk.Revit.DB.CodeChecking.Engineering.ResultType.Aleft; break;
case ResultTypeLinear.Aright: resultType = Autodesk.Revit.DB.CodeChecking.Engineering.ResultType.Aright; break;
// deflection
case ResultTypeLinear.UxRealMax: resultType = Autodesk.Revit.DB.CodeChecking.Engineering.ResultType.UxMax; break;
case ResultTypeLinear.UxRealMin: resultType = Autodesk.Revit.DB.CodeChecking.Engineering.ResultType.UxMin; break;
case ResultTypeLinear.UyRealMax: resultType = Autodesk.Revit.DB.CodeChecking.Engineering.ResultType.UyMax; break;
case ResultTypeLinear.UyRealMin: resultType = Autodesk.Revit.DB.CodeChecking.Engineering.ResultType.UyMin; break;
case ResultTypeLinear.UzRealMax: resultType = Autodesk.Revit.DB.CodeChecking.Engineering.ResultType.UzMax; break;
case ResultTypeLinear.UzRealMin: resultType = Autodesk.Revit.DB.CodeChecking.Engineering.ResultType.UzMin; break;
}
return resultType;
}
/// <summary>
/// Gets unit for a specific Result type
/// </summary>
/// <param name="forceType"></param>
/// <returns></returns>
static public UnitType GetUnitType(this ResultTypeLinear forceType)
{
return ResultInPointLinear.ValueType[(int)forceType];
}
/// <summary>
/// Gets reinforcement result types
/// </summary>
static public List<ResultTypeLinear> ReinforcementResults
{
get { return new List<ResultTypeLinear> { ResultTypeLinear.Abottom, ResultTypeLinear.Aleft, ResultTypeLinear.Aright, ResultTypeLinear.Atop, ResultTypeLinear.StirrupsSpacing, ResultTypeLinear.TransversalReinforcemenDensity }; }
}
/// <summary>
/// Gets displacement result types
/// </summary>
static public List<ResultTypeLinear> DisplacementResults
{
get
{
return new List<ResultTypeLinear>
{
ResultTypeLinear.UxMax, ResultTypeLinear.UxMin,
ResultTypeLinear.UyMax, ResultTypeLinear.UyMin,
ResultTypeLinear.UzMax, ResultTypeLinear.UzMin,
};
}
}
/// <summary>
/// Gets real deflection result types
/// </summary>
static public List<ResultTypeLinear> RealDeflectionResults
{
get
{
return new List<ResultTypeLinear>
{
ResultTypeLinear.UxRealMax, ResultTypeLinear.UxRealMin,
ResultTypeLinear.UyRealMax, ResultTypeLinear.UyRealMin,
ResultTypeLinear.UzRealMax, ResultTypeLinear.UzRealMin
};
}
}
/// <summary>
/// Gets internal forces result types
/// </summary>
static public List<ResultTypeLinear> InternalForcesResults
{
get
{
return new List<ResultTypeLinear>
{
ResultTypeLinear.FxMin, ResultTypeLinear.FxMax, ResultTypeLinear.FyMin, ResultTypeLinear.FyMax, ResultTypeLinear.FzMin, ResultTypeLinear.FzMax,
};
}
}
/// <summary>
/// Gets internal moments result types
/// </summary>
static public List<ResultTypeLinear> InternalMomentsResults
{
get
{
return new List<ResultTypeLinear>
{
ResultTypeLinear.MxMin, ResultTypeLinear.MxMax, ResultTypeLinear.MyMin, ResultTypeLinear.MyMax, ResultTypeLinear.MzMin, ResultTypeLinear.MzMax,
};
}
}
}
/// <summary>
/// Result Format
/// </summary>
public enum ResultFormat
{
/// <summary>
/// Internal format in which data is stored internally
/// </summary>
Internal,
/// <summary>
/// External format in which data is presented on UI
/// </summary>
External
};
/// <summary>
/// Container representing analitical results in RC bar section
/// Results are represented as numbers along with their respective units
/// </summary>
public class ResultInPointLinear
{
private double[] data = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
static internal UnitType[] ValueType = new UnitType[] { UnitType.UT_Length,
UnitType.UT_Number,
UnitType.UT_Moment,
UnitType.UT_Moment,
UnitType.UT_Moment,
UnitType.UT_Moment,
UnitType.UT_Moment,
UnitType.UT_Moment,
UnitType.UT_Force,
UnitType.UT_Force,
UnitType.UT_Force,
UnitType.UT_Force,
UnitType.UT_Force,
UnitType.UT_Force,
UnitType.UT_Reinforcement_Area,
UnitType.UT_Reinforcement_Area,
UnitType.UT_Reinforcement_Area,
UnitType.UT_Reinforcement_Area,
UnitType.UT_Section_Dimension,
UnitType.UT_Reinforcement_Area_per_Unit_Length,
UnitType.UT_Displacement_Deflection,
UnitType.UT_Displacement_Deflection,
UnitType.UT_Displacement_Deflection,
UnitType.UT_Displacement_Deflection,
UnitType.UT_Displacement_Deflection,
UnitType.UT_Displacement_Deflection,
UnitType.UT_Displacement_Deflection,
UnitType.UT_Displacement_Deflection,
UnitType.UT_Displacement_Deflection,
UnitType.UT_Displacement_Deflection,
UnitType.UT_Displacement_Deflection,
UnitType.UT_Displacement_Deflection,
};
/// <summary>
/// Creates default ResultInPointLinear
/// </summary>
public ResultInPointLinear() { }
/// <summary>
/// Creates default ResultInPointLinear
/// </summary>
/// <param name="data">List of result according to ResultTypeLinear order</param>
public ResultInPointLinear(IEnumerable<double> data) { DataRaw = data.ToArray(); }
/// <summary>
/// Access to the raw format of section results
/// </summary>
public double[] DataRaw
{
get { return data; }
set
{
int reqSize = Enum.GetValues(typeof(ResultTypeLinear)).Length;
if (value.Count() != reqSize)
{
throw new ArgumentException("Value list lenght should be equal to " + reqSize);
}
else
{
data = value;
}
}
}
/// <summary>
/// Access to a specific result
/// </summary>
/// <param name="type">Result type</param>
/// <returns>Formatted result value</returns>
public double this[ResultTypeLinear type]
{
get { return data[(int)type]; }
set
{
if (Double.IsNaN(value))
{
throw new ArgumentOutOfRangeException(type.ToString() + "Cannot be NAN");
}
data[(int)type] = value;
}
}
}
}
@@ -0,0 +1,356 @@
//
// (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;
/// <structural_toolkit_2015>
namespace CodeCheckingConcreteExample.Utility
{
/// <summary>
/// Type of results for rc section
/// </summary>
public enum ResultTypeSurface
{
/// <summary>
/// X position (absolute)
/// </summary>
X,
/// <summary>
/// Y position (absolute)
/// </summary>
Y,
/// <summary>
/// Z position (absolute)
/// </summary>
Z,
/// <summary>
/// Bending moment , x-axis, min value [moment per unit length]
/// </summary>
MxxMin,
/// <summary>
/// Bending moment , x-axis, max value [moment per unit length]
/// </summary>
MxxMax,
/// <summary>
/// Bending moment , y-axis, min value [moment per unit length]
/// </summary>
MyyMin,
/// <summary>
/// Bending moment , x-axis, min value [moment per unit length]
/// </summary>
MyyMax,
/// <summary>
/// Twisting moments, , x-axis/y-axis, min value [moment per unit length]
/// </summary>
MxyMin,
/// <summary>
/// Twisting moments, , x-axis/y-axis, min value [moment per unit length]
/// </summary>
MxyMax,
/// <summary>
/// In-plane forces tension/compresion , x-direction, max value [moment per unit length]
/// </summary>
FxxMin,
/// <summary>
/// In-plane forces tension/compresion, x-direction, min value [force per unit length]
/// </summary>
FxxMax,
/// <summary>
/// In-plane forces tension/compresion, y-direction, max value [force per unit length]
/// </summary>
FyyMin,
/// <summary>
/// In-plane forces tension/compresion, y-direction, min value [force per unit length]
/// </summary>
FyyMax,
/// <summary>
/// In-plane shear forces , y-direction, max value [force per unit length]
/// </summary>
FxyMin,
/// <summary>
/// In-plane shear forces , y-direction, min value [force per unit length]
/// </summary>
FxyMax,
/// <summary>
/// Shear forces , x-direction, max value [force per unit length]
/// </summary>
QxxMin,
/// <summary>
/// Shear forces , x-direction, min value [force per unit length]
/// </summary>
QxxMax,
/// <summary>
/// Shear forces , y-direction, max value [force per unit length]
/// </summary>
QyyMin,
/// <summary>
/// Shear forces , y-direction, max value [force per unit length]
/// </summary>
QyyMax,
/// <summary>
/// Longitudinal reinforcement, bottom [area per unit length], according to Mxx
/// </summary>
AxxBottom,
/// <summary>
/// Longitudinal reinforcement, top [area per unit length], according to Mxx
/// </summary>
AxxTop,
/// <summary>
/// Longitudinal reinforcement, bottom [area per unit length], according to Myy
/// </summary>
AyyBottom,
/// <summary>
/// Longitudinal reinforcement, top [area per unit length], according to Myy
/// </summary>
AyyTop,
/// <summary>
/// Deflection, z-direction, max value
/// </summary>
UzMax,
/// <summary>
/// Deflection, z-direction, min value
/// </summary>
UzMin,
/// <summary>
/// Calculated deflection, z-direction, min value
/// </summary>
UzRealMax,
/// <summary>
/// Calculated deflection, z-direction, max value
/// </summary>
UzRealMin,
}
static class ResultTypeSurfaceHelper
{
/// <summary>
/// Converts value from cref="ResultTypeSurface" into value from cref="ResultType".
/// </summary>
/// <param name="forceType">Type of force.</param>
/// <returns>Type of result.</returns>
static public Autodesk.Revit.DB.CodeChecking.Engineering.ResultType GetResultType(this ResultTypeSurface forceType)
{
Autodesk.Revit.DB.CodeChecking.Engineering.ResultType resultType = Autodesk.Revit.DB.CodeChecking.Engineering.ResultType.Unknown;
switch (forceType)
{
// reinforcement
case ResultTypeSurface.AxxBottom: resultType = Autodesk.Revit.DB.CodeChecking.Engineering.ResultType.AxxBottom; break;
case ResultTypeSurface.AxxTop: resultType = Autodesk.Revit.DB.CodeChecking.Engineering.ResultType.AxxTop; break;
case ResultTypeSurface.AyyBottom: resultType = Autodesk.Revit.DB.CodeChecking.Engineering.ResultType.AyyBottom; break;
case ResultTypeSurface.AyyTop: resultType = Autodesk.Revit.DB.CodeChecking.Engineering.ResultType.AyyTop; break;
// deflection
///TMP
///
/*
case ResultTypeSurface.UxRealMax: resultType = Autodesk.Revit.DB.CodeChecking.Engineering.ResultType.UxMax; break;
case ResultTypeSurface.UxRealMin: resultType = Autodesk.Revit.DB.CodeChecking.Engineering.ResultType.UxMin; break;
case ResultTypeSurface.UyRealMax: resultType = Autodesk.Revit.DB.CodeChecking.Engineering.ResultType.UyMax; break;
case ResultTypeSurface.UyRealMin: resultType = Autodesk.Revit.DB.CodeChecking.Engineering.ResultType.UyMin; break;
case ResultTypeSurface.UzRealMax: resultType = Autodesk.Revit.DB.CodeChecking.Engineering.ResultType.UzMax; break;
case ResultTypeSurface.UzRealMin: resultType = Autodesk.Revit.DB.CodeChecking.Engineering.ResultType.UzMin; break;
* */
}
return resultType;
}
/// <summary>
/// Gets unit for a specific Result type
/// </summary>
/// <param name="forceType"></param>
/// <returns></returns>
static public UnitType GetUnitType(this ResultTypeSurface forceType)
{
return ResultInPointSurface.ValueType[(int)forceType];
}
/// <summary>
/// Gets reinforcement result types
/// </summary>
static public List<ResultTypeSurface> ReinforcementResults
{
get { return new List<ResultTypeSurface> { ResultTypeSurface.AxxBottom, ResultTypeSurface.AxxTop, ResultTypeSurface.AyyBottom, ResultTypeSurface.AxxTop}; }
}
/// <summary>
/// Gets displacement result types
/// </summary>
static public List<ResultTypeSurface> DisplacementResults
{
get
{
return new List<ResultTypeSurface>
{
ResultTypeSurface.UzMax, ResultTypeSurface.UzMin,
};
}
}
/// <summary>
/// Gets real deflection result types
/// </summary>
static public List<ResultTypeSurface> RealDeflectionResults
{
get
{
return new List<ResultTypeSurface>
{
ResultTypeSurface.UzRealMax, ResultTypeSurface.UzRealMin,
};
}
}
/// <summary>
/// Gets base internal forces result types
/// </summary>
static public List<ResultTypeSurface> InternalForcesResults
{
get
{
return new List<ResultTypeSurface>
{
ResultTypeSurface.FxxMin, ResultTypeSurface.FxxMax, ResultTypeSurface.FyyMin, ResultTypeSurface.FyyMax,
};
}
}
/// <summary>
/// Gets all internal forces result types
/// </summary>
static public List<ResultTypeSurface> InternalForcesResultsAll
{
get
{
return new List<ResultTypeSurface>
{
ResultTypeSurface.FxxMin, ResultTypeSurface.FxxMax, ResultTypeSurface.FyyMin, ResultTypeSurface.FyyMax, ResultTypeSurface.FxyMin, ResultTypeSurface.FxyMax,
};
}
}
/// <summary>
/// Gets base internal moments result types
/// </summary>
static public List<ResultTypeSurface> InternalMomentsResults
{
get
{
return new List<ResultTypeSurface>
{
ResultTypeSurface.MxxMin, ResultTypeSurface.MxxMax, ResultTypeSurface.MyyMin, ResultTypeSurface.MyyMax
};
}
}
/// <summary>
/// Gets all internal moments result types
/// </summary>
static public List<ResultTypeSurface> InternalMomentsResultsAll
{
get
{
return new List<ResultTypeSurface>
{
ResultTypeSurface.MxxMin, ResultTypeSurface.MxxMax, ResultTypeSurface.MyyMin, ResultTypeSurface.MyyMax, ResultTypeSurface.MxyMin, ResultTypeSurface.MxyMax,
};
}
}
}
/// <summary>
/// Container representing analitical results in RC surface section
/// Results are represented as numbers along with their respective units
/// </summary>
public class ResultInPointSurface
{
private double[] data = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
static internal UnitType[] ValueType = new UnitType[] { UnitType.UT_Length,
UnitType.UT_Length,
UnitType.UT_Length,
UnitType.UT_LinearMoment,
UnitType.UT_LinearMoment,
UnitType.UT_LinearMoment,
UnitType.UT_LinearMoment,
UnitType.UT_LinearMoment,
UnitType.UT_LinearMoment,
UnitType.UT_LinearForce,
UnitType.UT_LinearForce,
UnitType.UT_LinearForce,
UnitType.UT_LinearForce,
UnitType.UT_LinearForce,
UnitType.UT_LinearForce,
UnitType.UT_LinearForce,
UnitType.UT_LinearForce,
UnitType.UT_LinearForce,
UnitType.UT_LinearForce,
UnitType.UT_Reinforcement_Area_per_Unit_Length,
UnitType.UT_Reinforcement_Area_per_Unit_Length,
UnitType.UT_Reinforcement_Area_per_Unit_Length,
UnitType.UT_Reinforcement_Area_per_Unit_Length,
UnitType.UT_Displacement_Deflection,
UnitType.UT_Displacement_Deflection,
UnitType.UT_Displacement_Deflection,
UnitType.UT_Displacement_Deflection};
/// <summary>
/// Creates default ResultInPointSurface
/// </summary>
public ResultInPointSurface() { }
/// <summary>
/// Creates default ResultInPointLinear
/// </summary>
/// <param name="data">List of result according to ResultTypeSurface order</param>
public ResultInPointSurface(IEnumerable<double> data) { DataRaw = data.ToArray(); }
/// <summary>
/// Access to the raw format of surface section results
/// </summary>
public double[] DataRaw {
get { return data; }
set {
int reqSize = Enum.GetValues(typeof(ResultTypeSurface)).Length;
if (value.Count() != reqSize)
{
throw new ArgumentException("Value list lenght should be equal to " + reqSize);
}
else
{
data = value;
}
}
}
/// <summary>
/// Access to a specific result
/// </summary>
/// <param name="type">Result type</param>
/// <returns>Formatted result value</returns>
public double this[ResultTypeSurface type]
{
get { return data[(int)type]; }
set
{
if (Double.IsNaN(value))
{
throw new ArgumentOutOfRangeException(type.ToString() + "Cannot be NAN");
}
data[(int)type] = value;
}
}
}
}
/// </structural_toolkit_2015>
@@ -0,0 +1,62 @@
//
// (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;
namespace CodeCheckingConcreteExample.Utility
{
/// <summary>
/// Simple utility class for conversion between external and internal units
/// Internal units are those used internally by RCCServer and defined by ResultBuilder
/// </summary>
public class UnitsConverter
{
/// <summary>
/// Gets internal unit for a given unit type
/// </summary>
/// <param name="unitType">UnitType object</param>
/// <returns>Internal unit</returns>
static public DisplayUnitType GetInternalUnit(UnitType unitType)
{
if (unitType == UnitType.UT_Moment) { return DisplayUnitType.DUT_NEWTON_METERS; }
else if (unitType == UnitType.UT_Force) { return DisplayUnitType.DUT_NEWTONS; }
else if (unitType == UnitType.UT_Reinforcement_Area) { return DisplayUnitType.DUT_SQUARE_METERS; }
else if (unitType == UnitType.UT_Length) { return DisplayUnitType.DUT_METERS; }
else if (unitType == UnitType.UT_Section_Dimension) { return DisplayUnitType.DUT_METERS; }
else if (unitType == UnitType.UT_LinearForce) { return DisplayUnitType.DUT_NEWTONS_PER_METER; }
else if (unitType == UnitType.UT_LinearMoment) { return DisplayUnitType.DUT_NEWTON_METERS_PER_METER; }
else if (unitType == UnitType.UT_Reinforcement_Area_per_Unit_Length) { return DisplayUnitType.DUT_SQUARE_METERS_PER_METER; }
else if (unitType == UnitType.UT_Displacement_Deflection) { return DisplayUnitType.DUT_METERS; }
else if (unitType == UnitType.UT_Stress) { return DisplayUnitType.DUT_NEWTONS_PER_SQUARE_METER; }
else if (unitType == UnitType.UT_Bar_Diameter) { return DisplayUnitType.DUT_METERS; }
else return DisplayUnitType.DUT_UNDEFINED;
}
}
}