/// <summary>
        /// Create rebar on the given object to given position using FootingSize from dialog.
        /// Polygon for the rebar is calculated from position and FootingSize from dialog, Polygon could also
        /// be calculated using PadFooting's extrema.
        /// </summary>
        /// <param name="PadFooting">Father of the rebar</param>
        /// <param name="PositionX">X-coordination</param>
        /// <param name="PositionY"></param>
        /// <returns></returns>
        private void CreateRebar(ModelObject PadFooting, double PositionX, double PositionY)
        {
            RebarGroup Rebar         = new RebarGroup();
            Polygon    RebarPolygon1 = new Polygon();

            double MyFootingSize = double.Parse(FootingSize.Text);

            //use given position and footing size
            RebarPolygon1.Points.Add(new Point(PositionX - MyFootingSize / 2.0, PositionY - MyFootingSize / 2.0, 0));
            RebarPolygon1.Points.Add(new Point(PositionX + MyFootingSize / 2.0, PositionY - MyFootingSize / 2.0, 0));
            RebarPolygon1.Points.Add(new Point(PositionX + MyFootingSize / 2.0, PositionY + MyFootingSize / 2.0, 0));
            RebarPolygon1.Points.Add(new Point(PositionX - MyFootingSize / 2.0, PositionY + MyFootingSize / 2.0, 0));
            RebarPolygon1.Points.Add(new Point(PositionX - MyFootingSize / 2.0, PositionY - MyFootingSize / 2.0, 0));
            Rebar.Polygons.Add(RebarPolygon1);

            //or calculate by rebar's solid's Axis Aligned Bounding Box
            //Rebar.Polygons.Add(GetPolygonBySolidsAABB(PadFooting as Beam));

            Rebar.StartPoint.X          = PositionX;
            Rebar.StartPoint.Y          = PositionY;
            Rebar.StartPoint.Z          = 0.0;
            Rebar.EndPoint.X            = PositionX;
            Rebar.EndPoint.Y            = PositionY;
            Rebar.EndPoint.Z            = -500.0;
            Rebar.Father                = PadFooting;
            Rebar.EndPointOffsetType    = Reinforcement.RebarOffsetTypeEnum.OFFSET_TYPE_COVER_THICKNESS;
            Rebar.EndPointOffsetValue   = 20.0;
            Rebar.StartPointOffsetType  = Reinforcement.RebarOffsetTypeEnum.OFFSET_TYPE_COVER_THICKNESS;
            Rebar.StartPointOffsetValue = 20.0;
            Rebar.Class = 3;
            Rebar.Name  = "FootingRebar";
            Rebar.Grade = GradeTextBox.Text;
            Rebar.Size  = SizeTextBox.Text;

            char[]   Separator = { ' ' };
            string[] Radiuses  = BendingRadiusTextBox.Text.Split(Separator, StringSplitOptions.RemoveEmptyEntries);
            foreach (string Item in Radiuses)
            {
                Rebar.RadiusValues.Add(Convert.ToDouble(Item));
            }

            Rebar.SpacingType = BaseRebarGroup.RebarGroupSpacingTypeEnum.SPACING_TYPE_TARGET_SPACE;
            Rebar.Spacings.Add(100.0);
            Rebar.ExcludeType = BaseRebarGroup.ExcludeTypeEnum.EXCLUDE_TYPE_BOTH;
            Rebar.NumberingSeries.StartNumber = 0;
            Rebar.NumberingSeries.Prefix      = "Group";
            Rebar.OnPlaneOffsets.Add(25.0);
            Rebar.FromPlaneOffset = 40;

            //Adding hooks to make rebar stronger
            Rebar.StartHook.Shape = RebarHookData.RebarHookShapeEnum.HOOK_90_DEGREES;
            Rebar.EndHook.Shape   = RebarHookData.RebarHookShapeEnum.HOOK_90_DEGREES;
            Rebar.OnPlaneOffsets.Add(10.0);
            Rebar.OnPlaneOffsets.Add(25.0);

            if (!Rebar.Insert())
            {
                Console.WriteLine("Inserting of rebar failed.");
            }
        }
