Пример #1
0
        public SwapHandles()
        {
            var selector = new Tekla.Structures.Model.UI.ModelObjectSelector();
            var myEnum   = selector.GetSelectedObjects();

            while (myEnum.MoveNext())
            {
                if (myEnum.Current is Tekla.Structures.Model.ContourPlate)
                {
                    ContourPlate cPlate = myEnum.Current as ContourPlate;
                    cPlate.Position.Depth = SwapEndForces(cPlate.Position.Depth);
                    cPlate.Modify();
                }
                else if (myEnum.Current is Tekla.Structures.Model.BooleanPart)
                {
                    BooleanPart  boolPart        = myEnum.Current as Tekla.Structures.Model.BooleanPart;
                    ContourPlate boolConturPlate = boolPart.OperativePart as Tekla.Structures.Model.ContourPlate;

                    if (boolConturPlate != null)
                    {
                        boolConturPlate.Position.Depth = SwapEndForces(boolConturPlate.Position.Depth);
                        boolConturPlate.Modify();
                    }
                }
            }

            new Model().CommitChanges();
        }
Пример #2
0
        public Form1()
        {
            #region Initialize
            InitializeComponent();
            bentPlate    = null;
            samplePlate1 = null;
            samplePlate2 = null;
            model        = new Model();
            #endregion

            #region Event : Click
            CreateSamplePlatesButton.Click += CreateSamplePlatesButton_Click;
            CreateMaxRadiusBendPlate.Click += CreateMaxRadiusBendPlate_Click;

            CreateSamplePlatesButton2.Click      += CreateSamplePlatesButton2_Click;
            CreateBentPlateWithGivenRadius.Click += CreateBentPlateWithGivenRadius_Click;

            CreateByFacesSamplePlates.Click    += CreateByFacesSamplePlates_Click;
            CreateSampleBentPlateByFaces.Click += CreateSampleBentPlateByFaces_Click;

            SimpleCreateByAddLeg.Click        += SimpleCreateByAddLeg_Click;
            CreateByAddLegWithRadius.Click    += CreateByAddLegWithRadius_Click;
            CreateByAddLegUsingSegments.Click += CreateByAddLegUsingSegments_Click;

            #endregion
        }
        private Part DrawUpFloor(Point input, Vector alongStairVect, double width, double length, double overlap, string floorProfile, string floorMaterial)
        {
            Vector zaxis     = new Vector(0, 0, -1);
            Vector shortEdge = Vector.Cross(zaxis, alongStairVect);

            alongStairVect = alongStairVect * length * (-1);
            Vector shortEdgeLeft     = shortEdge * ((width + 2 * overlap) / 2);
            Vector shortEdgeRight    = shortEdgeLeft * (-1);
            Point  leftNearCornerPt  = new Point(input.X + shortEdgeLeft.X, input.Y + shortEdgeLeft.Y, input.Z + shortEdgeLeft.Z);
            Point  rightNearCornerPt = new Point(input.X + shortEdgeRight.X, input.Y + shortEdgeRight.Y, input.Z + shortEdgeRight.Z);
            Point  leftFarCornerPt   = new Point(leftNearCornerPt.X + alongStairVect.X, leftNearCornerPt.Y + alongStairVect.Y, leftNearCornerPt.Z + alongStairVect.Z);
            Point  rightFarCornerPt  = new Point(rightNearCornerPt.X + alongStairVect.X, rightNearCornerPt.Y + alongStairVect.Y, rightNearCornerPt.Z + alongStairVect.Z);

            ContourPoint leftCpStartPt  = new ContourPoint(leftNearCornerPt, null);
            ContourPoint leftCpEndPt    = new ContourPoint(leftFarCornerPt, null);
            ContourPoint rightCpStartPt = new ContourPoint(rightNearCornerPt, null);
            ContourPoint rightCpEndPt   = new ContourPoint(rightFarCornerPt, null);

            ContourPlate floorBeam = new ContourPlate();

            floorBeam.AddContourPoint(leftCpStartPt);
            floorBeam.AddContourPoint(leftCpEndPt);
            floorBeam.AddContourPoint(rightCpEndPt);
            floorBeam.AddContourPoint(rightCpStartPt);
            floorBeam.Profile.ProfileString   = floorProfile;
            floorBeam.Material.MaterialString = floorMaterial;
            floorBeam.Position.Depth          = Position.DepthEnum.FRONT;

            floorBeam.Insert();

            return(floorBeam);
        }
