/// <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; } }
/// <summary> /// Returns UI descriptions depends to element type and results type. /// </summary> /// <param name="elementType">Typ of element</param> /// <param name="result">Results.</param> /// <returns>Description that can be displayed on the maps and in the table.</returns> private string ResultDescription(ElementType elementType, ResultTypeSurface result) { string description = string.Empty; switch (result) { case ResultTypeSurface.AxxBottom: case ResultTypeSurface.AxxTop: case ResultTypeSurface.AyyBottom: case ResultTypeSurface.AyyTop: description = Resources.ResourceManager.GetString(elementType.ToString() + result.ToString()); break; default: description = Resources.ResourceManager.GetString(result.ToString()); break; } if (null == description) { description = result.ToString(); } return(description); }
/// <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> /// 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> /// Gives possibility to write data to Revit data base. /// </summary> /// <param name="listElementData">List of user element objects.</param> /// <param name="parameters">User common parameters.</param> /// <param name="data">Acces to cref="ServiceData".</param> public void SaveToRevitDB(List <ObjectDataBase> listElementData, CommonParametersBase parameters, Autodesk.Revit.DB.CodeChecking.ServiceData data) { Autodesk.Revit.DB.ResultsBuilder.Storage.ResultsPackageBuilder builder = Autodesk.Revit.DB.CodeChecking.Storage.StorageService.GetStorageService().GetStorageDocument(data.Document).CalculationParamsManager.CalculationParams.GetOutputResultPackageBuilder(Server.Server.ID); ForceResultsWriter resultsWriter = new ForceResultsWriter(data.Document, builder, Autodesk.Revit.DB.ResultsBuilder.UnitsSystem.Metric); foreach (ObjectDataBase objectDataBase in listElementData) { ElementDataBase elementDataBase = objectDataBase as ElementDataBase; if (!elementDataBase.Status.IsError()) { switch (elementDataBase.Category) { default: break; case Autodesk.Revit.DB.BuiltInCategory.OST_ColumnAnalytical: case Autodesk.Revit.DB.BuiltInCategory.OST_BeamAnalytical: { //TBD - RB doesn't support relative coordinates as input //Begin mod //IList<double> vx = (from sec in elementDataBase.ListSectionData select (sec as LinearSection).GetCalcResultsInPt()[ResultTypeLinear.X_Rel ]).ToList(); bool isListForces = true; foreach (LinearSection sec in elementDataBase.ListSectionData) { if (sec.ListInternalForces == null || sec.ListInternalForces.Count == 0) { isListForces = false; break; } } if (isListForces) { IList <double> xCoordinates = (from sec in elementDataBase.ListSectionData select(sec as LinearSection).GetCalcResultsInPoint()[ResultTypeLinear.X]).ToList(); //End Mod resultsWriter.SetMeasurementForElement(elementDataBase.ElementId, AxisDirection.X, xCoordinates); ResultTypeLinear[] resultTypesLinear = new ResultTypeLinear[] { ResultTypeLinear.Abottom, ResultTypeLinear.Atop, ResultTypeLinear.Aleft, ResultTypeLinear.Aright }; foreach (ResultTypeLinear forceType in resultTypesLinear) { ICollection <double> valuesInPoints = (from LinearSection section in elementDataBase.ListSectionData select section.GetCalcResultsInPoint()[forceType]).ToList(); resultsWriter.AddResultsForElement(elementDataBase.ElementId, forceType.GetResultType(), valuesInPoints); } } } break; /// <structural_toolkit_2015> case Autodesk.Revit.DB.BuiltInCategory.OST_FloorAnalytical: case Autodesk.Revit.DB.BuiltInCategory.OST_FoundationSlabAnalytical: case Autodesk.Revit.DB.BuiltInCategory.OST_WallAnalytical: IList <double> vx = (from sec in elementDataBase.ListSectionData select(sec as SurfaceSection).GetCalcResultsInPt()[ResultTypeSurface.X]).ToList(); IList <double> vy = (from sec in elementDataBase.ListSectionData select(sec as SurfaceSection).GetCalcResultsInPt()[ResultTypeSurface.Y]).ToList(); IList <double> vz = (from sec in elementDataBase.ListSectionData select(sec as SurfaceSection).GetCalcResultsInPt()[ResultTypeSurface.Z]).ToList(); resultsWriter.SetMeasurementForElement(elementDataBase.ElementId, AxisDirection.X, vx); resultsWriter.SetMeasurementForElement(elementDataBase.ElementId, AxisDirection.Y, vy); resultsWriter.SetMeasurementForElement(elementDataBase.ElementId, AxisDirection.Z, vz); ResultTypeSurface[] vType = new ResultTypeSurface[] { ResultTypeSurface.AxxBottom, ResultTypeSurface.AxxTop, ResultTypeSurface.AyyBottom, ResultTypeSurface.AyyTop }; foreach (ResultTypeSurface forceType in vType) { ICollection <double> vVal = (from sec in elementDataBase.ListSectionData select(sec as SurfaceSection).GetCalcResultsInPt()[forceType]).ToList(); resultsWriter.AddResultsForElement(elementDataBase.ElementId, forceType.GetResultType(), vVal); } break; /// </structural_toolkit_2015> } } } resultsWriter.StoreResultsInResultsBuilder("RCCalculationsResults"); }