Esempio n. 1
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();
            }
        }
Esempio n. 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            // *기본 가정
            //  1) 슬라브를 배치할 두 빔은 평행
            //  2) 슬라브는 비스듬하게 배치되지 않음.(두빔에 항상 수직방향으로 배치됨)
            //  3) 슬라브는 z평면과 수평하게 배치됨
            TSM.Model currentModel = new TSM.Model();

            try
            {
                // 1. 슬라브 객체 생성
                ContourPlate contourPlate = new ContourPlate();

                // 2. 슬라브 생성할 두 부재 선택
                Picker          picker    = new Picker();
                TSM.ModelObject mainpart  = picker.PickObject(Picker.PickObjectEnum.PICK_ONE_PART, "슬라브를 삽입할 첫번째 부재를 선택하세요.");
                TSM.Beam        startBeam = mainpart as TSM.Beam;
                mainpart = picker.PickObject(Picker.PickObjectEnum.PICK_ONE_PART, "슬라브를 삽입할 두번째 부재를 선택하세요.");
                TSM.Beam endBeam = mainpart as TSM.Beam;

                // 3. 기본 방향벡터 생성
                //  1) StartBeam의 길이방향 단위벡터
                TSG.Vector startBeamLDirectionVector = new TSG.Vector(startBeam.EndPoint - startBeam.StartPoint).GetNormal();

                //  2) StartBeam의 높이방향 단위벡터-
                TSG.Vector startBeamHDirecitionVector = new TSG.Vector(0, 0, 1); //추후 기울어진 빔에도 적용가능하도록 변경

                //  EdgeEnumerator를 통해 StartBeam의 높이방향 단위벡터 구하기
                Solid solid = startBeam.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());

                            if (edgeCount == 8)
                            {
                                startBeamHDirecitionVector = new TSG.Vector((edge.EndPoint.X - edge.StartPoint.X) / 2, (edge.EndPoint.Y - edge.StartPoint.Y) / 2, (edge.EndPoint.Z - edge.StartPoint.Z) / 2).GetNormal();
                            }
                            edgeCount++;
                        }
                    }
                }

                //  3) StartBeam -> EndBeam 방향 단위벡터 (중점에서 중점 잇는 벡터)
                TSG.Point sbSP = startBeam.StartPoint;
                TSG.Point sbEP = startBeam.EndPoint;
                TSG.Point ebSP = endBeam.StartPoint;
                TSG.Point ebEP = endBeam.EndPoint;
                TSG.Point starBeamCenterPoint = new TSG.Point((sbSP.X + sbEP.X) / 2, (sbSP.Y + sbEP.Y) / 2, (sbSP.Z + sbEP.Z) / 2);
                TSG.Point endBeamCenterPoint  = new TSG.Point((ebSP.X + ebEP.X) / 2, (ebSP.Y + ebEP.Y) / 2, (ebSP.Z + ebEP.Z) / 2);

                TSG.Vector startBeamToEndBeamVector          = new TSG.Vector((ebSP.X + ebEP.X) / 2 - (sbSP.X + sbEP.X) / 2, (ebSP.Y + ebEP.Y) / 2 - (sbSP.Y + sbEP.Y) / 2, (ebSP.Z + ebEP.Z) / 2 - (sbSP.Z + sbEP.Z) / 2);
                TSG.Vector startBeamToEndBeamDirectionVector = new TSG.Vector((ebSP.X + ebEP.X) / 2 - (sbSP.X + sbEP.X) / 2, (ebSP.Y + ebEP.Y) / 2 - (sbSP.Y + sbEP.Y) / 2, (ebSP.Z + ebEP.Z) / 2 - (sbSP.Z + sbEP.Z) / 2).GetNormal();

                // 3. 슬라브 치수 및 기타속성 입력 ( 현재는 상수 )
                double slabWidthLeft   = 300;
                double slabWidthCenter = 300;
                double slabWidthRight  = 300;
                double slabThickness   = 100;
                double ribThickness    = 200;
                double ribDistUpper    = 50;
                double ribDistLower    = 30;
                double ribInterval     = ribDistUpper - ribDistLower;

                double startOffset = 100;
                contourPlate.Profile.ProfileString   = (startBeamToEndBeamVector.GetLength() - startOffset * 2).ToString();
                contourPlate.Material.MaterialString = "C24";

                // 4. 슬라브 시작점 설정
                //  1) 길이방향(일단은 startPoint점에서 시작하는걸로)
                String    direction      = "정방향"; //사용자가 직접 선택. 정방향 or 역방향
                TSG.Point slabStartPoint = new TSG.Point();

                if (direction == "정방향")
                {
                    slabStartPoint = startBeam.StartPoint;
                }
                else if (direction == "역방향")
                {
                    slabStartPoint            = startBeam.EndPoint;
                    startBeamLDirectionVector = startBeamLDirectionVector * -1;
                }

                //  2) 높이방향
                double heightConstant = 0.0;
                //depth type에 따른 슬라브 생성높이 변경
                if (startBeam.Position.Depth == Position.DepthEnum.FRONT)
                {
                    heightConstant = 1.0;
                }
                else if (startBeam.Position.Depth == Position.DepthEnum.MIDDLE)
                {
                    heightConstant = 0.5;
                }
                slabStartPoint += startBeamHDirecitionVector * ((Methods.GetGirderHeight(startBeam) * heightConstant + slabThickness + ribThickness));

                //  3) endBeam방향
                slabStartPoint += startBeamToEndBeamDirectionVector * (startOffset);

                // 5. 슬라브 포인트 입력
                List <TSG.Point> pointList = new List <TSG.Point>();

                pointList.Add(slabStartPoint);
                pointList.Add(pointList[0] + (startBeamHDirecitionVector * slabThickness * -1));
                pointList.Add(pointList[1] + (startBeamLDirectionVector * slabWidthLeft));
                pointList.Add(pointList[2] + (startBeamLDirectionVector * ribInterval) + (startBeamHDirecitionVector * ribThickness * -1));
                pointList.Add(pointList[3] + (startBeamLDirectionVector * ribDistLower));
                pointList.Add(pointList[4] + (startBeamLDirectionVector * ribInterval) + (startBeamHDirecitionVector * ribThickness));
                pointList.Add(pointList[5] + (startBeamLDirectionVector * slabWidthCenter));
                pointList.Add(pointList[6] + (startBeamLDirectionVector * ribInterval) + (startBeamHDirecitionVector * ribThickness * -1));
                pointList.Add(pointList[7] + (startBeamLDirectionVector * ribDistLower));
                pointList.Add(pointList[8] + (startBeamLDirectionVector * ribInterval) + (startBeamHDirecitionVector * ribThickness));
                pointList.Add(pointList[9] + (startBeamLDirectionVector * slabWidthRight));
                pointList.Add(pointList[10] + (startBeamHDirecitionVector * slabThickness));

                for (int i = 0; i <= 11; i++)
                {
                    contourPlate.AddContourPoint(new ContourPoint(pointList[i], null));
                }

                // 4. 슬라브 깊이타입 결정
                //  1) StartBeam 중앙에서 L,H Direction의 법선 벡터방향 으로 Line을 뻗어 EndBeam과 겹치는 부분이 있는지 확인
                //  2) 겹치면 깊이타입 Front , 겹치지 않으면 Back

                //  StartBeam 중앙에서 L,H Direction의 법선 벡터(외적 결과값)
                TSG.Vector crossResult = TSG.Vector.Cross(startBeamHDirecitionVector, startBeamLDirectionVector);

                //  외적벡터의 연장선
                TSG.Point       extendedPoint     = new TSG.Point(starBeamCenterPoint.X, starBeamCenterPoint.Y, starBeamCenterPoint.Z) + new TSG.Point(crossResult.X * 10000, crossResult.Y * 10000, crossResult.Z * 10000);
                TSG.LineSegment centerLineSegment = new TSG.LineSegment(starBeamCenterPoint, extendedPoint);

                //endBeam의 Plane 작성
                TSG.Vector         planeNormalVector = crossResult; //조건 중 startBeam과 endBeam이 평행하므로 평면을 구성하는 법선벡터 또한 같다.
                TSG.GeometricPlane endBeamPlane      = new TSG.GeometricPlane(endBeamCenterPoint, planeNormalVector);

                //두 line이 겹치는지 확인하는 Point (겹치면 값이 있고 안겹치면 값이 없음)
                TSG.Point isIntersect = TSG.Intersection.LineSegmentToPlane(centerLineSegment, endBeamPlane);
                if (isIntersect != null) // endBeam이 오른쪽에 있을 때
                {
                    if (direction == "정방향")
                    {
                        contourPlate.Position.Depth = Position.DepthEnum.BEHIND;
                    }
                    else if (direction == "역방향")
                    {
                        contourPlate.Position.Depth = Position.DepthEnum.FRONT;
                    }
                }
                else if (isIntersect == null) // endBeam이 오른쪽에 없을 때
                {
                    if (direction == "정방향")
                    {
                        contourPlate.Position.Depth = Position.DepthEnum.FRONT;
                    }
                    else if (direction == "역방향")
                    {
                        contourPlate.Position.Depth = Position.DepthEnum.BEHIND;
                    }
                }
                bool result = false;
                result = contourPlate.Insert();
                currentModel.CommitChanges();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 3
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();
            }
        }