Пример #2
0
        private void btn_createUstirrup_Click(object sender, EventArgs e)
        {
            //기본객체 생성
            RebarGroup rebarGroup = new RebarGroup();
            Picker     picker     = new Picker();

            //부재선택
            TSM.ModelObject mainpart = picker.PickObject(Picker.PickObjectEnum.PICK_ONE_PART, "철근을 삽입할 부재를 선택하세요.");
            TSM.Beam        Beam     = mainpart as TSM.Beam;
            rebarGroup.Father = Beam;

            //철근 형태를 결정할 Point 선택
            ArrayList shapePoints = picker.PickPoints(Picker.PickPointEnum.PICK_POLYGON, "철근 형태를 결정할 포인트를 선택하세요.");

            TSM.Polygon polygon = new TSM.Polygon();
            for (int i = 0; i < shapePoints.Count; i++)
            {
                polygon.Points.Add(shapePoints[i]);
            }
            rebarGroup.Polygons.Add(polygon);

            //철근 생성 위치를 결정할 Point 선택
            ArrayList locationPoints = picker.PickPoints(Picker.PickPointEnum.PICK_POLYGON, "철근 생성 위치를 결정할 포인트를 선택하세요.");

            rebarGroup.StartPoint = (TSG.Point)locationPoints[0];
            rebarGroup.EndPoint   = (TSG.Point)locationPoints[1];

            //RebarInfo 클래스에서 불러올 값
            rebarGroup.Name  = "Rebar";
            rebarGroup.Size  = "13";
            rebarGroup.Grade = "SD400";
            rebarGroup.RadiusValues.Add(60.00);
            rebarGroup.Class = 11;

            //Form에서 설정
            rebarGroup.StartHook.Shape = RebarHookData.RebarHookShapeEnum.HOOK_180_DEGREES;
            rebarGroup.EndHook.Shape   = RebarHookData.RebarHookShapeEnum.HOOK_180_DEGREES;

            rebarGroup.OnPlaneOffsets.Add(25.00);
            rebarGroup.FromPlaneOffset       = 25;
            rebarGroup.StartPointOffsetValue = 25;
            rebarGroup.EndPointOffsetValue   = 25;

            rebarGroup.SpacingType = BaseRebarGroup.RebarGroupSpacingTypeEnum.SPACING_TYPE_TARGET_SPACE;
            rebarGroup.Spacings.Add(200);
            rebarGroup.ExcludeType = BaseRebarGroup.ExcludeTypeEnum.EXCLUDE_TYPE_NONE;
            rebarGroup.StirrupType = RebarGroup.RebarGroupStirrupTypeEnum.STIRRUP_TYPE_POLYGONAL;

            if (!rebarGroup.Insert())
            {
                Console.WriteLine("insert failed");
            }
            else
            {
                model.CommitChanges();
            }
        }
        /// <summary>
        /// Calculate polygon for rebar group by solid of InputObject.
        /// Object's Axis Aligned Bounding Box (AABB) is used for calculation.
        /// </summary>
        /// <param name="InputObject"></param>
        /// <returns></returns>
        private Polygon GetPolygonBySolidsAABB(Tekla.Structures.Model.Part InputObject)
        {
            Polygon Result = new Polygon();

            Solid BeamSolid = InputObject.GetSolid();

            Result.Points.Add(new Point(BeamSolid.MaximumPoint.X, BeamSolid.MaximumPoint.Y, 0));
            Result.Points.Add(new Point(BeamSolid.MinimumPoint.X, BeamSolid.MaximumPoint.Y, 0));
            Result.Points.Add(new Point(BeamSolid.MinimumPoint.X, BeamSolid.MinimumPoint.Y, 0));
            Result.Points.Add(new Point(BeamSolid.MaximumPoint.X, BeamSolid.MinimumPoint.Y, 0));
            Result.Points.Add(new Point(BeamSolid.MaximumPoint.X, BeamSolid.MaximumPoint.Y, 0));

            return(Result);
        }
