/// <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> /// Simple buckling effect calculation: /// This is only example: braced (non-sway) structure and single curvature! /// </summary> /// <param name="obj">cref="BeamElement" object or cref="ColumnElement" object.</param> private void ModifyForcesBecauseOfBuckling(ObjectDataBase obj) { ColumnElement elem = obj as ColumnElement; CodeCheckingConcreteExample.Main.LabelColumn rcLabelColumn = elem.Label as CodeCheckingConcreteExample.Main.LabelColumn; bool dirY = rcLabelColumn.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.MY); bool dirZ = rcLabelColumn.EnabledInternalForces.Contains(ConcreteTypes.EnabledInternalForces.MZ); dirY &= rcLabelColumn.BucklingDirectionY; dirZ &= rcLabelColumn.BucklingDirectionZ; if (dirY || dirZ) { double lambdaLim = 15.0; double lambdaY = 0; double lambdaZ = 0; double length = elem.Info.GeomLength(); bool modifMy = false; bool modifMz = false; if (dirY) { lambdaY = (length * rcLabelColumn.LengthCoefficientY) / elem.Info.SectionsParams.AtTheBeg.Characteristics.ry; modifMy = lambdaY > lambdaLim; } if (dirZ) { lambdaZ = (length * rcLabelColumn.LengthCoefficientZ) / elem.Info.SectionsParams.AtTheBeg.Characteristics.rz; modifMz = lambdaZ > lambdaLim; } double additionalMy = 0; double additionalMz = 0; double My = 0; double Mz = 0; double N = 0; double dimY = elem.Info.SectionsParams.AtTheBeg.Dimensions.vpy + elem.Info.SectionsParams.AtTheBeg.Dimensions.vy; double dimZ = elem.Info.SectionsParams.AtTheBeg.Dimensions.vpz + elem.Info.SectionsParams.AtTheBeg.Dimensions.vz; foreach (SectionDataBase sd in elem.ListSectionData) { ColumnSection sec = sd as ColumnSection; if (sec != null) { foreach (InternalForcesBase forces in sec.ListInternalForces) { InternalForcesLinear f = forces as InternalForcesLinear; if (f != null) { if (f.Forces.LimitState == ForceLimitState.Uls) { CalcPointLinear calcPoint = sec.CalcPoint as CalcPointLinear; N = f.Forces.ForceFx; if (N > Double.Epsilon) { if (dirY) { My = f.Forces.MomentMy; additionalMy = (-0.002 * N / dimZ); additionalMy *= rcLabelColumn.LengthCoefficientY * rcLabelColumn.LengthCoefficientY; additionalMy *= (calcPoint.CoordAbsolute * calcPoint.CoordAbsolute - length * calcPoint.CoordAbsolute); f.Forces.MomentMy += f.Forces.MomentMy > 0.0 ? additionalMy : -additionalMy; } if (dirZ) { Mz = f.Forces.MomentMz; additionalMz = (-0.002 * N / dimY); additionalMz *= rcLabelColumn.LengthCoefficientZ * rcLabelColumn.LengthCoefficientZ; additionalMz *= (calcPoint.CoordAbsolute * calcPoint.CoordAbsolute - length * calcPoint.CoordAbsolute); f.Forces.MomentMz += f.Forces.MomentMz > 0.0 ? additionalMz : -additionalMz; } } } } } } } } }