Пример #4
0
 private void MallinnaTukiraudoitukset(ContourPlate laatta)
 {
     for (int i = 0; i < kentat.Length; i++)
     {
         foreach (string suunta in kentat[i].Tukiraudat.Keys)
         {
             if (Skippaa(kentat[i], suunta))
             {
                 continue;
             }
             RebarGroup rGroup = new RebarGroup();
             rGroup.Class = 10;
             rGroup.Name  = "Tukiraudoitus " + kentat[i].Numero + " " + suunta;
             rGroup.Size  = kentat[i].Tukiraudat[suunta].Koko.ToString();
             rGroup.Grade = kentat[i].Tukiraudat[suunta].Tyyppi;
             rGroup.RadiusValues.Add(30.0);
             rGroup.OnPlaneOffsets.Add(Asetukset.ArvioituMittaYlapinnasta);
             rGroup.FromPlaneOffset       = (Asetukset.LaatanPaksuus - Asetukset.ArvioituMittaYlapinnasta);
             rGroup.StartPointOffsetValue = -1 * kentat[i].Tukiraudat[suunta].TankojenPituus;
             rGroup.EndPointOffsetValue   = -1 * kentat[i].Tukiraudat[suunta].TankojenPituus;
             rGroup.StartPointOffsetType  = Reinforcement.RebarOffsetTypeEnum.OFFSET_TYPE_COVER_THICKNESS;
             rGroup.EndPointOffsetType    = Reinforcement.RebarOffsetTypeEnum.OFFSET_TYPE_COVER_THICKNESS;
             rGroup.SpacingType           = BaseRebarGroup.RebarGroupSpacingTypeEnum.SPACING_TYPE_EXACT_SPACE_FLEX_AT_BOTH;
             rGroup.Spacings.Add(kentat[i].Tukiraudat[suunta].Jako);
             rGroup.Father = laatta;
             rGroup.Polygons.Add(HaeTukiraudoituksenPolygon(kentat[i], suunta, rGroup));
             rGroup.ExcludeType = BaseRebarGroup.ExcludeTypeEnum.EXCLUDE_TYPE_NONE;
             rGroup.Insert();
             malli.CommitChanges();
         }
     }
 }
Пример #5
0
    public ContourPlate CreateCut(
        Point point1,
        Point point2,
        Point point3,
        Point point4,
        Part Part_To_Be_Cut)
    {
        ContourPlate contourPlate = new ContourPlate();

        contourPlate.Profile.ProfileString   = "PL500";
        contourPlate.Material.MaterialString = "ANTIMATERIAL";
        contourPlate.Finish         = "";
        contourPlate.Class          = "BlOpCl";
        contourPlate.Position.Depth = Position.DepthEnum.MIDDLE;
        contourPlate.AddContourPoint(new ContourPoint(point1, (Chamfer)null));
        contourPlate.AddContourPoint(new ContourPoint(point2, (Chamfer)null));
        contourPlate.AddContourPoint(new ContourPoint(point3, (Chamfer)null));
        contourPlate.AddContourPoint(new ContourPoint(point4, (Chamfer)null));
        contourPlate.Insert();
        BooleanPart booleanPart = new BooleanPart();

        booleanPart.Father        = (ModelObject)Part_To_Be_Cut;
        booleanPart.OperativePart = (Part)contourPlate;
        booleanPart.Insert();
        return(contourPlate);
    }
Пример #6
0
        static void Main(string[] args)
        {
            var model = new Model();

            if (model.GetConnectionStatus())
            {
                Console.WriteLine("Give diameter");
                int diameter       = Int32.Parse(Console.ReadLine());
                int numberOfPoints = 90;
                var slab           = new ContourPlate();
                for (int i = 0; i < numberOfPoints; i++)
                {
                    slab.AddContourPoint(new ContourPoint(
                                             new Tekla.Structures.Geometry3d.Point(
                                                 Math.Sin(360 / numberOfPoints * i * Math.PI / 180) * diameter / 2,
                                                 Math.Cos(360 / numberOfPoints * i * Math.PI / 180) * diameter / 2,
                                                 0),
                                             null));
                }

                slab.Class = "5";
                slab.Profile.ProfileString = "500";

                slab.Insert();

                //Beam beam = new Beam();
                //beam.StartPoint = new Tekla.Structures.Geometry3d.Point(0, 0, 0);
                //beam.EndPoint = new Tekla.Structures.Geometry3d.Point(0, 1500, 0);
                //beam.Profile.ProfileString = "600*500";
                //beam.Class = "4";
                //beam.Insert();

                model.CommitChanges();
            }
        }
Пример #7
0
        public static void IntersectionTest()
        {
            var model = new Model();

            if (model.GetConnectionStatus())
            {
                var startPoint    = PickAPoint("выбери точку");
                var startPointTwo = new Point(startPoint.X, startPoint.Y + 1000, startPoint.Z);
                List <RandomlyPlate> plateList = new List <RandomlyPlate>();
                plateList.Add(new RandomlyPlate(startPoint, rnd));
                plateList.Add(new RandomlyPlate(startPointTwo, rnd));
                if (Helper.GetIntersectionPlate(plateList[0].ContourPoints, plateList[1].ContourPoints))
                {
                    plateList[0].Number = 1;
                    plateList[1].Number = 2;
                }

                foreach (var item in plateList)
                {
                    var plate = new ContourPlate();
                    foreach (var point in item.ContourPoints)
                    {
                        plate.AddContourPoint(new ContourPoint(point, null));
                    }
                    plate.Name = "Пластина";
                    plate.Profile.ProfileString   = "—6";
                    plate.Material.MaterialString = "С255";
                    plate.Class = $"{item.Number + 1}";
                    plate.Insert();
                }
            }
            model.CommitChanges();
        }