Пример #4
0
        public override bool checkModelObjects(_Mark other)
        {
            TSM.RebarGroup part1 = _part as TSM.RebarGroup;
            TSM.RebarGroup part2 = other._part as TSM.RebarGroup;

            T3D.Point p1start = __GeometryOperations.factor1Point(part1.StartPoint, _view as TSD.View);
            T3D.Point p1end   = __GeometryOperations.factor1Point(part1.EndPoint, _view as TSD.View);
            T3D.Point p2start = __GeometryOperations.factor1Point(part2.StartPoint, other._view as TSD.View);
            T3D.Point p2end   = __GeometryOperations.factor1Point(part2.EndPoint, other._view as TSD.View);

            if (!__GeometryOperations.compare2Points(p1start, p2start))
            {
                return(false);
            }
            if (!__GeometryOperations.compare2Points(p1end, p2end))
            {
                return(false);
            }

            ArrayList polygon1 = part1.Polygons;
            ArrayList polygon2 = part2.Polygons;

            if (polygon1.Count != polygon2.Count)
            {
                return(false);
            }

            for (int i = 0; i < polygon1.Count; i++)
            {
                TSM.Polygon poly1 = polygon1[i] as TSM.Polygon;
                TSM.Polygon poly2 = polygon2[i] as TSM.Polygon;

                ArrayList points1 = poly1.Points;
                ArrayList points2 = poly2.Points;

                ArrayList transformed1 = __GeometryOperations.factorPointArray(points1, _view as TSD.View);
                ArrayList transformed2 = __GeometryOperations.factorPointArray(points2, other._view as TSD.View);

                if (!__GeometryOperations.comparePointArray(transformed1, transformed2))
                {
                    return(false);
                }
            }

            return(true);
        }
        static private void ungroupRebar(TSM.RebarGroup current)
        {
            ArrayList currentPolygons = current.GetRebarGeometries(true);

            foreach (TSM.RebarGeometry geo in currentPolygons)
            {
                TSM.Polygon poly   = new TSM.Polygon();
                PolyLine    line   = geo.Shape;
                ArrayList   points = line.Points;

                poly.Points = points;

                SingleRebar single = new SingleRebar();
                single.Polygon = poly;
                single.Father  = current.Father;

                single.Name = current.Name;

                single.Class        = current.Class;
                single.Size         = current.Size;
                single.Grade        = current.Grade;
                single.RadiusValues = current.RadiusValues;

                single.NumberingSeries.StartNumber = current.NumberingSeries.StartNumber;
                single.NumberingSeries.Prefix      = current.NumberingSeries.Prefix;

                single.OnPlaneOffsets = new ArrayList();
                single.OnPlaneOffsets.Add(0.0);
                single.StartHook.Angle  = -90;
                single.StartHook.Length = 10;
                single.StartHook.Radius = 10;
                single.StartHook.Shape  = RebarHookData.RebarHookShapeEnum.NO_HOOK;
                single.EndHook.Angle    = 90;
                single.EndHook.Length   = 10;
                single.EndHook.Radius   = 10;
                single.EndHook.Shape    = RebarHookData.RebarHookShapeEnum.NO_HOOK;

                single.Insert();
            }

            current.Delete();
            MessageBox.Show(currentPolygons.Count.ToString());
        }
Пример #6
0
        private void btn_createRebar_Click(object sender, EventArgs e)
        {
            //철근 정보가 저장된 reabarInfo 클래스, 해당 클래스에는 반경 정보를 비롯한 철근의 정보들이 저장되어있어야함
            //RebarInfo rebarInfo = new RebarInfo();
            TSM.RebarGroup rebarGroup = new TSM.RebarGroup();

            Picker picker = new Picker();

            //부재선택
            TSM.Beam fatherObject = picker.PickObject(Picker.PickObjectEnum.PICK_ONE_OBJECT, "철근을 삽입할 부재를 선택하세요.") as TSM.Beam;
            //철근 형태를 결정할 Point 선택
            ArrayList shapePoints = picker.PickPoints(Picker.PickPointEnum.PICK_POLYGON, "철근 형태를 결정할 포인트를 선택하세요.");

            //철근 생성 위치를 결정할 Point 선택
            //ArrayList locationPoints = picker.PickPoints(Picker.PickPointEnum.PICK_POLYGON, "철근 생성 위치를 결정할 포인트를 선택하세요.");

            TSM.Polygon polygon = new TSM.Polygon();
            for (int i = 0; i < shapePoints.Count; i++)
            {
                polygon.Points.Add(shapePoints[i] as TSG.Point);
            }

            rebarGroup.Polygons.Add(polygon);

            //StartPoint와 EndPoint 중간에 또 값이 들어갈 수도 있는데 철근 생성위치 결정에서의 Polygon 대입을 어떻게 하는지 확인해봐야함
            rebarGroup.Father = fatherObject;

            rebarGroup.StartPoint = new TSG.Point(500, 3500, 0);
            rebarGroup.EndPoint   = new TSG.Point(500, 3500, 5000);
            //rebarGroup.StartPoint = (TSG.Point)locationPoints[0];
            //rebarGroup.EndPoint = (TSG.Point)locationPoints[1];

            //철근 기본정보 (추후 rebarInfo에서 로드)
            rebarGroup.Name  = "MainRebar";
            rebarGroup.Size  = "13";
            rebarGroup.Grade = "SD400";
            rebarGroup.Class = 11;
            rebarGroup.RadiusValues.Add(60.00);
            //rebarGroup.NumberingSeries.Prefix = "GR";

            //갈고리 설정 (추후 Form 컨트롤에 연동)
            rebarGroup.StartHook.Shape = RebarHookData.RebarHookShapeEnum.NO_HOOK;
            rebarGroup.EndHook.Shape   = RebarHookData.RebarHookShapeEnum.NO_HOOK;

            //offset설정 (추후 Form 컨트롤에 연동)
            rebarGroup.OnPlaneOffsets.Add(0);
            rebarGroup.FromPlaneOffset       = 0;
            rebarGroup.StartPointOffsetValue = 0;
            rebarGroup.EndPointOffsetValue   = 0;

            //간격 배치방법 설정 (추후 Form 컨트롤에 연동)
            rebarGroup.SpacingType = TSM.BaseRebarGroup.RebarGroupSpacingTypeEnum.SPACING_TYPE_TARGET_SPACE;
            rebarGroup.Spacings.Add(0.0);
            rebarGroup.ExcludeType = BaseRebarGroup.ExcludeTypeEnum.EXCLUDE_TYPE_NONE;
            rebarGroup.StirrupType = RebarGroup.RebarGroupStirrupTypeEnum.STIRRUP_TYPE_POLYGONAL;


            bool result = false;

            result = rebarGroup.Insert();

            if (result == false)
            {
                MessageBox.Show("insert Failed");
            }
        }
