コード例 #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
        public static SurfaceReinforcement BySurface(Surface surface, Straight straight, Wire wire)
        {
            // convert geometry
            Geometry.Region region = Geometry.Region.FromDynamo(surface);

            // return
            return(SurfaceReinforcement.DefineStraightSurfaceReinforcement(region, straight, wire));
        }
コード例 #3
0
        /// <summary>
        /// Create straight lay-out surface reinforcement.
        /// Internal static method used by GH components and Dynamo nodes.
        /// </summary>
        public static SurfaceReinforcement DefineStraightSurfaceReinforcement(Geometry.Region region, Straight straight, Wire wire)
        {
            // set straight (e.g. centric == null)
            Centric centric = null;

            // new surfaceReinforcement
            SurfaceReinforcement obj = new SurfaceReinforcement(region, straight, centric, wire);

            // return
            return(obj);
        }
コード例 #4
0
 private static Shells.Slab AddCentricReinfToSlab(Shells.Slab slab, List <SurfaceReinforcement> srfReinfs)
 {
     if (SurfaceReinforcement.AllCentric(srfReinfs))
     {
         throw new System.ArgumentException("Method to add centric surface reinforcement is not implemented yet.");
     }
     else
     {
         throw new System.ArgumentException("Not all passed surface reinforcement objects are of layout type centric");
     }
 }
コード例 #5
0
 public static Shells.Slab AddToSlab(Shells.Slab slab, List <SurfaceReinforcement> surfaceReinforcement)
 {
     // return
     return(SurfaceReinforcement.AddReinforcementToSlab(slab, surfaceReinforcement));
 }
コード例 #6
0
 // check if surface reinforcement objects in list are mixed.
 private static bool MixedLayers(List <SurfaceReinforcement> srfReinfs)
 {
     return(SurfaceReinforcement.AllMultiLayer(srfReinfs) == false && SurfaceReinforcement.AllSingleLayer(srfReinfs) == false);
 }
コード例 #7
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);
        }