Пример #8
0
        ContourPlate CreateConturePlate(TSG.Point point)
        {
            double x = 300;
            double y = 300;

            TSG.Point point1 = new TSG.Point(point.X - x / 2, point.Y - y / 2, point.Z);
            TSG.Point point2 = new TSG.Point(point.X + x / 2, point.Y - y / 2, point.Z);
            TSG.Point point3 = new TSG.Point(point.X + x / 2, point.Y + y / 2, point.Z);
            TSG.Point point4 = new TSG.Point(point.X - x / 2, point.Y + y / 2, point.Z);

            ContourPlate CP            = new ContourPlate();
            ContourPoint conturePoint1 = new ContourPoint(point1, null);
            ContourPoint conturePoint2 = new ContourPoint(point2, null);
            ContourPoint conturePoint3 = new ContourPoint(point3, null);
            ContourPoint conturePoint4 = new ContourPoint(point4, null);

            CP.AddContourPoint(conturePoint1);
            CP.AddContourPoint(conturePoint2);
            CP.AddContourPoint(conturePoint3);
            CP.AddContourPoint(conturePoint4);
            CP.Finish = "FOO";
            CP.Profile.ProfileString   = "PL10";
            CP.Material.MaterialString = "S235";

            return(CP);
        }
Пример #9
0
        private void GetInfoFromDrawing(DrawingObject pickedObject)
        {
            modelObjectTextBox.Clear();

            if (pickedObject != null)
            {
                TSD.ModelObject modelObjectInDrawing = pickedObject as TSD.ModelObject;
                if (modelObjectInDrawing != null)
                {
                    TSM.ModelObject modelObjectInModel = model.SelectModelObject(modelObjectInDrawing.ModelIdentifier);
                    if (modelObjectInModel is TSM.Part)
                    {
                        Beam beam = modelObjectInModel as Beam;
                        if (beam != null)
                        {
                            GetBeamInfo(beam);
                        }
                        PolyBeam polyBeam = modelObjectInModel as PolyBeam;
                        if (polyBeam != null)
                        {
                            GetPolyBeamInfo(polyBeam);
                        }
                        ContourPlate contourPlate = modelObjectInModel as ContourPlate;
                        if (contourPlate != null)
                        {
                            GetContourPlateInfo(contourPlate);
                        }
                    }
                }
            }
        }
Пример #10
0
        private void distance_Click(object sender, EventArgs e)
        {
            Picker picker = new Picker();
            Part   part   = picker.PickObject(Picker.PickObjectEnum.PICK_ONE_OBJECT) as Part;
            Beam   beam   = part as Beam;

            if (beam != null)
            {
                var currentPlane = SetPlaneAndReturnOriginal(beam);
                //cs_net_lib.UI.DrawPlane(beam.GetCoordinateSystem(), new TSM.UI.Color(0.5, 1, 1),
                //    new TSM.UI.Color(1, 0.5, 1), "Вася");
                Point px = new Point(-beam.EndPoint.X + beam.StartPoint.X, beam.EndPoint.Y - beam.StartPoint.Y,
                                     beam.EndPoint.Z - beam.StartPoint.Z);
                Vector vZ;

                vZ = new Vector(-px.Y, px.X, px.Z);

                var localPlane = new TransformationPlane(beam.EndPoint, new Vector(px), vZ);

                CoordinateSystem localCoor = new CoordinateSystem(beam.EndPoint, new Vector(px), vZ);

                cs_net_lib.UI.DrawPlane(beam.GetCoordinateSystem());
                cs_net_lib.UI.DrawPlane(localCoor);
                teklaModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(currentPlane);
            }
            ContourPlate plate = part as ContourPlate;

            if (plate != null)
            {
                //cs_net_lib.UI.DrawPlane(beam.GetCoordinateSystem(), new TSM.UI.Color(0.5, 1, 1),
                //    new TSM.UI.Color(1, 0.5, 1), "Вася");
                cs_net_lib.UI.DrawPlane(plate.GetCoordinateSystem());
            }
            string tesGid = null;
        }