Пример #7
0
        private void btn_createCstirrup_Click(object sender, EventArgs e)
        {
            //기본객체 생성
            RebarGroup rebarGroup = new RebarGroup();
            Picker     picker     = new Picker();

            //부재선택
            TSM.ModelObject mainpart = picker.PickObject(Picker.PickObjectEnum.PICK_ONE_PART, "철근을 삽입할 부재를 선택하세요.");
            TSM.Beam        Beam     = mainpart as TSM.Beam;
            rebarGroup.Father = Beam;

            //철근 형태를 결정할 Point 선택
            TSM.Polygon polygon = new TSM.Polygon();

            double MinX = Beam.GetSolid().MinimumPoint.X;
            double MinY = Beam.GetSolid().MinimumPoint.Y;
            double MinZ = Beam.GetSolid().MinimumPoint.Z;
            double MaxX = Beam.GetSolid().MaximumPoint.X;
            double MaxY = Beam.GetSolid().MaximumPoint.Y;
            double MaxZ = Beam.GetSolid().MaximumPoint.Z;

            polygon.Points.Add(new TSG.Point(MaxX, MinY, MinZ));
            polygon.Points.Add(new TSG.Point(MaxX, MaxY, MinZ));
            polygon.Points.Add(new TSG.Point(MaxX, MaxY, MaxZ));
            polygon.Points.Add(new TSG.Point(MaxX, MinY, MaxZ));
            polygon.Points.Add(new TSG.Point(MaxX, MinY, MinZ));
            rebarGroup.Polygons.Add(polygon);

            //철근 생성 위치를 결정할 Point 선택
            //ArrayList locationPoints = picker.PickPoints(Picker.PickPointEnum.PICK_POLYGON, "철근 생성 위치를 결정할 포인트를 선택하세요.");
            rebarGroup.StartPoint = new TSG.Point(MaxX, MinY, MinZ);
            rebarGroup.EndPoint   = new TSG.Point(MinX, MinY, MinZ);

            //RebarInfo 클래스에서 불러올 값
            rebarGroup.Name  = "Rebar";
            rebarGroup.Size  = "13";
            rebarGroup.Grade = "SD400";
            rebarGroup.RadiusValues.Add(60.00);
            rebarGroup.Class = 11;

            //Form에서 설정
            rebarGroup.StartHook.Shape  = RebarHookData.RebarHookShapeEnum.HOOK_135_DEGREES;
            rebarGroup.StartHook.Length = 100.0;
            rebarGroup.StartHook.Radius = 20.0;
            rebarGroup.EndHook.Shape    = RebarHookData.RebarHookShapeEnum.HOOK_135_DEGREES;
            rebarGroup.EndHook.Length   = 100.0;
            rebarGroup.EndHook.Radius   = 20.0;

            rebarGroup.OnPlaneOffsets.Add(25.00);
            rebarGroup.FromPlaneOffset       = 25;
            rebarGroup.StartPointOffsetValue = 25;
            rebarGroup.EndPointOffsetValue   = 25;

            rebarGroup.SpacingType = BaseRebarGroup.RebarGroupSpacingTypeEnum.SPACING_TYPE_TARGET_SPACE;
            rebarGroup.Spacings.Add(200);
            rebarGroup.ExcludeType = BaseRebarGroup.ExcludeTypeEnum.EXCLUDE_TYPE_NONE;
            rebarGroup.StirrupType = RebarGroup.RebarGroupStirrupTypeEnum.STIRRUP_TYPE_POLYGONAL;

            if (!rebarGroup.Insert())
            {
                Console.WriteLine("insert failed");
            }
            else
            {
                model.CommitChanges();
            }
        }
