Esempio n. 1
0
        // Назначение параметров для RebarBarType
        private static AreaReinforcement SetDirectionAndSpacing(
            AreaReinforcement areaReinforcement, RebarArea rebarArea)
        {
            Direction direction = rebarArea.Direction;

            if (rebarArea.Spacing < 100)
            {
                throw new Exception(string.Format("{0} - шаг арматуры мешьше 100 мм",
                                                  rebarArea.AreaReinforcementType.Name));
            }

            double rebarSpacing = rebarArea.Spacing * mmToft;

            Parameter direction_top_major_X =
                areaReinforcement.get_Parameter
                    (BuiltInParameter.REBAR_SYSTEM_ACTIVE_TOP_DIR_1);

            Parameter direction_top_minor_Y =
                areaReinforcement.get_Parameter
                    (BuiltInParameter.REBAR_SYSTEM_ACTIVE_TOP_DIR_2);

            Parameter direction_bottom_major_X =
                areaReinforcement.get_Parameter(
                    BuiltInParameter.REBAR_SYSTEM_ACTIVE_BOTTOM_DIR_1);

            Parameter direction_bottom_minor_Y =
                areaReinforcement.get_Parameter
                    (BuiltInParameter.REBAR_SYSTEM_ACTIVE_BOTTOM_DIR_2);

            switch (direction)
            {
            case Direction.TopMajor:
                direction_top_major_X.Set(1);
                direction_top_minor_Y.Set(0);
                direction_bottom_major_X.Set(0);
                direction_bottom_minor_Y.Set(0);

                Parameter spacing_top_major_X =
                    areaReinforcement.get_Parameter
                        (BuiltInParameter.REBAR_SYSTEM_SPACING_TOP_DIR_1);
                spacing_top_major_X.Set(rebarSpacing);
                break;

            case Direction.TopMinor:
                direction_top_major_X.Set(0);
                direction_top_minor_Y.Set(1);
                direction_bottom_major_X.Set(0);
                direction_bottom_minor_Y.Set(0);

                Parameter spacing_top_minor_Y =
                    areaReinforcement.get_Parameter
                        (BuiltInParameter.REBAR_SYSTEM_SPACING_TOP_DIR_2);
                spacing_top_minor_Y.Set(rebarSpacing);

                Parameter add_top_cover =
                    areaReinforcement.get_Parameter
                        (BuiltInParameter.REBAR_SYSTEM_ADDL_TOP_OFFSET);
                add_top_cover.Set(rebarArea.RebarBarType.BarDiameter);
                break;

            case Direction.BottomMajor:
                direction_top_major_X.Set(0);
                direction_top_minor_Y.Set(0);
                direction_bottom_major_X.Set(1);
                direction_bottom_minor_Y.Set(0);

                Parameter spacing_bottom_major_X =
                    areaReinforcement.get_Parameter
                        (BuiltInParameter.REBAR_SYSTEM_SPACING_BOTTOM_DIR_1);
                spacing_bottom_major_X.Set(rebarSpacing);
                break;

            case Direction.BottomMinor:
                direction_top_major_X.Set(0);
                direction_top_minor_Y.Set(0);
                direction_bottom_major_X.Set(0);
                direction_bottom_minor_Y.Set(1);

                Parameter spacing_bottom_minor_Y =
                    areaReinforcement.get_Parameter
                        (BuiltInParameter.REBAR_SYSTEM_SPACING_BOTTOM_DIR_2);
                spacing_bottom_minor_Y.Set(rebarSpacing);

                Parameter add_bottom_cover =
                    areaReinforcement.get_Parameter
                        (BuiltInParameter.REBAR_SYSTEM_ADDL_BOTTOM_OFFSET);
                add_bottom_cover.Set(rebarArea.RebarBarType.BarDiameter);
                break;
            }
            return(areaReinforcement);
        }