Пример #11
0
        private void MallinnaKenttaraudoitusVerkot(ContourPlate laatta)
        {
            for (int i = 0; i < kentat.Length; i++)
            {
                Polygon polygon = new Polygon();
                Point   p1      = kentat[i].VasenAlanurkkaTekla;
                Point   p2      = new Point(kentat[i].VasenAlanurkkaTekla.X, kentat[i].VasenAlanurkkaTekla.Y + kentat[i].Korkeus * 1000, 3000);
                Point   p3      = new Point(kentat[i].VasenAlanurkkaTekla.X + kentat[i].Leveys * 1000, kentat[i].VasenAlanurkkaTekla.Y + kentat[i].Korkeus * 1000, 3000);
                Point   p4      = new Point(kentat[i].VasenAlanurkkaTekla.X + kentat[i].Leveys * 1000, kentat[i].VasenAlanurkkaTekla.Y, 3000);
                polygon.Points.Add(p1);
                polygon.Points.Add(p2);
                polygon.Points.Add(p3);
                polygon.Points.Add(p4);

                Verkko raudoitus = kentat[i].RaudoitusYleensa;
                if (raudoitus.Tyyppi == "Ei sopivaa")
                {
                    continue;
                }
                double silmavali  = raudoitus.SilmaKokoVaaka;
                string verkonKoko = raudoitus.RaudanKoko.ToString();

                RebarMesh rMesh = new RebarMesh();
                rMesh.StartPoint                = p1;
                rMesh.EndPoint                  = p2;
                rMesh.CatalogName               = "Vähimmäisraudoitus";
                rMesh.LongitudinalSize          = verkonKoko;
                rMesh.CrossSize                 = verkonKoko;
                rMesh.LeftOverhangCross         = 100.0;
                rMesh.LeftOverhangLongitudinal  = 100.0;
                rMesh.RightOverhangCross        = 100.0;
                rMesh.RightOverhangLongitudinal = 100.0;
                rMesh.LongitudinalSpacingMethod = RebarMesh.RebarMeshSpacingMethodEnum.SPACING_TYPE_SAME_DISTANCE;
                rMesh.LongitudinalDistances.Add(silmavali);
                rMesh.CrossDistances.Add(silmavali);
                rMesh.Class = 7;
                rMesh.NumberingSeries.StartNumber = 0;
                rMesh.NumberingSeries.Prefix      = "Mesh";
                rMesh.Grade = raudoitus.Tyyppi;
                rMesh.OnPlaneOffsets.Add(raudoitus.SuojaBetoni);
                rMesh.FromPlaneOffset       = -raudoitus.SuojaBetoni;
                rMesh.StartPointOffsetType  = Reinforcement.RebarOffsetTypeEnum.OFFSET_TYPE_COVER_THICKNESS;
                rMesh.StartPointOffsetValue = raudoitus.SuojaBetoni;
                rMesh.StartFromPlaneOffset  = raudoitus.SuojaBetoni;

                rMesh.Name     = "Kentta " + kentat[i].Numero;
                rMesh.MeshType = RebarMesh.RebarMeshTypeEnum.POLYGON_MESH;
                rMesh.Polygon  = polygon;

                rMesh.CrossBarLocation = RebarMesh.RebarMeshCrossBarLocationEnum.LOCATION_TYPE_ABOVE;

                rMesh.EndFromPlaneOffset  = raudoitus.SuojaBetoni;
                rMesh.CutByFatherPartCuts = true;
                rMesh.Father = laatta;
                rMesh.Insert();
                malli.CommitChanges();
                RaudoitaKeskelle(kentat[i].RaudoitusKeskella, laatta, new Point[] { p1, p2, p3, p4 }, kentat[i]);
            }
        }
Пример #12
0
 public static dynamic GetTSObject(ContourPlate dynObject)
 {
     if (dynObject is null)
     {
         return(null);
     }
     return(dynObject.teklaObject);
 }
Пример #13
0
 private void CreateBendWithRadius(ContourPlate plate1, Tekla.Structures.Solid.Face face1, ContourPlate plate2, Tekla.Structures.Solid.Face face2, double radius)
 {
     if (bentPlate == null)
     {
         bentPlate = Tekla.Structures.Model.Operations.Operation.CreateBentPlateByFaces(plate1, face1, plate2, face2, radius);
     }
     else
     {
         bentPlate = Tekla.Structures.Model.Operations.Operation.CreateBentPlateByFaces(bentPlate, face1, plate2, face2, radius);
     }
 }
        public void UT_CutBeamByPart()
        {
            // test 0: обрезаем балку ThisBeam балкой MainBeam
            //.. создаем балку [0, 1000 - 2000,1000] I20 и обрезает ее
            //.. балкой MainBeam [500,0 - 500, 1500] I50
            Point p1 = new Point(0, 3000);
            Point p2 = new Point(2000, 3000);

            ThisBeam = _TS.CreateBeam("ThisBeam", "I20B1_20_93", p1, p2
                                      , PositionDepth: (int)Position.DepthEnum.MIDDLE);

            Point cp1 = new Point(1000, 0);
            Point cp2 = new Point(1000, 4000);

            MainBeam = _TS.CreateBeam("MainBeam", "I50B1_20_93", cp1, cp2
                                      , PositionDepth: (int)Position.DepthEnum.MIDDLE
                                      , Class: BooleanPart.BooleanOperativeClassName);

            ThisBeam = _TS.CutBeamByPart(ThisBeam, MainBeam, false);

            // стираем ThisBeam и MainBeam
            //          ThisBeam.Delete();
            //           MainBeam.Delete();
            //           Model.CommitChanges();

            // test 1: обрезаем балку ThisBeam пластиной Plate
            p1       = new Point(3000, 2000, 1000);
            p2       = new Point(5000, 1000, 0);
            ThisBeam = _TS.CreateBeam("ThisBeam", "I20B1_20_93", p1, p2);
            ContourPoint c1    = new ContourPoint(new Point(4000, 1000, 0), null);
            ContourPoint c2    = new ContourPoint(new Point(4000, 3000, 0), null);
            ContourPoint c3    = new ContourPoint(new Point(4000, 3000, 2000), null);
            ContourPoint c4    = new ContourPoint(new Point(4000, 1000, 2000), null);
            var          Plate = new ContourPlate();

            Plate.AddContourPoint(c1);
            Plate.AddContourPoint(c2);
            Plate.AddContourPoint(c3);
            Plate.AddContourPoint(c4);
            Plate.Profile.ProfileString   = "PL200";
            Plate.Material.MaterialString = "C245";
            Plate.Class = "2";
            Plate.Name  = "PLATE";
            Plate.Insert();
            Model.CommitChanges();

            ThisBeam = _TS.CutBeamByPart(ThisBeam, Plate, false);

            //         ThisBeam.Delete();
            Plate.Delete();
            Model.CommitChanges();
        }
