예제 #1
0
        /// <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)
        {
            bool            ret         = true;
            SectionDataBase sectionData = obj as SectionDataBase;

            if (obj != null)
            {
                Concrete.ConcreteSectionDesign design = new ConcreteSectionDesign();
                design.ElementType = sectionData.Category;

                switch (sectionData.Category)
                {
                default:
                    break;

                case BuiltInCategory.OST_ColumnAnalytical:
                case BuiltInCategory.OST_BeamAnalytical:
                    if (sectionData.Label is LabelColumn)
                    {
                        CodeCheckingConcreteExample.Main.LabelColumn label = sectionData.Label as CodeCheckingConcreteExample.Main.LabelColumn;
                        design.LongitudinalReinforcementMinimumYieldStress = label.LongitudinalReinforcement.MinimumYieldStress;
                        design.LongitudinalReinforcementArea     = label.LongitudinalReinforcement.Area;
                        design.LongitudinalReinforcementDiameter = label.LongitudinalReinforcement.BarDiameter;
                        design.LongitudinalCalculationType       = label.LongitudinalCalculationType;
                        ///
                        design.TransversalReinforcementMinimumYieldStress = label.TransversalReinforcement.MinimumYieldStress;
                        design.TransversalReinforcementArea     = label.TransversalReinforcement.Area;
                        design.TransversalReinforcementDiameter = label.TransversalReinforcement.BarDiameter;
                        design.TransversalCalculationType       = label.TransversalCalculationType;
                        design.CreepCoefficient = label.CreepCoefficient;
                    }

                    if (sectionData.Label is LabelBeam)
                    {
                        CodeCheckingConcreteExample.Main.LabelBeam label = sectionData.Label as CodeCheckingConcreteExample.Main.LabelBeam;

                        design.LongitudinalReinforcementMinimumYieldStress = label.LongitudinalReinforcement.MinimumYieldStress;
                        design.LongitudinalReinforcementArea     = label.LongitudinalReinforcement.Area;
                        design.LongitudinalReinforcementDiameter = label.LongitudinalReinforcement.BarDiameter;
                        design.LongitudinalCalculationType       = label.LongitudinalCalculationType;
                        ///
                        design.TransversalReinforcementMinimumYieldStress = label.TransversalReinforcement.MinimumYieldStress;
                        design.TransversalReinforcementArea     = label.TransversalReinforcement.Area;
                        design.TransversalReinforcementDiameter = label.TransversalReinforcement.BarDiameter;
                        design.TransversalCalculationType       = label.TransversalCalculationType;
                        design.CreepCoefficient = label.CreepCoefficient;
                    }

                    if (sectionData is LinearSection)
                    {
                        LinearSection section = sectionData as LinearSection;
                        if (section.Info != null)
                        {
                            design.CoverTop    = 0.0;
                            design.CoverBottom = 0.0;

                            if (section.Info.RebarCovers != null)
                            {
                                if (section is BeamSection)
                                {
                                    if (section.Info.RebarCovers.Exist(BuiltInParameter.CLEAR_COVER_BOTTOM))
                                    {
                                        design.CoverBottom = section.Info.RebarCovers.GetDistance(BuiltInParameter.CLEAR_COVER_BOTTOM);
                                    }
                                    if (section.Info.RebarCovers.Exist(BuiltInParameter.CLEAR_COVER_TOP))
                                    {
                                        design.CoverTop = section.Info.RebarCovers.GetDistance(BuiltInParameter.CLEAR_COVER_TOP);
                                    }
                                }
                                if (section is ColumnSection)
                                {
                                    if (section.Info.RebarCovers.Exist(BuiltInParameter.CLEAR_COVER_OTHER))
                                    {
                                        design.CoverBottom = section.Info.RebarCovers.GetDistance(BuiltInParameter.CLEAR_COVER_OTHER);
                                        design.CoverTop    = section.Info.RebarCovers.GetDistance(BuiltInParameter.CLEAR_COVER_OTHER);
                                    }
                                }
                            }

                            if (section.Info.SectionsParams == null)
                            {
                                design.Type = SectionShapeType.RectangularBar;
                            }
                            else
                            {
                                design.Type = section.Info.SectionsParams.ShapeType;
                            }
                            design.YoungModulus = section.Info.Material.Characteristics.YoungModulus.X;

                            MaterialConcreteCharacteristics concrete = (MaterialConcreteCharacteristics)section.Info.Material.Characteristics.Specific;

                            if (concrete != null)
                            {
                                design.Compression = concrete.Compression;
                            }

                            design.Geometry = section.Geometry;
                            design.Width    = section.Width;
                            design.Height   = section.Height;

                            List <InternalForcesContainer> listInternalForces = new List <InternalForcesContainer>();
                            foreach (InternalForcesLinear force in section.ListInternalForces)
                            {
                                listInternalForces.Add(force.Forces);
                            }

                            design.ListInternalForces = listInternalForces;;

                            //
                            // calculation
                            //
                            design.Calculate();

                            //
                            // save result
                            //
                            section.AsBottom           = design.AsBottom;
                            section.AsTop              = design.AsTop;
                            section.AsRight            = design.AsRight;
                            section.AsLeft             = design.AsLeft;
                            section.Spacing            = design.Spacing;
                            section.TransversalDensity = design.TransversalDensity;
                            section.MinStiffness       = design.MinStiffness;
                            section.DesignInfo.AddRange(design.DesignInfo);
                            section.DesignError.AddRange(design.DesignError);
                            section.DesignWarning.AddRange(design.DesignWarning);


                            if (section.DesignError.Count > 0)
                            {
                                ret = false;
                            }
                        }
                    }
                    break;
                }
            }
            return(ret);
        }
예제 #2
0
        /// <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);
        }