Esempio n. 2
0
        // Получение контура армирования из аналитической модели плиты
        static IList <Curve> GetCurveArray(RebarArea rebarArea, XYZ majorDirection)
        {
            Floor floor = rebarArea.Host;

            AnalyticalModel analyticalModel = floor.GetAnalyticalModel() as AnalyticalModel;

            if (null == analyticalModel)
            {
                throw new Exception("Не удалось получить аналитическую модель");
            }

            IList <Curve> curves = analyticalModel.GetCurves(AnalyticalCurveType
                                                             .ActiveCurves);

            List <Line> lines = new List <Line>();

            foreach (Line line in curves)
            {
                if (rebarArea.Direction == Direction.TopMajor ||
                    rebarArea.Direction == Direction.BottomMajor)
                {
                    if ((line.Direction.X.EqualTo(majorDirection.X, epsilon)
                         &&
                         line.Direction.Y.EqualTo(majorDirection.Y, epsilon))
                        ||
                        (line.Direction.Negate().X.EqualTo(majorDirection.X, epsilon)
                         &&
                         line.Direction.Negate().Y.EqualTo(majorDirection.Y, epsilon)))
                    {
                        lines.Add(line);
                    }
                }

                if (rebarArea.Direction == Direction.TopMinor ||
                    rebarArea.Direction == Direction.BottomMinor)
                {
                    if ((line.Direction.X.EqualTo(majorDirection.Negate().Y, epsilon)
                         &&
                         line.Direction.Y.EqualTo(majorDirection.X, epsilon))
                        ||
                        (line.Direction.Negate().X.EqualTo(majorDirection.Negate().Y, epsilon)
                         &&
                         line.Direction.Negate().Y.EqualTo(majorDirection.X, epsilon)))
                    {
                        lines.Add(line);
                    }
                }
            }

            List <XYZ> points = new List <XYZ>();
            double     offset = (rebarArea.AlongRebarCover * mmToft) - (rebarArea.RebarBarType.BarDiameter / 2);

            foreach (Line line in lines)
            {
                points.Add(AddAlongRebarCover(line.GetEndPoint(0), line.Direction, offset));
                points.Add(AddAlongRebarCover(line.GetEndPoint(1), line.Direction, offset));
            }

            IList <Curve> newLines = new List <Curve>();
            XYZ           q        = points[points.Count - 1];

            foreach (XYZ p in points)
            {
                newLines.Add(Line.CreateBound(q, p));
                q = p;
            }
            return(newLines);
        }
Esempio n. 3
0
        // Получение контура армирования из скетч-плана плиты
        static IList <Curve> GetCurveArray2(RebarArea rebarArea, XYZ majorDirection)
        {
            Floor    floor       = rebarArea.Host;
            Document doc         = floor.Document;
            Sketch   floorSketch =
                doc.GetElement(floor.GetDependentElements
                                   (new ElementClassFilter(typeof(Sketch))).First()) as Sketch;

            List <Line> lines = new List <Line>();

            foreach (Line line in floorSketch.Profile.get_Item(0))
            {
                if (rebarArea.Direction == Direction.TopMajor ||
                    rebarArea.Direction == Direction.BottomMajor)
                {
                    if ((line.Direction.X.EqualTo(majorDirection.X, epsilon)
                         &&
                         line.Direction.Y.EqualTo(majorDirection.Y, epsilon))
                        ||
                        (line.Direction.Negate().X.EqualTo(majorDirection.X, epsilon)
                         &&
                         line.Direction.Negate().Y.EqualTo(majorDirection.Y, epsilon)))
                    {
                        lines.Add(line);
                    }
                }

                if (rebarArea.Direction == Direction.TopMinor ||
                    rebarArea.Direction == Direction.BottomMinor)
                {
                    if ((line.Direction.X.EqualTo(majorDirection.Negate().Y, epsilon)
                         &&
                         line.Direction.Y.EqualTo(majorDirection.X, epsilon))
                        ||
                        (line.Direction.Negate().X.EqualTo(majorDirection.Negate().Y, epsilon)
                         &&
                         line.Direction.Negate().Y.EqualTo(majorDirection.X, epsilon)))
                    {
                        lines.Add(line);
                    }
                }
            }

            if (rebarArea.AlongRebarCover < 30)
            {
                throw new Exception(string.Format("{0} - отступ мешьше 30 мм",
                                                  rebarArea.AreaReinforcementType.Name));
            }

            List <XYZ> points = new List <XYZ>();
            double     offset = (rebarArea.AlongRebarCover * mmToft) - (rebarArea.RebarBarType.BarDiameter / 2);

            foreach (Line line in lines)
            {
                points.Add(AddAlongRebarCover2(line.GetEndPoint(0), line.Direction, offset));
                points.Add(AddAlongRebarCover2(line.GetEndPoint(1), line.Direction, offset));
            }

            IList <Curve> newLines = new List <Curve>();
            XYZ           q        = points[points.Count - 1];

            foreach (XYZ p in points)
            {
                newLines.Add(Line.CreateBound(q, p));
                q = p;
            }
            return(newLines);
        }