Example #1
0
        private void SetRightRegion()
        {
            var storyNo     = WallPolygon.IfWall.Story.StoryNo;
            var height      = WallPolygon.IfWall.IfDimension.ZDim;
            var dim         = IfStud.Setup.Get <IfDimension>("Dimension");
            var maxdistance = StudTable.GetSpace(storyNo + 1, height.Inches, dim).LastOrDefault().Spacing;


            foreach (var region in WallPolygon.RRight)
            {
                var spaces = Split.Distance(region.IfDimension.XDim.Inches, Convert.ToDouble(maxdistance) * 0.0254); //to inch

                spaces = spaces.Where(e => e > .2).ToList();
                spaces.Insert(0, 0);
                for (int i = 0; i < spaces.Count; i++)
                {
                    if (i == 0)
                    {
                        spaces[i] += 0.05 / 2;
                    }
                    ;
                    IfStud ifStud = new IfStud(WallPolygon.IfWall)
                    {
                        IfModel    = WallPolygon.IfWall.IfModel,
                        IfWall     = WallPolygon.IfWall,
                        IfLocation =
                            new IfLocation(region.IfLocation.X + spaces[i],
                                           region.IfLocation.Y,
                                           region.IfLocation.Z),

                        IfDimension = new IfDimension(
                            .05f,
                            .4f,
                            region.IfDimension.ZDim.Inches),
                    };


                    ifStud.New();
                    ifStud.IfMaterial.AttatchTo(ifStud);
                    //add to studs elments
                    IfStuds.Add(ifStud);
                }
            }
        }
