示例#1
0
        /// <summary>
        /// Add SurfaceReinforcement to slab.
        /// Internal method use by GH components and Dynamo nodes.
        /// </summary>
        public static Shells.Slab AddReinforcementToSlab(Shells.Slab slab, List <SurfaceReinforcement> srfReinfs)
        {
            // deep clone. downstreams objs will contain changes made in this method, upstream objs will not.
            // downstream and uppstream objs will share guid.
            Shells.Slab clone = slab.DeepClone();

            // check if slab material is concrete
            if (clone.Material.Concrete == null)
            {
                throw new System.ArgumentException("Material of slab must be concrete");
            }

            // check if mixed layers
            if (SurfaceReinforcement.MixedLayers(srfReinfs))
            {
                throw new System.ArgumentException("Can't add mixed layers to the same slab");
            }

            if (SurfaceReinforcement.AllStraight(srfReinfs))
            {
                return(SurfaceReinforcement.AddStraightReinfToSlab(clone, srfReinfs));
            }
            else if (SurfaceReinforcement.AllCentric(srfReinfs))
            {
                return(SurfaceReinforcement.AddCentricReinfToSlab(clone, srfReinfs));
            }
            else
            {
                throw new System.ArgumentException("Can't add mixed surface reinforcement layouts to the same slab.");
            }
        }
示例#2
0
        private static Shells.Slab AddStraightReinfToSlab(Shells.Slab slab, List <SurfaceReinforcement> srfReinfs)
        {
            // assert layout
            if (SurfaceReinforcement.AllStraight(srfReinfs))
            {
            }
            else
            {
                throw new System.ArgumentException("Not all passed surface reinforcement objects are of layout type straight");
            }

            // assert layers
            if (SurfaceReinforcement.MixedLayers(srfReinfs))
            {
                throw new System.ArgumentException("Can't add mixed layers to the same slab");
            }

            // single layer?
            var singleLayer = SurfaceReinforcement.AllSingleLayer(srfReinfs);

            // check if surface reinf parameters are set to slab
            SurfaceReinforcementParameters srfReinfParams;

            if (slab.SurfaceReinforcementParameters == null)
            {
                srfReinfParams = SurfaceReinforcementParameters.Straight(slab, singleLayer);
                slab.SurfaceReinforcementParameters = srfReinfParams;
            }

            // any surfaceReinforcementParameter set to slab will be overwritten
            // any surfaceReinforcement with option "centric" will be removed
            else if (slab.SurfaceReinforcementParameters.Center.PolarSystem == true)
            {
                srfReinfParams = SurfaceReinforcementParameters.Straight(slab);
                slab.SurfaceReinforcementParameters = srfReinfParams;

                foreach (SurfaceReinforcement item in slab.SurfaceReinforcement)
                {
                    if (item.Centric != null)
                    {
                        slab.SurfaceReinforcement.Remove(item);
                    }
                }
            }

            // use surface parameters already set to slab
            else
            {
                srfReinfParams = slab.SurfaceReinforcementParameters;
            }

            // add surface reinforcement
            GuidListType baseShell = new GuidListType(slab.SlabPart.Guid);

            FemDesign.GuidListType surfaceReinforcementParametersGuidReference = new FemDesign.GuidListType(slab.SurfaceReinforcementParameters.Guid);
            foreach (SurfaceReinforcement item in srfReinfs)
            {
                // add references to item
                item.BaseShell = baseShell;
                item.SurfaceReinforcementParametersGuid = surfaceReinforcementParametersGuidReference;

                // check if region item exists
                if (item.Region == null)
                {
                    item.Region = Geometry.Region.FromSlab(slab);
                }

                // add item to slab
                slab.SurfaceReinforcement.Add(item);
            }

            // return
            return(slab);
        }