Пример #15
0
        private void MallinnaLaatta()
        {
            ModelObjectSelector   mSelector = malli.GetModelObjectSelector();
            ModelObjectEnumerator enumer    = mSelector.GetAllObjects();

            for (int i = 0; i < enumer.GetSize(); i++)
            {
                ModelObject obj = enumer.Current;
                if (obj is ContourPlate)
                {
                    if (((ContourPlate)obj).Name == "LASKETTU_LAATTA")
                    {
                        ContourPlate laattaTemp = (ContourPlate)obj;
                        laattaTemp.Contour.ContourPoints[0] = new ContourPoint(new Point(0, 0, 3000), null);
                        laattaTemp.Contour.ContourPoints[1] = new ContourPoint(new Point(0, laatanKorkeus, 3000), null);
                        laattaTemp.Contour.ContourPoints[2] = new ContourPoint(new Point(laatanLeveys, laatanKorkeus, 3000), null);
                        laattaTemp.Contour.ContourPoints[3] = new ContourPoint(new Point(laatanLeveys, 0, 3000), null);
                        PoistaRaudoitus(laattaTemp);
                        laattaTemp.Modify();
                        malli.CommitChanges();
                        return;
                    }
                }
                enumer.MoveNext();
            }
            ContourPlate laatta = new ContourPlate();

            laatta.Name = "LASKETTU_LAATTA";
            ContourPoint vasenAlanurkka = new ContourPoint(new Point(0, 0, 3000), null);
            ContourPoint vasenYlanurkka = new ContourPoint(new Point(0, laatanKorkeus, 3000), null);
            ContourPoint oikeaYlanurkka = new ContourPoint(new Point(laatanLeveys, laatanKorkeus, 3000), null);
            ContourPoint oikeaAlanurkka = new ContourPoint(new Point(laatanLeveys, 0, 3000), null);

            laatta.AddContourPoint(vasenAlanurkka);
            laatta.AddContourPoint(vasenYlanurkka);
            laatta.AddContourPoint(oikeaYlanurkka);
            laatta.AddContourPoint(oikeaAlanurkka);

            laatta.Profile.ProfileString = Asetukset.LaatanPaksuus.ToString();
            if (!string.IsNullOrWhiteSpace(Asetukset.BetoninLujuus.ToString()))
            {
                laatta.Material.MaterialString = betonimateriaalit[Asetukset.BetoninLujuus];
            }
            else
            {
                laatta.Material.MaterialString = "Concrete_Undefined";
            }
            laatta.Position.Depth = Position.DepthEnum.FRONT;

            laatta.Insert();
            malli.CommitChanges();
        }
Пример #16
0
        public static void CreatingCuttingFCNR()
        {
            var model = new Model();

            if (model.GetConnectionStatus())
            {
                var startPoint = PickAPoint();

                var startPointPart = new Point(startPoint.X, startPoint.Y, startPoint.Z + 6);

                #region Create_Main_Plate
                const int widthMainPlate = 2000;
                var       mainPlate      = Plate.MainPlate(startPoint, 6000, widthMainPlate);
                mainPlate.Insert();

                #endregion

                #region Создание случайных пластин
                List <RandomlyPlate> plateList = new List <RandomlyPlate>();
                for (int i = 0; i < rnd.Next(99, 100); i++)
                {
                    plateList.Add(new RandomlyPlate(startPointPart, rnd));
                }

                var orderByPlateList = plateList.OrderByDescending(RandomlyPlate => RandomlyPlate.Width);

                var n = 1;
                foreach (var item in orderByPlateList)
                {
                    item.Number = n;
                    n++;
                }

                var sortOrderByPlateList = Helper.SortingFCNR(orderByPlateList, widthMainPlate);

                foreach (var item in sortOrderByPlateList)
                {
                    var plate = new ContourPlate();
                    foreach (var point in item.ContourPoints)
                    {
                        plate.AddContourPoint(new ContourPoint(point, null));
                    }
                    plate.Name = "Пластина";
                    plate.Profile.ProfileString   = "—6";
                    plate.Material.MaterialString = "С255";
                    plate.Class = $"{item.Number+1}";
                    plate.Insert();
                }
                #endregion
            }
            model.CommitChanges();
        }
Пример #17
0
        public static ContourPlate InsertPlate(Point A, Point B, Point C,
                                               string profileString, string materialString, Chamfer chamfer = null)
        {
            var cp = new ContourPlate();

            cp.AddContourPoint(A, chamfer);
            cp.AddContourPoint(B, chamfer);
            cp.AddContourPoint(C, chamfer);
            cp.Profile.ProfileString   = profileString;
            cp.Material.MaterialString = materialString;
            cp.Insert();
            return(cp);
        }