Example #2
0
        private void SetStudsRegions()
        {
            var      storyNo = WallPolygon.IfWall.Story.StoryNo;
            double   height  = 0;
            UnitName unit    = WallPolygon.IfWall.IfModel.IfUnit.LengthUnit;

            height = WallPolygon.IfWall.IfDimension.ZDim.Feet;
            //switch (unit)
            //{
            //    case UnitName.MILLIMETRE:
            //        height = Length.FromMilliMeters(WallPolygon.IfWall.IfDimension.ZDim.MilliMeter).Feet;
            //        break;
            //
            //    case UnitName.FOOT:
            //        height = WallPolygon.IfWall.IfDimension.ZDim.Feet;
            //        break;
            //    case UnitName.METRE:
            //        height = Length.FromMeters(WallPolygon.IfWall.IfDimension.ZDim.Meter).Feet;
            //        break;
            //    default:
            //        break;
            //}

            var dim = IfStud.Setup.Get <IfDimension>("Dimension");

            var maxdistance = StudTable.GetSpace(storyNo + 1, height, dim)
                              .LastOrDefault().Spacing;

            // set maxdistance unit
            //switch (unit)
            //{
            //    case UnitName.MILLIMETRE:
            //        maxdistance = Length.FromInches(maxdistance).MilliMeter;
            //        //dim = dim.ToMilliMeters();
            //        break;
            //
            //    case UnitName.METRE:
            //        maxdistance = Length.FromInches(maxdistance).Meter;
            //        //dim = dim.ToMeters();
            //        break;
            //
            //    default:
            //        maxdistance = Length.FromInches(maxdistance).Feet;
            //        //dim = dim.ToFeet();
            //        break;
            //}

            //set Left Region
            foreach (var region in WallPolygon.RLeft)
            {
                double distance = 0;
                //switch (unit)
                //{
                //    case UnitName.MILLIMETRE:
                //        distance = region.IfDimension.XDim.Inches;
                //        break;
                //    case UnitName.FOOT:
                //        distance = region.IfDimension.XDim.Inches;
                //        break;
                //    case UnitName.METRE:
                //        distance = region.IfDimension.XDim.Inches;
                //        break;
                //    default:
                //        break;
                //}
                distance = region.IfDimension.XDim.Inches;

                var spaces = Split.Equal(distance - dim.XDim.Inches, maxdistance);

                for (int i = 0; i < spaces.Count; i++)
                {
                    var ifStud = new IfStud(WallPolygon.IfWall)
                    {
                        IfModel    = WallPolygon.IfWall.IfModel,
                        IfWall     = WallPolygon.IfWall,
                        IfLocation =
                            new IfLocation(region.IfLocation.X + spaces[i] + dim.XDim.Inches / 2,
                                           region.IfLocation.Y,
                                           region.IfLocation.Z),

                        IfDimension = new IfDimension(
                            dim.XDim,
                            dim.YDim,
                            region.IfDimension.ZDim),

                        IfMaterial = IfMaterial.Setup.Get <IfMaterial>("RLeft"),
                    };

                    ifStud.New();
                    ifStud.IfMaterial.AttatchTo(ifStud);
                    //add to studs elments
                    IfStuds.Add(ifStud);

                    //
                }
            }
            //set right Region
            foreach (var region in WallPolygon.RRight)
            {
                double distance = 0;
                switch (unit)
                {
                case UnitName.MILLIMETRE:
                    distance = region.IfDimension.XDim.Inches;
                    break;

                case UnitName.FOOT:
                    distance = region.IfDimension.XDim.Inches;
                    break;

                case UnitName.METRE:
                    distance = region.IfDimension.XDim.Inches;
                    break;

                default:
                    break;
                }

                var spaces = Split.Equal(distance - dim.XDim.Inches, maxdistance);
                for (int i = 0; i < spaces.Count; i++)
                {
                    var ifStud = new IfStud(WallPolygon.IfWall)
                    {
                        IfModel    = WallPolygon.IfWall.IfModel,
                        IfWall     = WallPolygon.IfWall,
                        IfLocation =
                            new IfLocation(region.IfLocation.X + spaces[i] + dim.XDim.Inches / 2,
                                           region.IfLocation.Y,
                                           region.IfLocation.Z),

                        IfDimension = new IfDimension(
                            dim.XDim,
                            dim.YDim,
                            region.IfDimension.ZDim),

                        IfMaterial = IfMaterial.Setup.Get <IfMaterial>("RRight")
                    };

                    ifStud.New();
                    ifStud.IfMaterial.AttatchTo(ifStud);
                    //add to studs elments
                    IfStuds.Add(ifStud);



                    //
                }
            }
            //set between regions
            foreach (var region in WallPolygon.RBetween)
            {
                double distance = 0;
                switch (unit)
                {
                case UnitName.MILLIMETRE:
                    distance = region.IfDimension.XDim.Inches;
                    break;

                case UnitName.FOOT:
                    distance = region.IfDimension.XDim.Inches;
                    break;

                case UnitName.METRE:
                    distance = region.IfDimension.XDim.Inches;
                    break;

                default:
                    break;
                }

                var spaces = Split.Equal(distance - dim.XDim.Inches, maxdistance);

                for (int i = 0; i < spaces.Count; i++)
                {
                    var ifStud = new IfStud(WallPolygon.IfWall)
                    {
                        IfModel    = WallPolygon.IfWall.IfModel,
                        IfWall     = WallPolygon.IfWall,
                        IfLocation =
                            new IfLocation(region.IfLocation.X + spaces[i] + dim.XDim.Inches / 2,
                                           region.IfLocation.Y,
                                           region.IfLocation.Z),

                        IfDimension = new IfDimension(
                            dim.XDim,
                            dim.YDim,
                            region.IfDimension.ZDim),

                        IfMaterial = IfMaterial.Setup.Get <IfMaterial>("RBetween")
                    };

                    ifStud.New();
                    ifStud.IfMaterial.AttatchTo(ifStud);
                    //add to studs elments
                    IfStuds.Add(ifStud);



                    //
                }
            }
            //set Bottom Region
            foreach (var region in WallPolygon.RBottom)
            {
                double distance = 0;
                switch (unit)
                {
                case UnitName.MILLIMETRE:
                    distance = region.IfDimension.XDim.Inches;
                    break;

                case UnitName.FOOT:
                    distance = region.IfDimension.XDim.Inches;
                    break;

                case UnitName.METRE:
                    distance = region.IfDimension.XDim.Inches;
                    break;

                default:
                    break;
                }
                var spaces = Split.Equal(distance - dim.XDim.Inches, maxdistance);
                for (int i = 0; i < spaces.Count; i++)
                {
                    var ifStud = new IfStud(WallPolygon.IfWall)
                    {
                        IfModel    = WallPolygon.IfWall.IfModel,
                        IfWall     = WallPolygon.IfWall,
                        IfLocation =
                            new IfLocation(region.IfLocation.X + spaces[i] + dim.XDim.Inches / 2,
                                           region.IfLocation.Y,
                                           region.IfLocation.Z),

                        IfDimension = new IfDimension(
                            dim.XDim,
                            dim.YDim,
                            region.IfDimension.ZDim),

                        IfMaterial = IfMaterial.Setup.Get <IfMaterial>("BottomStud")
                    };

                    ifStud.New();
                    ifStud.IfMaterial.AttatchTo(ifStud);
                    //add to studs elments
                    IfStuds.Add(ifStud);


                    //
                }
            }
            //set top region
            foreach (var region in WallPolygon.RTop)
            {
                double distance = 0;
                switch (unit)
                {
                case UnitName.MILLIMETRE:
                    distance = region.IfDimension.XDim.Inches;
                    break;

                case UnitName.FOOT:
                    distance = region.IfDimension.XDim.Inches;
                    break;

                case UnitName.METRE:
                    distance = region.IfDimension.XDim.Inches;
                    break;

                default:
                    break;
                }
                var spaces = Split.Equal(distance - dim.XDim.Inches, maxdistance);
                for (int i = 0; i < spaces.Count; i++)
                {
                    var ifStud = new IfStud(WallPolygon.IfWall)
                    {
                        IfModel    = WallPolygon.IfWall.IfModel,
                        IfWall     = WallPolygon.IfWall,
                        IfLocation =
                            new IfLocation(region.IfLocation.X + spaces[i] + dim.XDim.Inches / 2,
                                           region.IfLocation.Y,
                                           region.IfLocation.Z),

                        IfDimension = new IfDimension(
                            dim.XDim,
                            dim.YDim,
                            region.IfDimension.ZDim),

                        IfMaterial = IfMaterial.Setup.Get <IfMaterial>("TopStud")
                    };

                    ifStud.New();
                    ifStud.IfMaterial.AttatchTo(ifStud);
                    //add to studs elments
                    IfStuds.Add(ifStud);


                    //
                }
            }
        }