/// <summary> /// Example explaining how to use force modification for beam: /// additonal minimum bending moment over support M=0.1*Mmax in ULS /// </summary> /// <param name="obj">cref="BeamElement" object or cref="ColumnElement" object.</param> private void ModifySupportForces(ObjectDataBase obj) { BeamElement elem = obj as BeamElement; double maximumM = Double.MinValue; double maximumL = Double.MinValue; double minimumL = Double.MaxValue; int beginIndexSupport = -1; int endIndexSupport = -1; int index = 0; bool isMaximumM = false; foreach (SectionDataBase sd in elem.ListSectionData) { BeamSection sec = sd as BeamSection; CalcPointLinear calcPoint = sec.CalcPoint as CalcPointLinear; if (calcPoint != null) { if (maximumL < calcPoint.CoordRelative) { maximumL = calcPoint.CoordRelative; endIndexSupport = index; } if (minimumL > calcPoint.CoordRelative) { minimumL = calcPoint.CoordRelative; beginIndexSupport = index; } } if (sec != null) { foreach (InternalForcesBase forces in sec.ListInternalForces) { InternalForcesLinear f = forces as InternalForcesLinear; if (f != null) { if (f.Forces.LimitState == ForceLimitState.Uls) { if (maximumM < f.Forces.MomentMy) { maximumM = f.Forces.MomentMy; isMaximumM = true; } } } } } index++; } if (isMaximumM) { if (beginIndexSupport > -1) { BeamSection bs = elem.ListSectionData[beginIndexSupport] as BeamSection; if (bs != null) { InternalForcesLinear f = new InternalForcesLinear(); f.Forces.LimitState = ForceLimitState.Uls; f.Forces.MomentMy = 0.1 * maximumM; bs.ListInternalForces.Add(f); } } if (endIndexSupport > -1) { BeamSection bs = elem.ListSectionData[endIndexSupport] as BeamSection; if (bs != null) { InternalForcesLinear f = new InternalForcesLinear(); f.Forces.LimitState = ForceLimitState.Uls; f.Forces.MomentMy = 0.1 * maximumM; bs.ListInternalForces.Add(f); } } } }
/// <summary> /// Gives possibility to read data from Revit data base and puts them into user element's objects and into user section's objects and into user common parameters. /// </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 ReadFromRevitDB(List <ObjectDataBase> listElementData, CommonParametersBase parameters, Autodesk.Revit.DB.CodeChecking.ServiceData data) { // read additional information from Revit data and store them in user objects derived from ElementDataBase and listed in listElementData Autodesk.Revit.DB.CodeChecking.NotificationService.ProgressStart(Resources.ResourceManager.GetString("ReadingGeometry"), listElementData.Count); ElementAnalyser elementAnalyser = new ElementAnalyser(GetInputDataUnitSystem()); int step = 0; foreach (ObjectDataBase elemData in listElementData) { Element element = data.Document.GetElement(elemData.ElementId); if (element != null) { switch (elemData.Category) { default: break; case Autodesk.Revit.DB.BuiltInCategory.OST_ColumnAnalytical: { ColumnElement elem = elemData as ColumnElement; if (elem != null && !elem.Status.IsError()) { elem.Info = elementAnalyser.Analyse(element); if (elem.Info.Material.Characteristics.YoungModulus.X < Double.Epsilon) { elem.Status.AddError(Resources.ResourceManager.GetString("ErrYoungModulus")); } MaterialConcreteCharacteristics concrete = (MaterialConcreteCharacteristics)elem.Info.Material.Characteristics.Specific; if (concrete == null || concrete.Compression < Double.Epsilon) { elem.Status.AddError(Resources.ResourceManager.GetString("ErrConcreteCompression")); } foreach (SectionDataBase sectionDataBase in elem.ListSectionData) { ColumnSection sec = sectionDataBase as ColumnSection; if (sec != null) { sec.Info = elem.Info; } } } break; } case Autodesk.Revit.DB.BuiltInCategory.OST_BeamAnalytical: { BeamElement elem = elemData as BeamElement; if (elem != null && !elem.Status.IsError()) { elementAnalyser.TSectionAnalysis = false; LabelBeam labelBeam = elem.Label as LabelBeam; if (labelBeam != null) { elementAnalyser.TSectionAnalysis = labelBeam.SlabBeamInteraction == BeamSectionType.WithSlabBeamInteraction; } elem.Info = elementAnalyser.Analyse(element); if (elem.Info.Material.Characteristics.YoungModulus.X < Double.Epsilon) { elem.Status.AddError(Resources.ResourceManager.GetString("ErrYoungModulus")); } MaterialConcreteCharacteristics concrete = (MaterialConcreteCharacteristics)elem.Info.Material.Characteristics.Specific; if (concrete == null || concrete.Compression < Double.Epsilon) { elem.Status.AddError(Resources.ResourceManager.GetString("ErrConcreteCompression")); } foreach (SectionDataBase sectionDataBase in elem.ListSectionData) { BeamSection sec = sectionDataBase as BeamSection; if (sec != null) { sec.Info = elem.Info; } } } break; } } } Autodesk.Revit.DB.CodeChecking.NotificationService.ProgressStep(string.Format("{0:d}%", ++step * 100 / listElementData.Count)); if (NotificationService.ProgressBreakInvoked()) { break; } } }
/// <summary> /// Runs calculation\operations for cref="BeamElement". /// </summary> /// <param name="obj">cref="BeamElement".</param> /// <returns>Result of calculation.</returns> public bool Run(ObjectDataBase obj) { ElementDataBase elementData = obj as ElementDataBase; if (obj != null) { BeamElement objBeam = obj as BeamElement; if (objBeam != null) { CodeCheckingConcreteExample.Main.ResultBeam res = elementData.Result as CodeCheckingConcreteExample.Main.ResultBeam; if (res != null) { double young = objBeam.Info.Material.Characteristics.YoungModulus.X; double maxCoef = 0; double stifCoef = 0.0; double avrCoef = 0.0; int sectionNo = 0; foreach (SectionDataBase sd in elementData.ListSectionData) { BeamSection sec = sd as BeamSection; if (sec != null) { if (sec.MinStiffness > Double.Epsilon) { CalcPointLinear calcPoint = sec.CalcPoint as CalcPointLinear; double Iy = sec.Info.SectionsParams.AtThePoint(calcPoint.CoordRelative).Characteristics.Iy; stifCoef = (Iy * young) / sec.MinStiffness; } else { stifCoef = 0; break; } ++sectionNo; maxCoef = Math.Max(maxCoef, stifCoef); avrCoef += stifCoef; } } double finStiffnes = 0; if (stifCoef > Double.Epsilon) { avrCoef /= sectionNo; finStiffnes = 0.5 * (maxCoef + avrCoef); } else { objBeam.AddFormatedWarning(new ResultStatusMessage("Calculation of deflections was not performed.")); } foreach (SectionDataBase sd in elementData.ListSectionData) { BeamSection sec = sd as BeamSection; if (sec != null) { sec.StiffnesCoeff = finStiffnes; } } } } } return(true); }