Пример #8
0
        private void btn_createMainRebar_Click(object sender, EventArgs e)
        {
            //기본객체 생성
            RebarGroup rebarGroup = new RebarGroup();
            Picker     picker     = new Picker();

            //부재선택
            TSM.ModelObject mainpart = picker.PickObject(Picker.PickObjectEnum.PICK_ONE_PART, "철근을 삽입할 부재를 선택하세요.");
            TSM.Beam        Beam     = mainpart as TSM.Beam;
            rebarGroup.Father = Beam;

            //Beam 프로퍼티 확인용
            Solid solid = Beam.GetSolid();

            if (solid != null)
            {
                EdgeEnumerator edgeEnumerator = solid.GetEdgeEnumerator();
                int            edgeCount      = 0;
                while (edgeEnumerator.MoveNext())
                {
                    var edge = edgeEnumerator.Current as Edge;
                    if (edge != null)
                    {
                        Console.WriteLine("Start : " + edge.StartPoint.ToString());
                        Console.WriteLine("End : " + edge.EndPoint.ToString());
                        Console.WriteLine("Type : " + edge.Type.ToString());
                        edgeCount++;
                    }
                }

                Console.WriteLine("Edge count : " + edgeCount.ToString());
            }



            //철근 형태를 결정할 Point 선택
            ArrayList shapePoints = picker.PickPoints(Picker.PickPointEnum.PICK_POLYGON, "철근 형태를 결정할 포인트를 선택하세요.");

            TSM.Polygon polygon = new TSM.Polygon();
            for (int i = 0; i < shapePoints.Count; i++)
            {
                polygon.Points.Add(shapePoints[i]);
            }
            rebarGroup.Polygons.Add(polygon);

            //철근 생성 위치를 결정할 Point 선택
            ArrayList locationPoints = picker.PickPoints(Picker.PickPointEnum.PICK_POLYGON, "철근 생성 위치를 결정할 포인트를 선택하세요.");

            rebarGroup.StartPoint = (TSG.Point)locationPoints[0];
            rebarGroup.EndPoint   = (TSG.Point)locationPoints[1];

            //RebarInfo 클래스에서 불러올 값
            rebarGroup.Name  = "Rebar";
            rebarGroup.Size  = "13";
            rebarGroup.Grade = "SD400";
            rebarGroup.RadiusValues.Add(60.00);
            rebarGroup.Class = 11;

            //Form에서 설정
            rebarGroup.StartHook.Shape = RebarHookData.RebarHookShapeEnum.NO_HOOK;
            rebarGroup.EndHook.Shape   = RebarHookData.RebarHookShapeEnum.NO_HOOK;

            rebarGroup.OnPlaneOffsets.Add(25.00);
            rebarGroup.FromPlaneOffset       = 25;
            rebarGroup.StartPointOffsetValue = 25;
            rebarGroup.EndPointOffsetValue   = 25;

            rebarGroup.SpacingType = BaseRebarGroup.RebarGroupSpacingTypeEnum.SPACING_TYPE_TARGET_SPACE;
            rebarGroup.Spacings.Add(200);
            rebarGroup.ExcludeType = BaseRebarGroup.ExcludeTypeEnum.EXCLUDE_TYPE_NONE;
            rebarGroup.StirrupType = RebarGroup.RebarGroupStirrupTypeEnum.STIRRUP_TYPE_POLYGONAL;

            if (!rebarGroup.Insert())
            {
                Console.WriteLine("insert failed");
            }
            else
            {
                model.CommitChanges();
            }
        }