/// <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; } } } } } } } } }
/// <summary> /// Runs calculation\operations for cref="BeamSection" and cref="ColumnSection". /// </summary> /// <param name="obj">cref="BeamSection" object or cref="ColumnSection" object.</param> /// <returns>Result of calculation.</returns> public bool Run(ObjectDataBase obj) { SectionDataBase sectionData = obj as SectionDataBase; if (obj != null) { CommonParameters commParams = Parameters as CommonParameters; ForceResultsCache cache = null; if (commParams != null) { cache = commParams.ResultCache; } Section sec = null; switch (sectionData.Category) { default: break; case Autodesk.Revit.DB.BuiltInCategory.OST_ColumnAnalytical: if (sectionData is ColumnSection) { ColumnSection section = sectionData as ColumnSection; if (section.Info != null) { SectionsInfo secInfo = section.Info.Sections.AtTheBeg; if (secInfo.Sections.Count > 0) { sec = secInfo.Sections[0]; } } } break; case Autodesk.Revit.DB.BuiltInCategory.OST_BeamAnalytical: if (sectionData is BeamSection && sectionData.Label is LabelBeam) { BeamSection section = sectionData as BeamSection; LabelBeam label = sectionData.Label as LabelBeam; if (section.Info != null) { SectionsInfo secInfo = section.Info.Sections.AtTheBeg; if (secInfo.Sections.Count > 0) { sec = secInfo.Sections[0]; if (label.SlabBeamInteraction == ConcreteTypes.BeamSectionType.WithSlabBeamInteraction && section.Info.Slabs != null && section.Info.Slabs.TSection != null) { int nbrPoints = (sec.Contour != null && sec.Contour.Points != null) ? sec.Contour.Points.Count : 0; double relativeX = (section.CalcPoint as CalcPointLinear).CoordRelative; double maxFlangeWidth = 0.5 * section.Info.SectionsParams.AtThePoint(relativeX).Dimensions.h; sec = section.Info.Slabs.TSection.GetContour(relativeX, maxFlangeWidth, maxFlangeWidth); if (sec.Contour.Points.Count != nbrPoints) { section.IsTSection = true; section.DesignInfo.Add(Resources.ResourceManager.GetString("SlabBeamInteraction")); } } } } } break; } switch (sectionData.Category) { default: break; case Autodesk.Revit.DB.BuiltInCategory.OST_ColumnAnalytical: case Autodesk.Revit.DB.BuiltInCategory.OST_BeamAnalytical: if (sectionData is LinearSection) { LinearSection section = sectionData as LinearSection; if (sec != null && sec.Contour != null) { foreach (Autodesk.Revit.DB.XYZ p in sec.Contour.Points) { section.Geometry.Add(p.X, p.Y); } Autodesk.Revit.DB.XYZ pmin = sec.GetMinimumBoundary(); Autodesk.Revit.DB.XYZ pmax = sec.GetMaximumBoundary(); section.Width = Math.Abs(pmin.X - pmax.X); section.Height = Math.Abs(pmin.Y - pmax.Y); } if (cache != null) { IList <ForceLoadCaseDescriptor> loadCaseDescriptors = cache.GetLoadCaseDescriptors(); List <double> vFx = cache.GetForceForPoint(sectionData.ElementId, loadCaseDescriptors, sectionData.CalcPoint, ForceType.Fx); List <double> vFy = cache.GetForceForPoint(sectionData.ElementId, loadCaseDescriptors, sectionData.CalcPoint, ForceType.Fy); List <double> vFz = cache.GetForceForPoint(sectionData.ElementId, loadCaseDescriptors, sectionData.CalcPoint, ForceType.Fz); List <double> vMx = cache.GetForceForPoint(sectionData.ElementId, loadCaseDescriptors, sectionData.CalcPoint, ForceType.Mx); List <double> vMy = cache.GetForceForPoint(sectionData.ElementId, loadCaseDescriptors, sectionData.CalcPoint, ForceType.My); List <double> vMz = cache.GetForceForPoint(sectionData.ElementId, loadCaseDescriptors, sectionData.CalcPoint, ForceType.Mz); List <double> vUx = cache.GetForceForPoint(sectionData.ElementId, loadCaseDescriptors, sectionData.CalcPoint, ForceType.Ux); List <double> vUy = cache.GetForceForPoint(sectionData.ElementId, loadCaseDescriptors, sectionData.CalcPoint, ForceType.Uy); List <double> vUz = cache.GetForceForPoint(sectionData.ElementId, loadCaseDescriptors, sectionData.CalcPoint, ForceType.Uz); int i = -1; foreach (ForceLoadCaseDescriptor cas in loadCaseDescriptors) { i++; InternalForcesLinear linForces = new InternalForcesLinear(); InternalForcesContainer forces = new InternalForcesContainer(); forces.CaseName = cas.Name; forces.LimitState = cas.State; forces.ForceFx = vFx.Count == 0 ? 0.0 : vFx[i]; forces.ForceFy = vFy.Count == 0 ? 0.0 : vFy[i]; forces.ForceFz = vFz.Count == 0 ? 0.0 : vFz[i]; forces.MomentMx = vMx.Count == 0 ? 0.0 : vMx[i]; forces.MomentMy = vMy.Count == 0 ? 0.0 : vMy[i]; forces.MomentMz = vMz.Count == 0 ? 0.0 : vMz[i]; forces.DeflectionUx = vUx.Count == 0 ? 0.0 : vUx[i]; forces.DeflectionUy = vUy.Count == 0 ? 0.0 : vUy[i]; forces.DeflectionUz = vUz.Count == 0 ? 0.0 : vUz[i]; linForces.Forces = forces; section.ListInternalForces.Add(linForces); } } } break; } } return(true); }
/// <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); } } } }