Пример #18
0
        public static ContourPlate InsertPlate(ArrayList points,
                                               string profileString, string materialString, Chamfer chamfer = null)
        {
            var cp = new ContourPlate();

            foreach (Point point in points)
            {
                cp.AddContourPoint(point, chamfer);
            }
            cp.Profile.ProfileString   = profileString;
            cp.Material.MaterialString = materialString;
            cp.Insert();
            return(cp);
        }
Пример #19
0
        static ContourPlate AddPlate(List <Point> points)
        {
            var contourPlate = new ContourPlate();

            foreach (var point in points)
            {
                var contourPoint = new ContourPoint(point, null);
                contourPlate.AddContourPoint(contourPoint);
            }
            contourPlate.Profile.ProfileString   = "PL100";
            contourPlate.Material.MaterialString = "A36";
            contourPlate.Insert();
            return(contourPlate);
        }
Пример #20
0
        static ContourPlate AddCutPlate(List <Point> points)
        {
            var cutPlate = new ContourPlate();

            foreach (var point in points)
            {
                var cutPoint = new ContourPoint(point, null);
                cutPlate.AddContourPoint(cutPoint);
            }
            cutPlate.Profile.ProfileString   = "PL100";
            cutPlate.Material.MaterialString = "A36";
            cutPlate.Class = BooleanPart.BooleanOperativeClassName;
            cutPlate.Insert();
            return(cutPlate);
        }
Пример #21
0
 private void GetContourPlateInfo(ContourPlate contourPlate)
 {
     modelObjectTextBox.Text = TSM.ModelObject.ModelObjectEnum.POLYBEAM.ToString() + Environment.NewLine +
                               "Name: " + contourPlate.Name + Environment.NewLine +
                               "Id: " + contourPlate.Identifier.ID.ToString() + Environment.NewLine +
                               "Material: " + contourPlate.Material.MaterialString + Environment.NewLine +
                               "Profile: " + contourPlate.Profile.ProfileString + Environment.NewLine +
                               "Contour points: " + contourPlate.Contour.ContourPoints.ToString() + Environment.NewLine +
                               "Class: " + contourPlate.Class + Environment.NewLine +
                               "Finish: " + contourPlate.Finish + Environment.NewLine +
                               "Position depth: " + contourPlate.Position.Depth.ToString() + Environment.NewLine +
                               "Position plane: " + contourPlate.Position.Plane.ToString() + Environment.NewLine +
                               "Position rotation: " + contourPlate.Position.Rotation.ToString() + Environment.NewLine +
                               "Father assembly: " + contourPlate.GetAssembly().Name.ToString();
 }
Пример #22
0
        public void ContourShow(Part plate)
        {
            setColor();
            if (plate.GetType() != typeof(ContourPlate))
            {
                TSerror("Wrong Part");
            }

            ContourPlate pl = plate as ContourPlate;
            int          i  = 0;

            foreach (var p in pl.Contour.ContourPoints)
            {
                PointShow((Point)p, "p" + (i++).ToString());
            }
        }
Пример #23
0
        public Form1()
        {
            InitializeComponent();

            this.bentPlate   = null;
            this.bottomPlate = null;
            this.sidePlate1  = null;
            this.sidePlate2  = null;
            this.sidePlate3  = null;
            this.sidePlate4  = null;
            this.model       = new Model();

            CreateContourPlates.Click             += CreateContourPlates_Click;
            CreateBends.Click                     += CreateBends_Click;
            CreateBoxUsingGeometry.Click          += CreateBoxUsingGeometry_Click;
            CreateBoxUsingGeometryAndRadius.Click += CreateBoxUsingGeometryAndRadius_Click;
        }
Пример #24
0
        private void CreatPlate(TSG.Point a, TSG.Point b, TSG.Point c, TSG.Point d, int thick)
        {
            ContourPlate curPlate = new ContourPlate();

            Profile pf = new Profile();

            pf.ProfileString = string.Format("PL{0}", thick);
            var contor = new Contour();

            contor.AddContourPoint(new ContourPoint(a, null));
            contor.AddContourPoint(new ContourPoint(b, null));
            contor.AddContourPoint(new ContourPoint(c, null));
            contor.AddContourPoint(new ContourPoint(d, null));

            curPlate.Contour = contor;
            curPlate.Profile = pf;
            curPlate.Insert();
        }
Пример #25
0
        /// <summary>
        /// Создание прямоугольной пластины
        /// </summary>
        /// <param name="startPoint"></param>
        /// <param name="length"></param>
        /// <param name="width"></param>
        /// <returns></returns>
        public static ContourPlate MainPlate(Point startPoint, double length, double width)
        {
            var contourPoint1 = new ContourPoint(startPoint, null);
            var contourPoint2 = new ContourPoint(new Point(startPoint.X + length, startPoint.Y, startPoint.Z), null);
            var contourPoint3 = new ContourPoint(new Point(startPoint.X + length, startPoint.Y + width, startPoint.Z), null);
            var contourPoint4 = new ContourPoint(new Point(startPoint.X, startPoint.Y + width, startPoint.Z), null);

            var plate = new ContourPlate();

            plate.Name = "Главная пластина";
            plate.Profile.ProfileString   = "—6";
            plate.Material.MaterialString = "С255";
            plate.Class = "1";
            plate.AddContourPoint(contourPoint1);
            plate.AddContourPoint(contourPoint2);
            plate.AddContourPoint(contourPoint3);
            plate.AddContourPoint(contourPoint4);
            return(plate);
        }
