// // (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 { /// /// Type of results for rc section /// public enum ResultTypeSurface { /// /// X position (absolute) /// X, /// /// Y position (absolute) /// Y, /// /// Z position (absolute) /// Z, /// /// Bending moment , x-axis, min value [moment per unit length] /// MxxMin, /// /// Bending moment , x-axis, max value [moment per unit length] /// MxxMax, /// /// Bending moment , y-axis, min value [moment per unit length] /// MyyMin, /// /// Bending moment , x-axis, min value [moment per unit length] /// MyyMax, /// /// Twisting moments, , x-axis/y-axis, min value [moment per unit length] /// MxyMin, /// /// Twisting moments, , x-axis/y-axis, min value [moment per unit length] /// MxyMax, /// /// In-plane forces tension/compresion , x-direction, max value [moment per unit length] /// FxxMin, /// /// In-plane forces tension/compresion, x-direction, min value [force per unit length] /// FxxMax, /// /// In-plane forces tension/compresion, y-direction, max value [force per unit length] /// FyyMin, /// /// In-plane forces tension/compresion, y-direction, min value [force per unit length] /// FyyMax, /// /// In-plane shear forces , y-direction, max value [force per unit length] /// FxyMin, /// /// In-plane shear forces , y-direction, min value [force per unit length] /// FxyMax, /// /// Shear forces , x-direction, max value [force per unit length] /// QxxMin, /// /// Shear forces , x-direction, min value [force per unit length] /// QxxMax, /// /// Shear forces , y-direction, max value [force per unit length] /// QyyMin, /// /// Shear forces , y-direction, max value [force per unit length] /// QyyMax, /// /// Longitudinal reinforcement, bottom [area per unit length], according to Mxx /// AxxBottom, /// /// Longitudinal reinforcement, top [area per unit length], according to Mxx /// AxxTop, /// /// Longitudinal reinforcement, bottom [area per unit length], according to Myy /// AyyBottom, /// /// Longitudinal reinforcement, top [area per unit length], according to Myy /// AyyTop, /// /// Deflection, z-direction, max value /// UzMax, /// /// Deflection, z-direction, min value /// UzMin, /// /// Calculated deflection, z-direction, min value /// UzRealMax, /// /// Calculated deflection, z-direction, max value /// UzRealMin, } static class ResultTypeSurfaceHelper { /// /// Converts value from cref="ResultTypeSurface" into value from cref="ResultType". /// /// Type of force. /// Type of result. 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; } /// /// Gets unit for a specific Result type /// /// /// static public UnitType GetUnitType(this ResultTypeSurface forceType) { return ResultInPointSurface.ValueType[(int)forceType]; } /// /// Gets reinforcement result types /// static public List ReinforcementResults { get { return new List { ResultTypeSurface.AxxBottom, ResultTypeSurface.AxxTop, ResultTypeSurface.AyyBottom, ResultTypeSurface.AxxTop}; } } /// /// Gets displacement result types /// static public List DisplacementResults { get { return new List { ResultTypeSurface.UzMax, ResultTypeSurface.UzMin, }; } } /// /// Gets real deflection result types /// static public List RealDeflectionResults { get { return new List { ResultTypeSurface.UzRealMax, ResultTypeSurface.UzRealMin, }; } } /// /// Gets base internal forces result types /// static public List InternalForcesResults { get { return new List { ResultTypeSurface.FxxMin, ResultTypeSurface.FxxMax, ResultTypeSurface.FyyMin, ResultTypeSurface.FyyMax, }; } } /// /// Gets all internal forces result types /// static public List InternalForcesResultsAll { get { return new List { ResultTypeSurface.FxxMin, ResultTypeSurface.FxxMax, ResultTypeSurface.FyyMin, ResultTypeSurface.FyyMax, ResultTypeSurface.FxyMin, ResultTypeSurface.FxyMax, }; } } /// /// Gets base internal moments result types /// static public List InternalMomentsResults { get { return new List { ResultTypeSurface.MxxMin, ResultTypeSurface.MxxMax, ResultTypeSurface.MyyMin, ResultTypeSurface.MyyMax }; } } /// /// Gets all internal moments result types /// static public List InternalMomentsResultsAll { get { return new List { ResultTypeSurface.MxxMin, ResultTypeSurface.MxxMax, ResultTypeSurface.MyyMin, ResultTypeSurface.MyyMax, ResultTypeSurface.MxyMin, ResultTypeSurface.MxyMax, }; } } } /// /// Container representing analitical results in RC surface section /// Results are represented as numbers along with their respective units /// 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}; /// /// Creates default ResultInPointSurface /// public ResultInPointSurface() { } /// /// Creates default ResultInPointLinear /// /// List of result according to ResultTypeSurface order public ResultInPointSurface(IEnumerable data) { DataRaw = data.ToArray(); } /// /// Access to the raw format of surface section results /// 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; } } } /// /// Access to a specific result /// /// Result type /// Formatted result value 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; } } } } ///