Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="bathTopo"></param>
        /// <returns></returns>
        private List <CompassBox> MakeStairs(CompassBox bathTopo)
        {
            var stairTopos = new List <CompassBox>();

            for (int i = 0; i < 2; i++)
            {
                Vector3 from;
                Vector3 to;
                var     stairHeight = 0.0;
                var     lastLevel   = Levels.Last();

                var stairPerim = Polygon.Rectangle(stairLength, stairWidth);
                var stairTopo  = new CompassBox(stairPerim);
                if (i == 0)
                {
                    from        = stairTopo.SW;
                    to          = bathTopo.NW;
                    stairHeight = lastLevel.Elevation - Levels.First().Elevation + stairEntry;
                }
                else
                {
                    from        = stairTopo.NW;
                    to          = bathTopo.SW;
                    stairHeight = lastLevel.Elevation - Levels.First().Elevation;
                }
                stairPerim = stairPerim.MoveFromTo(from, to);
                stairTopo  = new CompassBox(stairPerim);
                stairTopos.Add(stairTopo);
                stairPerim = stairPerim.Rotate(Position, Rotation);
                var extrude = new Elements.Geometry.Solids.Extrude(stairPerim, stairHeight, Vector3.ZAxis, false);
                var geomRep = new Representation(new List <Elements.Geometry.Solids.SolidOperation>()
                {
                    extrude
                });
                var stairMatl = new Material(new Color(1.0f, 0.0f, 0.0f, 0.8f), 0.0f, 0.0f, false, null, false, Guid.NewGuid(), "stair");
                Stairs.Add(new StairEnclosure(stairPerim, Vector3.ZAxis, Rotation, Levels.First().Elevation,
                                              stairHeight, stairPerim.Area() * stairHeight, "",
                                              new Transform(0.0, 0.0, Levels.First().Elevation),
                                              stairMatl, geomRep, false, Guid.NewGuid(), ""));
            }
            return(stairTopos);
        }
Beispiel #2
0
        private void GetStairs(ReadAutodesk cadFileReader)
        {
            List <LinearPathEx> lstStairFlightPath = CadHelper.PLinesGetByLayerName(cadFileReader, CadLayerName.Stair).Cast <LinearPathEx>().ToList();

            Landings = CadHelper.PLinesGetByLayerName(cadFileReader, CadLayerName.Stair);


            Dictionary <int, List <Line> > dicStairLines = new Dictionary <int, List <Line> >();

            //Dictionary<double, List<Line>> dicSlopedStairLines = new Dictionary<double, List<Line>>();
            for (int i = 0; i < lstStairFlightPath.Count(); i++)
            {
                List <Line> lstLines = new List <Line>();
                for (int j = 0; j < lstStairFlightPath[i].Vertices.Count() - 1; j++)
                {
                    Line l = new Line(lstStairFlightPath[i].Vertices[j], lstStairFlightPath[i].Vertices[j + 1]);
                    lstLines.Add(l);
                }
                dicStairLines.Add(i, lstLines);
            }

            foreach (KeyValuePair <int, List <Line> > item in dicStairLines)
            {
                List <Line> slopedLines = new List <Line>();
                List <Line> hzLines     = new List <Line>();

                for (int i = 0; i < item.Value.Count(); i++)
                {
                    if (item.Value[i].StartPoint.Z != item.Value[i].EndPoint.Z)
                    {
                        slopedLines.Add(item.Value[i]);
                    }
                    else
                    {
                        hzLines.Add(item.Value[i]);
                    }
                }
                double stairWidth = hzLines[0].Length();
                Stairs.Add(new Stair(stairWidth, slopedLines));
            }
        }