Пример #26
0
        public void MallinnaRaudoitukset()
        {
            ContourPlate laatta = (ContourPlate)HaeLaattaMallista();

            if (laatta == null)
            {
                System.Windows.Forms.MessageBox.Show("Laatan raudoitus epäonnistui");
                return;
            }

            PoistaRaudoitus(laatta);
            MallinnaKenttaraudoitusVerkot(laatta);
            try {
                MallinnaTukiraudoitukset(laatta);
            } catch (Exception ex) {
                Tiedostonkasittelija tKasittelija = new Tiedostonkasittelija(Paaikkuna.HAKEMISTO);
                tKasittelija.KirjoitaLokiin(ex.Message + "\n" + ex.StackTrace);
            }
        }
        private List <Part> CreateContours(JsPart[] sectionContours)
        {
            var contours = new List <Part>();

            if (null == sectionContours)
            {
                return(contours);
            }

            Chamfer stub = null;

            foreach (var contourDef in sectionContours)
            {
                var    plate            = new ContourPlate();
                string sysProfileString = null;
                ProfileConversion.ConvertFromCurrentUnits(contourDef.profile, ref sysProfileString);
                plate.Profile.ProfileString   = sysProfileString;
                plate.Material.MaterialString = contourDef.material;
                plate.Class                      = BooleanPart.BooleanOperativeClassName;
                plate.Name                       = "CUTPART";
                plate.PartNumber.Prefix          = "0";
                plate.PartNumber.StartNumber     = 0;
                plate.AssemblyNumber.Prefix      = " ";
                plate.AssemblyNumber.StartNumber = 0;

                plate.Position.Depth       = Position.DepthEnum.MIDDLE;
                plate.Position.Plane       = Position.PlaneEnum.MIDDLE;
                plate.Position.PlaneOffset = 0;
                if (null != contourDef.rotation)
                {
                    plate.Position.Rotation = EnumConverter.TryFromInt((int)contourDef.rotation, Position.RotationEnum.FRONT);
                }
                plate.Position.RotationOffset = 0.0;
                plate.Contour = new Contour()
                {
                    ContourPoints = new ArrayList(contourDef.points.Select(jp => new ContourPoint(jp.ToTS(), null)).ToArray())
                };
                contours.Add(plate);
            }
            Tracer._trace($"Created {contours.Count} cut contours");
            return(contours);
        }
        private Part DrawDownFloor(Point input, Vector alongStairVect, double width, double overlap, string floorProfile, string floorMaterial)
        {
            double ang            = stair.Ang;
            double height         = stair.StartPoint.Z - stair.EndPoint.Z;
            Vector zaxis          = new Vector(0, 0, -1);
            Vector shortEdge      = Vector.Cross(zaxis, alongStairVect);
            Vector shortEdgeLeft  = shortEdge * ((width + 2 * overlap) / 2);
            Vector shortEdgeRight = shortEdgeLeft * (-1);

            double stairLength     = height / Math.Tan(ang * Math.PI / 180);
            Vector longStairVect   = alongStairVect * stairLength;
            Vector heightStairVect = zaxis * height;

            Point hEndPoint  = new Point(input.X + heightStairVect.X, input.Y + heightStairVect.Y, input.Z + heightStairVect.Z);
            Point stairEndPt = new Point(hEndPoint.X + longStairVect.X, hEndPoint.Y + longStairVect.Y, hEndPoint.Z + longStairVect.Z);

            Vector longEdge = new Vector(stair.EndPoint.X - stairEndPt.X, stair.EndPoint.Y - stairEndPt.Y, stair.EndPoint.Z - stairEndPt.Z);

            Point leftNearCornerPt  = new Point(stairEndPt.X + shortEdgeLeft.X, stairEndPt.Y + shortEdgeLeft.Y, stairEndPt.Z + shortEdgeLeft.Z);
            Point rightNearCornerPt = new Point(stairEndPt.X + shortEdgeRight.X, stairEndPt.Y + shortEdgeRight.Y, stairEndPt.Z + shortEdgeRight.Z);
            Point leftFarCornerPt   = new Point(leftNearCornerPt.X + longEdge.X, leftNearCornerPt.Y + longEdge.Y, leftNearCornerPt.Z + longEdge.Z);
            Point rightFarCornerPt  = new Point(rightNearCornerPt.X + longEdge.X, rightNearCornerPt.Y + longEdge.Y, rightNearCornerPt.Z + longEdge.Z);

            ContourPoint leftCpStartPt  = new ContourPoint(leftNearCornerPt, null);
            ContourPoint leftCpEndPt    = new ContourPoint(leftFarCornerPt, null);
            ContourPoint rightCpStartPt = new ContourPoint(rightNearCornerPt, null);
            ContourPoint rightCpEndPt   = new ContourPoint(rightFarCornerPt, null);

            ContourPlate floorBeam = new ContourPlate();

            floorBeam.AddContourPoint(leftCpStartPt);
            floorBeam.AddContourPoint(leftCpEndPt);
            floorBeam.AddContourPoint(rightCpEndPt);
            floorBeam.AddContourPoint(rightCpStartPt);
            floorBeam.Profile.ProfileString   = floorProfile;
            floorBeam.Material.MaterialString = floorMaterial;
            floorBeam.Position.Depth          = Position.DepthEnum.FRONT;

            floorBeam.Insert();

            return(floorBeam);
        }
Пример #29
0
        private void CreateSamplePlates()
        {
            var contour1 = new Contour();

            contour1.AddContourPoint(new ContourPoint(new Point(0, 0, 0), null));
            contour1.AddContourPoint(new ContourPoint(new Point(3000.0, 0, 0), null));
            contour1.AddContourPoint(new ContourPoint(new Point(3000.0, 3000.0, 0), null));
            contour1.AddContourPoint(new ContourPoint(new Point(0, 3000.0, 0), null));

            samplePlate1 = new ContourPlate
            {
                Name     = "Plate",
                Material = { MaterialString = "S235JR" },
                Profile  = { ProfileString = "PL20" },
                Position = { Depth = Position.DepthEnum.MIDDLE, DepthOffset = 0 }
            };

            samplePlate1.Contour = contour1;
            samplePlate1.Insert();

            var contour2 = new Contour();

            contour2.AddContourPoint(new ContourPoint(new Point(0, 6000.0, 1500.0), null));
            contour2.AddContourPoint(new ContourPoint(new Point(3000.0, 6000.0, 1500.0), null));
            contour2.AddContourPoint(new ContourPoint(new Point(3000.0, 6000.0, 4500.0), null));
            contour2.AddContourPoint(new ContourPoint(new Point(0, 6000.0, 4500.0), null));

            samplePlate2 = new ContourPlate
            {
                Name     = "Plate",
                Material = { MaterialString = "S235JR" },
                Profile  = { ProfileString = "PL20" },
                Position = { Depth = Position.DepthEnum.MIDDLE, DepthOffset = 0 }
            };

            samplePlate2.Contour = contour2;
            samplePlate2.Insert();

            model.CommitChanges();
        }
Пример #30
0
        /// <summary>
        /// Adds the cut for the wallshoe components
        /// </summary>
        /// <param name="variables">List of doubles with dimensions of the component</param>
        /// <param name="p1">The point which gives the x position of the component on fatherpart</param>
        /// <param name="minY">Fatherparts solids miminum Y position</param>
        /// <param name="maxY">Fatherparts solids miminum Y position</param>
        /// <param name="changeDirection">Boolean to give the direction</param>
        /// <param name="fatherpart">Part to insert the cut to</param>
        private bool AddWallShoeCut(double[] variables, Point p1, double minY, double maxY, bool changeDirection, Part fatherpart)
        {
            try {
                ContourPlate cutpart = new ContourPlate();
                BooleanPart  bPart   = new BooleanPart();
                cutpart.Name                    = "Leikkaus";
                cutpart.Position.Depth          = Position.DepthEnum.MIDDLE;
                cutpart.Position.Plane          = Position.PlaneEnum.MIDDLE;
                cutpart.Class                   = BooleanPart.BooleanOperativeClassName;
                cutpart.Material.MaterialString = "Reikä";
                cutpart.Profile.ProfileString   = "PL135";
                cutpart.Profile.ProfileString   = "PL" + variables[4];
                if (!changeDirection)
                {
                    cutpart.AddContourPoint(new ContourPoint(new Point(p1.X, p1.Y - variables[0], p1.Z + variables[1]), null));
                    cutpart.AddContourPoint(new ContourPoint(new Point(p1.X, p1.Y - variables[0], p1.Z + variables[1] + variables[2]), null));
                    cutpart.AddContourPoint(new ContourPoint(new Point(p1.X, maxY, p1.Z + variables[1] + variables[2] + (Math.Tan(variables[3] * Math.PI / 180) * ((maxY - minY) / 2 + variables[0]))), null));
                }
                else
                {
                    cutpart.AddContourPoint(new ContourPoint(new Point(p1.X, p1.Y + variables[0], p1.Z + variables[1]), null));
                    cutpart.AddContourPoint(new ContourPoint(new Point(p1.X, p1.Y + variables[0], p1.Z + variables[1] + variables[2]), null));
                    cutpart.AddContourPoint(new ContourPoint(new Point(p1.X, maxY, p1.Z + variables[1] + variables[2] + (Math.Tan(variables[3] * Math.PI / 180) * ((minY - maxY) / 2 + variables[0]))), null));
                }
                cutpart.AddContourPoint(new ContourPoint(new Point(p1.X, maxY, p1.Z + variables[1]), null));
                cutpart.Insert();
                bPart.Father = fatherpart;
                bPart.SetOperativePart(cutpart);
                if (!bPart.Insert())
                {
                    WriteLog("Leikkauksen (1) tekeminen epäonnistui!");
                }
                cutpart.Delete();
            } catch (Exception ex) {
                WriteLog(ex.Message + "\n" + ex.StackTrace);
                return(false);
            }

            return(true);
        }