private void WeldFloor(Part mainPart, Part secondPart)
        {
            Weld weld = new Weld();

            weld.MainObject        = mainPart;
            weld.SecondaryObject   = secondPart;
            weld.ConnectAssemblies = false;
            weld.ShopWeld          = true;
            weld.AroundWeld        = true;
            weld.TypeAbove         = BaseWeld.WeldTypeEnum.WELD_TYPE_FILLET;
            weld.Insert();
        }
示例#2
0
    public Weld insert_weld(Part Main_part, Part Secandary_part)
    {
        Weld weld = new Weld();

        weld.MainObject      = (ModelObject)Main_part;
        weld.SecondaryObject = (ModelObject)Secandary_part;
        weld.SizeAbove       = this.data.weld_aboveline;
        weld.TypeAbove       = BaseWeld.WeldTypeEnum.WELD_TYPE_FILLET;
        weld.SizeBelow       = this.data.weld_aboveline;
        weld.TypeBelow       = BaseWeld.WeldTypeEnum.WELD_TYPE_FILLET;
        weld.ShopWeld        = true;
        weld.AroundWeld      = false;
        CoordinateSystem coordinateSystem = Secandary_part.GetCoordinateSystem();

        weld.Direction = coordinateSystem.AxisY;
        weld.Insert();
        return(weld);
    }
示例#3
0
        private void btn_Weld_Click(object sender, EventArgs e)
        {
            TSMUI.Picker thisPicker       = new TSMUI.Picker();
            Part         firstPickedPart  = null;
            Part         secondPickedPart = null;

            try
            {
                firstPickedPart  = thisPicker.PickObject(TSMUI.Picker.PickObjectEnum.PICK_ONE_PART) as Part;
                secondPickedPart = thisPicker.PickObject(TSMUI.Picker.PickObjectEnum.PICK_ONE_PART) as Part;
            }
            catch
            {
                firstPickedPart  = null;
                secondPickedPart = null;
            }

            if (firstPickedPart != null && secondPickedPart != null)
            {
                Weld newWeld = new Weld();
                newWeld.MainObject      = firstPickedPart;
                newWeld.SecondaryObject = secondPickedPart;
                newWeld.SizeBelow       = 6.35;
                newWeld.TypeBelow       = BaseWeld.WeldTypeEnum.WELD_TYPE_FILLET;
                newWeld.SizeAbove       = 0.0;
                newWeld.TypeAbove       = BaseWeld.WeldTypeEnum.WELD_TYPE_NONE;
                newWeld.AroundWeld      = false;
                newWeld.ShopWeld        = true;
                newWeld.ReferenceText   = "Typ.";
                newWeld.Placement       = BaseWeld.WeldPlacementTypeEnum.PLACEMENT_AUTO;

                if (newWeld.Insert())
                {
                    // Show the weld in the model but the user will never see the workplane chage
                    currentModel.CommitChanges();
                }
                else
                {
                    Tekla.Structures.Model.Operations.Operation.DisplayPrompt("Weld  was not created");
                }
            }
        }
示例#4
0
        private void CreatePadFootings(object sender, EventArgs e)
        {
            // Always remember to check that you really have working connection
            if (MyModel.GetConnectionStatus())
            {
                double wsp3 = int.Parse(textBox1.Text);
                double wsp4 = double.Parse(textBox2.Text);

                Picker piku = new Picker();

                //askjdhygausgfdyzjusrgfafsa
                ArrayList info = new ArrayList();
                info = new ArrayList {
                    "END_X", "END_Y", "END_Z", "START_X", "START_Y", "START_Z"
                };
                ArrayList info2 = new ArrayList();
                info2 = new ArrayList {
                    "END_X", "END_Y", "END_Z", "START_X", "START_Y", "START_Z"
                };
                ModelObject part  = new Beam();
                ModelObject part2 = new Beam();
                Hashtable   p1    = new Hashtable();
                Hashtable   p2    = new Hashtable();

                part = piku.PickObject(Picker.PickObjectEnum.PICK_ONE_PART);
                part.GetDoubleReportProperties(info, ref p1);
                part2 = piku.PickObject(Picker.PickObjectEnum.PICK_ONE_PART);
                part2.GetDoubleReportProperties(info2, ref p2);
                Point st1 = new Point();
                Point st2 = new Point();
                st1 = piku.PickPoint();
                st2 = piku.PickPoint();
                Point st3 = new Point(st1);
                Point st4 = new Point(st2);

                //wektory belek
                Vector v1 = new Vector((Convert.ToDouble(p1["START_X"]) - Convert.ToDouble(p1["END_X"])) / 10000, (Convert.ToDouble(p1["START_Y"]) - Convert.ToDouble(p1["END_Y"])) / 10000, (Convert.ToDouble(p1["START_Z"]) - Convert.ToDouble(p1["END_Z"])) / 10000);
                Vector v2 = new Vector((Convert.ToDouble(p2["START_X"]) - Convert.ToDouble(p2["END_X"])) / 10000, (Convert.ToDouble(p2["START_Y"]) - Convert.ToDouble(p2["END_Y"])) / 10000, (Convert.ToDouble(p2["START_Z"]) - Convert.ToDouble(p2["END_Z"])) / 10000);
                double v1d = v1.GetLength(); double ile1 = 30 / v1d;
                double v2d = v2.GetLength(); double ile2 = 30 / v2d;
                double v1dd = v1.GetLength(); double ile3 = wsp4 / v1d;
                double v2dd = v2.GetLength(); double ile4 = wsp4 / v2d;

                st3.Translate((-v1.X) * ile3, (-v1.Y) * ile3, (-v1.Z) * ile3);
                st1.Translate((v1.X) * ile1, (v1.Y) * ile1, (v1.Z) * ile1);
                st4.Translate((-v2.X) * ile2, (-v2.Y) * ile2, (-v2.Z) * ile2);
                st2.Translate((v2.X) * ile4, (v2.Y) * ile4, (v2.Z) * ile4);

                Contour      testowy = new Contour();
                ContourPoint point1  = new ContourPoint(st1, null);
                ContourPoint point2  = new ContourPoint(st3, new Chamfer(45, 0, Chamfer.ChamferTypeEnum.CHAMFER_ROUNDING));
                ContourPoint point3  = new ContourPoint(st4, null);
                testowy.AddContourPoint(point1);
                testowy.AddContourPoint(point2);
                testowy.AddContourPoint(point3);

                Contour      testowy3 = new Contour();
                ContourPoint point10  = new ContourPoint(st4, null);
                ContourPoint point20  = new ContourPoint(st2, new Chamfer(45, 0, Chamfer.ChamferTypeEnum.CHAMFER_ROUNDING));
                ContourPoint point30  = new ContourPoint(st3, null);
                testowy3.AddContourPoint(point10);
                testowy3.AddContourPoint(point20);
                testowy3.AddContourPoint(point30);

                bool strona = radioButton1.Checked;

                ModelObject nb  = CreateBlacha(testowy, strona);
                ModelObject nb3 = CreateBlacha(testowy3, strona);
                nb.Insert();
                nb3.Insert();

                double l1 = 0.0;
                nb.GetReportProperty("LENGTH", ref l1);


                double l2 = 0.0;
                nb3.GetReportProperty("LENGTH", ref l2);

                nb.Delete();
                nb3.Delete();



                Contour testowy2 = new Contour();
                testowy2.AddContourPoint(point1);
                testowy2.AddContourPoint(point2);
                Point        point4v = new Point(dlugosc(point2, point3, l1));
                ContourPoint point4  = new ContourPoint(point4v, null);
                testowy2.AddContourPoint(point4);
                ModelObject nb2 = CreateBlacha(testowy2, strona);

                Contour testowy4 = new Contour();
                testowy4.AddContourPoint(point10);
                testowy4.AddContourPoint(point20);
                Point        point40v = new Point(dlugosc(point20, point30, l2));
                ContourPoint point40  = new ContourPoint(point40v, null);
                testowy4.AddContourPoint(point40);
                ModelObject nb4 = CreateBlacha(testowy4, strona);


                nb2.Insert();
                BoltArray b2 = sruby(point1, point2, nb2 as Part);
                b2.PartToBoltTo = part as Part;
                b2.BoltSize     = Convert.ToDouble(comboBox3.Text);
                b2.BoltStandard = comboBox2.Text;
                b2.Insert();
                nb4.Insert();
                BoltArray b4 = sruby(point10, point20, nb4 as Part);
                b4.BoltSize     = Convert.ToDouble(comboBox3.Text);
                b4.BoltStandard = comboBox2.Text;
                b4.PartToBoltTo = part2 as Part;
                b4.Insert();

                Point point4st  = new Point(dlugosc(point40, point4, 130));
                Point point40st = new Point(dlugosc(point4, point40, 130));

                Point pointsplit = new Point(dlugosc(point4st, point40st, wsp3 + 180));

                if (comboBox1.Text == "D16")
                {
                    Beam st16 = CreateStezenie16(point4st, point40st, strona);
                    st16.Insert();
                    Weld w  = new Weld();
                    Weld w2 = new Weld();
                    w.MainObject      = st16;
                    w.SecondaryObject = nb2;
                    w.ShopWeld        = true;
                    w.Insert();
                    w2.MainObject      = st16;
                    w2.SecondaryObject = nb4;
                    w2.ShopWeld        = true;
                    w2.Insert();
                    Beam       st161 = Operation.Split(st16, pointsplit);
                    Connection sr    = new Connection();
                    sr.Name   = "Po³¹czenie œrub¹ rzymsk¹";
                    sr.Number = 126;
                    sr.LoadAttributesFromFile("82269_M16");
                    sr.SetPrimaryObject(st161);
                    sr.SetSecondaryObject(st16);
                    sr.Insert();
                }
                if (comboBox1.Text == "D20")
                {
                    Beam st16 = CreateStezenie20(point4st, point40st, strona);
                    st16.Insert();
                    Weld w  = new Weld();
                    Weld w2 = new Weld();
                    w.MainObject      = st16;
                    w.SecondaryObject = nb2;
                    w.ShopWeld        = true;
                    w.Insert();
                    w2.MainObject      = st16;
                    w2.SecondaryObject = nb4;
                    w2.ShopWeld        = true;
                    w2.Insert();
                    Beam       st161 = Operation.Split(st16, pointsplit);
                    Connection sr    = new Connection();
                    sr.Name   = "Po³¹czenie œrub¹ rzymsk¹";
                    sr.Number = 126;
                    sr.LoadAttributesFromFile("82269_M20");
                    sr.SetPrimaryObject(st161);
                    sr.SetSecondaryObject(st16);
                    sr.Insert();
                }
                if (comboBox1.Text == "D12")
                {
                    Beam st16 = CreateStezenie12(point4st, point40st, strona);
                    st16.Insert();
                    Weld w  = new Weld();
                    Weld w2 = new Weld();
                    w.MainObject      = st16;
                    w.SecondaryObject = nb2;
                    w.ShopWeld        = true;
                    w.Insert();
                    w2.MainObject      = st16;
                    w2.SecondaryObject = nb4;
                    w2.ShopWeld        = true;
                    w2.Insert();
                    Beam       st161 = Operation.Split(st16, pointsplit);
                    Connection sr    = new Connection();
                    sr.Name   = "Po³¹czenie œrub¹ rzymsk¹";
                    sr.Number = 126;
                    sr.LoadAttributesFromFile("82269_M12");
                    sr.SetPrimaryObject(st161);
                    sr.SetSecondaryObject(st16);
                    sr.Insert();
                }
            }
            MyModel.CommitChanges();
        }
        public void Create()
        {
            Point  Point1              = StartPoint;
            Point  Point2              = EndPoint;
            Vector mainVector          = new Vector(Point2.X - Point1.X, Point2.Y - Point1.Y, Point2.Z - Point1.Z);
            Vector zaxis               = new Vector(0, 0, -1);
            double height              = Point1.Z - Point2.Z;
            Vector heightStair         = zaxis * height;
            Point  heightStairEndPt    = new Point(Point1.X + heightStair.X, Point1.Y + heightStair.Y, Point1.Z + heightStair.Z);
            Vector subMainVector       = new Vector(Point2.X - heightStairEndPt.X, Point2.Y - heightStairEndPt.Y, Point2.Z - heightStairEndPt.Z);
            double stairLength         = height / Math.Tan(Ang * Math.PI / 180);
            Vector normallengthStair   = subMainVector.GetNormal();
            Vector lengthStair         = normallengthStair * stairLength;
            Point  lengthStairEndPoint = new Point(heightStairEndPt.X + lengthStair.X, heightStairEndPt.Y + lengthStair.Y, heightStairEndPt.Z + lengthStair.Z);
            Vector mainStairVector     = new Vector(lengthStairEndPoint.X - Point1.X, lengthStairEndPoint.Y - Point1.Y, lengthStairEndPoint.Z - Point1.Z);

            Vector leftOffsetVector       = Vector.Cross(heightStair, mainVector);
            Vector normalOffsetBeamVector = leftOffsetVector.GetNormal();

            leftOffsetVector = normalOffsetBeamVector * (Width / 2);
            Vector horizontalVector = normallengthStair * (-1);
            //   Vector horizontalVectorLength = horizontalVector * lengthStartSegment;
            Point leftBeamStartPt = new Point(Point1.X + leftOffsetVector.X, Point1.Y + leftOffsetVector.Y, Point1.Z + leftOffsetVector.Z);
            Point leftBeamEndPt   = new Point(lengthStairEndPoint.X + leftOffsetVector.X, lengthStairEndPoint.Y + leftOffsetVector.Y, lengthStairEndPoint.Z + leftOffsetVector.Z);
            // offset for fixture beam corner
            Vector offsetAlongStairVector = normallengthStair * 15;

            leftBeamStartPt = new Point(leftBeamStartPt.X + offsetAlongStairVector.X, leftBeamStartPt.Y + offsetAlongStairVector.Y, leftBeamStartPt.Z + offsetAlongStairVector.Z);
            leftBeamEndPt   = new Point(leftBeamEndPt.X + offsetAlongStairVector.X, leftBeamEndPt.Y + offsetAlongStairVector.Y, leftBeamEndPt.Z + offsetAlongStairVector.Z);

            Vector rightOffsetVector = leftOffsetVector * (-1);
            Point  rightBeamStartPt  = new Point(Point1.X + rightOffsetVector.X, Point1.Y + rightOffsetVector.Y, Point1.Z + rightOffsetVector.Z);
            Point  rightBeamEndPt    = new Point(lengthStairEndPoint.X + rightOffsetVector.X, lengthStairEndPoint.Y + rightOffsetVector.Y, lengthStairEndPoint.Z + rightOffsetVector.Z);

            // offset for fixture beam corner
            rightBeamStartPt = new Point(rightBeamStartPt.X + offsetAlongStairVector.X, rightBeamStartPt.Y + offsetAlongStairVector.Y, rightBeamStartPt.Z + offsetAlongStairVector.Z);
            rightBeamEndPt   = new Point(rightBeamEndPt.X + offsetAlongStairVector.X, rightBeamEndPt.Y + offsetAlongStairVector.Y, rightBeamEndPt.Z + offsetAlongStairVector.Z);

            TSM.Beam rightBeam = new TSM.Beam(leftBeamStartPt, leftBeamEndPt);
            rightBeam.Class                   = "11";
            rightBeam.Position.Plane          = TSM.Position.PlaneEnum.RIGHT;
            rightBeam.Position.Depth          = Position.DepthEnum.BEHIND;
            rightBeam.Position.Rotation       = TSM.Position.RotationEnum.TOP;
            rightBeam.Profile.ProfileString   = Profile;
            rightBeam.Material.MaterialString = Material;
            rightBeam.Finish                  = "PAINT";
            rightBeam.Insert();

            MainStringer = rightBeam;
            //   TSM.Operations.Operation.DisplayPrompt($"Высота профиля: {hprofile}");

            TSM.Beam leftBeam = new TSM.Beam(rightBeamStartPt, rightBeamEndPt);
            leftBeam.Class                   = "11";
            leftBeam.Position.Plane          = TSM.Position.PlaneEnum.LEFT;
            leftBeam.Position.Depth          = Position.DepthEnum.BEHIND;
            leftBeam.Position.Rotation       = TSM.Position.RotationEnum.BELOW;
            leftBeam.Profile.ProfileString   = Profile;
            leftBeam.Material.MaterialString = Material;
            leftBeam.Finish                  = "PAINT";
            leftBeam.Insert();

            SecondStringer = leftBeam;
            // fitting kosours

            Vector xaxis = normallengthStair;
            Vector yaxis = normalOffsetBeamVector;

            CuttingBeam(rightBeam, leftBeamStartPt, zaxis, yaxis);
            CuttingBeam(rightBeam, leftBeamEndPt, xaxis, yaxis);
            CuttingBeam(leftBeam, rightBeamStartPt, zaxis, yaxis);
            CuttingBeam(leftBeam, rightBeamEndPt, xaxis, yaxis);

            // add beam corner
            Vector offsetLeftStartCrossStairVector = normalOffsetBeamVector * ((Width / 2) - 20) * (-1);
            Vector offsetLeftEndCrossStairVector   = normalOffsetBeamVector * (100) * (-1);
            Vector offsetOrtVector          = zaxis * (-1) * 5;
            Point  offsetOrtPoint           = new Point(Point1.X + offsetOrtVector.X, Point1.Y + offsetOrtVector.Y, Point1.Z + offsetOrtVector.Z);
            Point  offsetCrossPoint         = new Point(offsetOrtPoint.X + offsetLeftStartCrossStairVector.X, offsetOrtPoint.Y + offsetLeftStartCrossStairVector.Y, offsetOrtPoint.Z + offsetLeftStartCrossStairVector.Z);
            Point  startLeftBeamCornerPoint = new Point(offsetCrossPoint.X + offsetAlongStairVector.X, offsetCrossPoint.Y + offsetAlongStairVector.Y, offsetCrossPoint.Z + offsetAlongStairVector.Z);
            Point  endLeftBeamCornerPoint   = new Point(startLeftBeamCornerPoint.X + offsetLeftEndCrossStairVector.X, startLeftBeamCornerPoint.Y + offsetLeftEndCrossStairVector.Y, startLeftBeamCornerPoint.Z + offsetLeftEndCrossStairVector.Z);

            TSM.Beam leftBeamCorner = new TSM.Beam(startLeftBeamCornerPoint, endLeftBeamCornerPoint);

            leftBeamCorner.Class                 = "8";
            leftBeamCorner.Position.Plane        = TSM.Position.PlaneEnum.LEFT;     // LEFT
            leftBeamCorner.Position.Depth        = Position.DepthEnum.BEHIND;
            leftBeamCorner.Position.Rotation     = TSM.Position.RotationEnum.BELOW; // BELOW
            leftBeamCorner.Profile.ProfileString = "L63X5_8509_93";
            leftBeamCorner.Finish                = "PAINT";
            leftBeamCorner.Insert();

            Vector offsetRightStartCrossStairVector = normalOffsetBeamVector * ((Width / 2) - 20);
            Vector offsetRightEndCrossStairVector   = normalOffsetBeamVector * (100);

            offsetCrossPoint = new Point(offsetOrtPoint.X + offsetRightStartCrossStairVector.X, offsetOrtPoint.Y + offsetRightStartCrossStairVector.Y, offsetOrtPoint.Z + offsetRightStartCrossStairVector.Z);
            Point startRightBeamCornerPoint = new Point(offsetCrossPoint.X + offsetAlongStairVector.X, offsetCrossPoint.Y + offsetAlongStairVector.Y, offsetCrossPoint.Z + offsetAlongStairVector.Z);
            Point endRightBeamCornerPoint   = new Point(startRightBeamCornerPoint.X + offsetRightEndCrossStairVector.X, startRightBeamCornerPoint.Y + offsetRightEndCrossStairVector.Y, startRightBeamCornerPoint.Z + offsetRightEndCrossStairVector.Z);

            TSM.Beam rightBeamCorner = new TSM.Beam(startRightBeamCornerPoint, endRightBeamCornerPoint);

            rightBeamCorner.Class                 = "8";
            rightBeamCorner.Position.Plane        = TSM.Position.PlaneEnum.RIGHT;   // LEFT
            rightBeamCorner.Position.Depth        = Position.DepthEnum.BEHIND;
            rightBeamCorner.Position.Rotation     = TSM.Position.RotationEnum.BACK; // BELOW
            rightBeamCorner.Profile.ProfileString = "L63X5_8509_93";
            rightBeamCorner.Finish                = "PAINT";
            rightBeamCorner.Insert();

            // calculate offsets

            //   var hprofile = GetHeightBeam(rightBeam, leftBeamStartPt);
            double hprofile = 0;

            rightBeam.GetReportProperty("HEIGHT", ref hprofile);
            var hoffset = hprofile / Math.Cos(Ang * Math.PI / 180);

            Vector hOrtVect = zaxis * hoffset;

            StartStepsPoint = new Point(Point1.X + offsetAlongStairVector.X, Point1.Y + offsetAlongStairVector.Y, Point1.Z + offsetAlongStairVector.Z);
            StairVector     = normallengthStair;
            // Height = height - hprofile;

            Weld rightWeldStringer = new Weld();

            rightWeldStringer.MainObject        = rightBeam;
            rightWeldStringer.SecondaryObject   = rightBeamCorner;
            rightWeldStringer.ConnectAssemblies = false;
            rightWeldStringer.ShopWeld          = true;
            rightWeldStringer.AroundWeld        = false;
            rightWeldStringer.TypeAbove         = PolygonWeld.WeldTypeEnum.WELD_TYPE_FILLET;
            rightWeldStringer.TypeBelow         = PolygonWeld.WeldTypeEnum.WELD_TYPE_FILLET;
            rightWeldStringer.SizeAbove         = -100;
            rightWeldStringer.SizeBelow         = -100;
            rightWeldStringer.Insert();

            Weld leftWeldStringer = new Weld();

            leftWeldStringer.MainObject        = leftBeam;
            leftWeldStringer.SecondaryObject   = leftBeamCorner;
            leftWeldStringer.ConnectAssemblies = false;
            leftWeldStringer.ShopWeld          = true;
            leftWeldStringer.AroundWeld        = false;
            leftWeldStringer.TypeAbove         = PolygonWeld.WeldTypeEnum.WELD_TYPE_FILLET;
            leftWeldStringer.TypeBelow         = PolygonWeld.WeldTypeEnum.WELD_TYPE_FILLET;
            leftWeldStringer.SizeAbove         = -100;
            leftWeldStringer.SizeBelow         = -100;
            leftWeldStringer.Insert();
        }
示例#6
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (MyModel.GetConnectionStatus())
            {
                double off1 = Convert.ToDouble(textBox4.Text);
                double off2 = Convert.ToDouble(textBox5.Text);
                TransformationPlane currentPlane = MyModel.GetWorkPlaneHandler().GetCurrentTransformationPlane();
                Picker piku = new Picker();

                ArrayList info = new ArrayList();
                info = new ArrayList {
                    "END_X", "END_Y", "END_Z", "START_X", "START_Y", "START_Z"
                };
                ArrayList info2 = new ArrayList();
                info2 = new ArrayList {
                    "END_X", "END_Y", "END_Z", "START_X", "START_Y", "START_Z"
                };
                ModelObject part  = new Beam();
                ModelObject part2 = new Beam();
                Hashtable   p1    = new Hashtable();
                Hashtable   p2    = new Hashtable();
                part = piku.PickObject(Picker.PickObjectEnum.PICK_ONE_PART);
                part.GetDoubleReportProperties(info, ref p1);
                double rotpart = (part as Part).Position.RotationOffset;
                part2 = piku.PickObject(Picker.PickObjectEnum.PICK_ONE_PART);
                part2.GetDoubleReportProperties(info2, ref p2);
                double rotpart2 = (part2 as Part).Position.RotationOffset;


                Point st1 = new Point(Convert.ToDouble(p1["START_X"]), Convert.ToDouble(p1["START_Y"]), Convert.ToDouble(p1["START_Z"]));
                Point st2 = new Point(Convert.ToDouble(p2["END_X"]), Convert.ToDouble(p2["END_Y"]), Convert.ToDouble(p2["END_Z"]));
                Point st3 = new Point(Convert.ToDouble(p1["END_X"]), Convert.ToDouble(p1["END_Y"]), Convert.ToDouble(p1["END_Z"]));
                Point st4 = new Point(Convert.ToDouble(p2["START_X"]), Convert.ToDouble(p2["START_Y"]), Convert.ToDouble(p2["START_Z"]));

                LineSegment l1 = new LineSegment(st1, st2);
                LineSegment l3 = new LineSegment(st1, st3); Vector vl3 = l3.GetDirectionVector(); vl3.Normalize();
                LineSegment l4 = new LineSegment(st2, st1);
                LineSegment l5 = new LineSegment(st2, st4); Vector vl5 = l5.GetDirectionVector(); vl5.Normalize();

                st1.Translate(vl3.X * (off1 / vl3.GetLength()), vl3.Y * (off1 / vl3.GetLength()), vl3.Z * (off1 / vl3.GetLength()));
                st2.Translate(vl5.X * (off2 / vl5.GetLength()), vl5.Y * (off2 / vl5.GetLength()), vl5.Z * (off2 / vl5.GetLength()));


                ControlLine cl1 = new ControlLine(l1, true);
                cl1.Color = ControlLine.ControlLineColorEnum.YELLOW_RED;

                //cl1.Insert();

                CoordinateSystem cs1 = new CoordinateSystem();
                cs1 = part.GetCoordinateSystem();
                CoordinateSystem cs2 = new CoordinateSystem();
                cs2 = part2.GetCoordinateSystem();

                Tekla.Structures.Model.Plane pl1 = new Tekla.Structures.Model.Plane();
                pl1.AxisX  = cs1.AxisX;
                pl1.AxisY  = cs1.AxisY;
                pl1.Origin = cs1.Origin;

                Tekla.Structures.Model.Plane pl2 = new Tekla.Structures.Model.Plane();
                pl2.AxisX  = cs2.AxisX;
                pl2.AxisY  = cs2.AxisY;
                pl2.Origin = cs2.Origin;

                GeometricPlane gp1 = new GeometricPlane(cs1);
                GeometricPlane gp2 = new GeometricPlane(cs2);

                ControlPlane cp1 = new ControlPlane(pl1, true);
                //cp1.Insert();
                ControlPlane cp2 = new ControlPlane(pl2, true);
                //cp2.Insert();

                LineSegment l2 = Projection.LineSegmentToPlane(l1, gp1);
                LineSegment l6 = Projection.LineSegmentToPlane(l4, gp2);

                ControlLine cl2 = new ControlLine(l2, true);
                ControlLine cl3 = new ControlLine(l6, true);


                cl2.Color = ControlLine.ControlLineColorEnum.YELLOW_RED;
                //cl2.Insert();
                cl3.Color = ControlLine.ControlLineColorEnum.YELLOW_RED;
                //cl3.Insert();

                Part         p3   = part as Part;
                Solid        sl1  = p3.GetSolid();
                ArrayList    al1  = sl1.Intersect(l2);
                Point        px   = new Point(al1[1] as Point);
                ControlPoint cpp1 = new ControlPoint(px);
                //cpp1.Insert();

                Part         p4   = part2 as Part;
                Solid        sl2  = p4.GetSolid();
                ArrayList    al2  = sl2.Intersect(l6);
                Point        py   = new Point(al2[1] as Point);
                ControlPoint cpp4 = new ControlPoint(py);
                //cpp4.Insert();

                double distance  = Distance.PointToLineSegment(st3, l2);
                double distance1 = l3.Length();
                double cos       = distance / distance1;
                double distance2 = Distance.PointToLineSegment(st4, l6);
                double distance3 = l5.Length();
                double cos1      = distance2 / distance3;

                Point        p10  = dlugosc(st1, st3, 4, cos, px);
                ControlPoint cpp2 = new ControlPoint(p10);
                //cpp2.Insert();
                Point        p20  = dlugosc(st2, st4, 4, cos1, py);
                ControlPoint cpp5 = new ControlPoint(p20);
                //cpp5.Insert();


                Point  p5   = new Point(l2.StartPoint);
                Point  p6   = new Point(l2.EndPoint);
                Vector v1   = new Vector((p6.X - p5.X) / 10000, (p6.Y - p5.Y) / 10000, (p6.Z - p5.Z) / 10000);
                double v1d  = v1.GetLength();
                double dlbl = Convert.ToDouble(textBox2.Text);
                Point  p11  = new Point(px);
                p11.Translate(v1.X * (dlbl / v1d), v1.Y * (dlbl / v1d), v1.Z * (dlbl / v1d));
                Point        p12  = dlugosc(st1, st3, 4, cos, p11);
                ControlPoint cpp3 = new ControlPoint(p12);
                //cpp3.Insert();
                Point  p7    = new Point(l6.StartPoint);
                Point  p8    = new Point(l6.EndPoint);
                Vector v2    = new Vector((p8.X - p7.X) / 10000, (p8.Y - p7.Y) / 10000, (p8.Z - p7.Z) / 10000);
                double v2d   = v2.GetLength();
                double dlbl1 = Convert.ToDouble(textBox2.Text);
                Point  p21   = new Point(py);
                p21.Translate(v2.X * (dlbl1 / v2d), v2.Y * (dlbl1 / v2d), v2.Z * (dlbl1 / v2d));
                Point        p22  = dlugosc(st2, st4, 4, cos1, p21);
                ControlPoint cpp6 = new ControlPoint(p22);
                //cpp6.Insert();


                Beam blachast = CreateBlacha(p10, p12, rotpart, 0, textBox1.Text);
                blachast.Insert();
                int        id1  = blachast.Identifier.ID;
                Identifier id11 = new Identifier(id1);
                MyModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(setWorkPlane(st1, vl3, v1));
                ModelObject blachast3   = MyModel.SelectModelObject(id11);
                double      rotblachast = (blachast3 as Beam).Position.RotationOffset;
                MyModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(currentPlane);
                //textBox1.Text = Convert.ToString(rotblachast);
                blachast.Position.RotationOffset = -rotblachast;
                blachast.PartNumber.Prefix       = "PL";
                blachast.PartNumber.StartNumber  = 1001;
                blachast.Modify();


                Beam blachast2 = CreateBlacha(p20, p22, rotpart2, 1, textBox1.Text);
                blachast2.Insert();
                int        id2  = blachast2.Identifier.ID;
                Identifier id12 = new Identifier(id2);
                MyModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(setWorkPlane(st2, vl5, v2));
                ModelObject blachast4    = MyModel.SelectModelObject(id12);
                double      rotblachast2 = (blachast4 as Beam).Position.RotationOffset;
                MyModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(currentPlane);
                blachast2.Position.RotationOffset = -rotblachast2;
                blachast2.PartNumber.Prefix       = "PL";
                blachast2.PartNumber.StartNumber  = 1001;
                blachast2.Modify();

                Point p15 = new Point(p12);
                p15.Translate(v1.X * (-30 / v1d), v1.Y * (-30 / v1d), v1.Z * (-30 / v1d));
                ControlPoint cpp7 = new ControlPoint(p15);
                //cpp7.Insert();

                Point p16 = new Point(p22);
                p16.Translate(v2.X * (-30 / v2d), v2.Y * (-30 / v2d), v2.Z * (-30 / v2d));
                ControlPoint cpp8 = new ControlPoint(p16);
                //cpp8.Insert();

                Vector v11516 = new Vector((p16.X - p15.X) / 10000, (p16.Y - p15.Y) / 10000, (p16.Z - p15.Z) / 10000);

                Point p151 = new Point(p15); Point p152 = new Point(p15); Point p153 = new Point(p15);
                Point p161 = new Point(p16); Point p162 = new Point(p16); Point p163 = new Point(p16);

                p151.Translate(v11516.X * (-30 / v11516.GetLength()), v11516.Y * (-30 / v11516.GetLength()), v11516.Z * (-30 / v11516.GetLength()));
                p152.Translate(v11516.X * (120 / v11516.GetLength()), v11516.Y * (120 / v11516.GetLength()), v11516.Z * (120 / v11516.GetLength()));
                p153.Translate(v11516.X * (70 / v11516.GetLength()), v11516.Y * (70 / v11516.GetLength()), v11516.Z * (70 / v11516.GetLength()));

                p161.Translate(v11516.X * (30 / v11516.GetLength()), v11516.Y * (30 / v11516.GetLength()), v11516.Z * (30 / v11516.GetLength()));
                p162.Translate(v11516.X * (-120 / v11516.GetLength()), v11516.Y * (-120 / v11516.GetLength()), v11516.Z * (-120 / v11516.GetLength()));
                p163.Translate(v11516.X * (-70 / v11516.GetLength()), v11516.Y * (-70 / v11516.GetLength()), v11516.Z * (-70 / v11516.GetLength()));

                Beam BlSt1 = BlachaSt(p151, p152, 0);
                BlSt1.Insert();
                int        id3  = BlSt1.Identifier.ID;
                Identifier id13 = new Identifier(id3);
                MyModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(setWorkPlane(st1, vl3, v1));
                ModelObject blachast5 = MyModel.SelectModelObject(id13);
                double      rot5      = (blachast5 as Beam).Position.RotationOffset;
                MyModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(currentPlane);
                //textBox1.Text = Convert.ToString(rotblachast);
                BlSt1.Position.RotationOffset = -rot5;
                BlSt1.PartNumber.Prefix       = "PL";
                BlSt1.PartNumber.StartNumber  = 1001;
                BlSt1.Modify();

                Beam BlSt2 = BlachaSt(p161, p162, 1);
                BlSt2.Insert();
                int        id4  = BlSt2.Identifier.ID;
                Identifier id14 = new Identifier(id4);
                MyModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(setWorkPlane(st2, vl5, v2));
                ModelObject blachast6 = MyModel.SelectModelObject(id14);
                double      rot6      = (blachast6 as Beam).Position.RotationOffset;
                MyModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(currentPlane);
                //textBox1.Text = Convert.ToString(rotblachast);
                BlSt2.Position.RotationOffset = -rot6;
                BlSt2.PartNumber.Prefix       = "PL";
                BlSt2.PartNumber.StartNumber  = 1001;
                BlSt2.Modify();

                Beam St12 = CreateStezenie12(p153, p163);
                St12.Insert();
                int        id5  = St12.Identifier.ID;
                Identifier id15 = new Identifier(id5);
                MyModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(setWorkPlane(st1, vl3, v1));
                ModelObject stezenie1 = MyModel.SelectModelObject(id15);
                (stezenie1 as Beam).StartPointOffset.Dy    = 4;
                (stezenie1 as Part).PartNumber.Prefix      = "Pr";
                (stezenie1 as Part).PartNumber.StartNumber = 1001;
                stezenie1.Modify();
                MyModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(currentPlane);
                MyModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(setWorkPlane(st2, vl5, v2));
                ModelObject stezenie2 = MyModel.SelectModelObject(id15);
                (stezenie2 as Beam).EndPointOffset.Dy      = -6;
                (stezenie2 as Part).PartNumber.Prefix      = "Pr";
                (stezenie2 as Part).PartNumber.StartNumber = 1001;
                stezenie2.Modify();
                MyModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(currentPlane);

                double split      = Convert.ToDouble(textBox3.Text);
                Point  pointsplit = new Point(p163);
                pointsplit.Translate(v11516.X * (-split / v11516.GetLength()), v11516.Y * (-split / v11516.GetLength()), v11516.Z * (-split / v11516.GetLength()));


                BoltArray b1 = sruby(p151, p152, BlSt1, blachast);
                b1.Insert();
                int        id6  = b1.Identifier.ID;
                Identifier id16 = new Identifier(id6);
                MyModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(setWorkPlane(st1, vl3, v1));
                ModelObject b1m = MyModel.SelectModelObject(id16);
                (b1m as BoltArray).Position.RotationOffset = 0;
                (b1m as BoltArray).BoltStandard            = "4017-8.8";
                (b1m as BoltArray).ExtraLength             = 5;
                b1m.Modify();
                MyModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(currentPlane);

                BoltArray b2 = sruby(p161, p162, BlSt2, blachast2);
                b2.Insert();
                int        id7  = b2.Identifier.ID;
                Identifier id17 = new Identifier(id7);
                MyModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(setWorkPlane(st2, vl5, v2));
                ModelObject b2m = MyModel.SelectModelObject(id17);
                (b2m as BoltArray).Position.RotationOffset = 180;
                b2m.Modify();
                MyModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(currentPlane);


                Weld w  = new Weld();
                Weld w2 = new Weld();
                Weld w3 = new Weld();
                Weld w4 = new Weld();
                w.MainObject      = stezenie2;
                w.SecondaryObject = BlSt1;
                w.ShopWeld        = true;
                w.Insert();
                w2.MainObject      = stezenie2;
                w2.SecondaryObject = BlSt2;
                w2.ShopWeld        = true;
                w2.Insert();
                w3.MainObject      = part;
                w3.SecondaryObject = blachast;
                w3.ShopWeld        = true;
                w3.Insert();
                w4.MainObject      = part2;
                w4.SecondaryObject = blachast2;
                w4.ShopWeld        = true;
                w4.Insert();
                Beam       st122 = Operation.Split(stezenie2 as Beam, pointsplit);
                Connection sr    = new Connection();
                sr.Name   = "Połączenie śrubą rzymską";
                sr.Number = 126;
                sr.LoadAttributesFromFile("82269_M12");
                sr.SetPrimaryObject(stezenie2);
                sr.SetSecondaryObject(st122);
                sr.Insert();
            }


            MyModel.CommitChanges();
        }
示例#7
0
        public override bool Run(List <InputDefinition> Input)
        {
            try
            {
                // 오버라이드 된 DefineInput에서 List를 가져옴
                // purlin = 중도리 지붕을 지탱하는 골조
                // flange = 플랜지 파이프를 연결하기 위한 배관?
                Beam Purlin1 = (Beam)_model.SelectModelObject((Identifier)Input[0].GetInput());
                Beam Purlin2 = (Beam)_model.SelectModelObject((Identifier)Input[1].GetInput());
                Beam OFlange = (Beam)_model.SelectModelObject((Identifier)Input[2].GetInput());
                Beam Web     = (Beam)_model.SelectModelObject((Identifier)Input[3].GetInput());
                Beam IFlange = (Beam)_model.SelectModelObject((Identifier)Input[4].GetInput());

                // 초기값 체크
                GetValuesFromDialog();

                double WebThick     = 0.0;
                double IFlangeWidth = 0.0;
                double IFlangeThick = 0.0;
                double OFlangeThick = 0.0;
                Web.GetReportProperty("WIDTH", ref WebThick);
                OFlange.GetReportProperty("WIDTH", ref OFlangeThick);
                IFlange.GetReportProperty("WIDTH", ref IFlangeThick);
                IFlange.GetReportProperty("HEIGHT", ref IFlangeWidth);

                if (IsDefaultValue(_PlateWidth) || _PlateWidth == 0)
                {
                    _PlateWidth = (IFlangeWidth - WebThick) * 0.5;
                }
                if (IsDefaultValue(_PlateLength) || _PlateLength == 0)
                {
                    _PlateLength = (IFlangeWidth - WebThick) * 0.5;
                }

                CoordinateSystem WebSys = Web.GetCoordinateSystem();

                // 평면(Web)과 선(purlin1의 시작과 끝점)이 만나는 교차점
                T3D.Point TopCenter = T3D.Intersection.LineToPlane(new Line(Purlin1.StartPoint, Purlin1.EndPoint), new GeometricPlane(WebSys.Origin, WebSys.AxisX, WebSys.AxisY));

                // 실제 좌표점(x,y,z)
                CoordinateSystem WorkSystem = new CoordinateSystem(TopCenter, WebSys.AxisX.Cross(WebSys.AxisY), WebSys.AxisY);

                // CoordinateSystem의 실좌표를 Plane 변경
                _model.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane(WorkSystem));

                Purlin1.Select();
                Purlin2.Select();
                Web.Select();
                OFlange.Select();
                IFlange.Select();

                CoordinateSystem PurSys        = Purlin1.GetCoordinateSystem();
                T3D.Point        TopClipCenter = T3D.Intersection.LineToPlane(new Line(OFlange.StartPoint, OFlange.EndPoint), new GeometricPlane(PurSys.Origin, PurSys.AxisX, PurSys.AxisY));
                T3D.Point        BottCenter    = T3D.Intersection.LineToPlane(new Line(IFlange.StartPoint, IFlange.EndPoint), new GeometricPlane(PurSys.Origin, PurSys.AxisX, PurSys.AxisY));

                T3D.Point LeftAngleFirstPoint   = new T3D.Point(-_UpperHorizontalDistance, _UpperVerticalDistance, 0);
                T3D.Point LeftAngleSecondPoint  = new T3D.Point(-_LowerHorizontalDistance, BottCenter.Y - IFlangeThick + _LowerVerticalDistance, 0);
                T3D.Point RightAngleFirstPoint  = new T3D.Point(_UpperHorizontalDistance, _UpperVerticalDistance, 0);
                T3D.Point RightAngleSecondPoint = new T3D.Point(_LowerHorizontalDistance, BottCenter.Y - IFlangeThick + _LowerVerticalDistance, 0);

                Beam         LeftAngle  = new Beam();
                Beam         RightAngle = new Beam();
                Beam         TopClip    = new Beam();
                ContourPlate LeftPlate  = new ContourPlate();
                ContourPlate RightPlate = new ContourPlate();

                TopClip.StartPoint = new T3D.Point(-_TopClipLength * 0.5, TopClipCenter.Y + OFlangeThick, 0);
                TopClip.EndPoint   = new T3D.Point(_TopClipLength * 0.5, TopClipCenter.Y + OFlangeThick, 0);

                if (PurSys.AxisX.GetNormal() == new Vector(1, 0, 0) && PurSys.AxisY.GetNormal() == new Vector(0, 1, 0))
                {
                    LeftAngle.StartPoint         = LeftAngleSecondPoint;
                    LeftAngle.EndPoint           = LeftAngleFirstPoint;
                    RightAngle.StartPoint        = RightAngleFirstPoint;
                    RightAngle.EndPoint          = RightAngleSecondPoint;
                    LeftAngle.Position.Plane     = Position.PlaneEnum.LEFT;
                    LeftAngle.Position.Rotation  = Position.RotationEnum.BELOW;
                    LeftAngle.Position.Depth     = Position.DepthEnum.BEHIND;
                    RightAngle.Position.Plane    = Position.PlaneEnum.LEFT;
                    RightAngle.Position.Rotation = Position.RotationEnum.BELOW;
                    RightAngle.Position.Depth    = Position.DepthEnum.BEHIND;
                    TopClip.Position.Plane       = Position.PlaneEnum.LEFT;
                    TopClip.Position.Rotation    = Position.RotationEnum.FRONT;
                    TopClip.Position.Depth       = Position.DepthEnum.BEHIND;
                    LeftPlate.Position.Depth     = Position.DepthEnum.FRONT;
                    RightPlate.Position.Depth    = Position.DepthEnum.FRONT;
                }
                else
                {
                    LeftAngle.StartPoint         = LeftAngleFirstPoint;
                    LeftAngle.EndPoint           = LeftAngleSecondPoint;
                    RightAngle.StartPoint        = RightAngleFirstPoint;
                    RightAngle.EndPoint          = RightAngleSecondPoint;
                    LeftAngle.Position.Plane     = Position.PlaneEnum.RIGHT;
                    LeftAngle.Position.Rotation  = Position.RotationEnum.TOP;
                    LeftAngle.Position.Depth     = Position.DepthEnum.FRONT;
                    RightAngle.Position.Plane    = Position.PlaneEnum.RIGHT;
                    RightAngle.Position.Rotation = Position.RotationEnum.FRONT;
                    RightAngle.Position.Depth    = Position.DepthEnum.FRONT;
                    TopClip.Position.Plane       = Position.PlaneEnum.LEFT;
                    TopClip.Position.Rotation    = Position.RotationEnum.FRONT;
                    TopClip.Position.Depth       = Position.DepthEnum.FRONT;
                    LeftPlate.Position.Depth     = Position.DepthEnum.BEHIND;
                    RightPlate.Position.Depth    = Position.DepthEnum.BEHIND;
                }

                LeftAngle.Profile.ProfileString   = _FlangeProfile;
                LeftAngle.Material.MaterialString = _FlangeMaterial;
                LeftAngle.Class = _FlangeClass;
                LeftAngle.Name  = _FlangeName;
                LeftAngle.Insert();

                RightAngle.Profile.ProfileString   = _FlangeProfile;
                RightAngle.Material.MaterialString = _FlangeMaterial;
                RightAngle.Class = _FlangeClass;
                RightAngle.Name  = _FlangeName;
                RightAngle.Insert();

                double BraceWidth     = 0.0;
                double BraceThickness = 0.0;
                RightAngle.GetReportProperty("WIDTH", ref BraceWidth);
                RightAngle.GetReportProperty("PROFILE.FLANGE_THICKNESS_1", ref BraceThickness);

                double BoltGauge = (BraceWidth + BraceThickness) * 0.5;
                LeftAngle.Position.PlaneOffset = -BoltGauge;
                LeftAngle.StartPointOffset.Dx  = _UpperBoltHorizontalDistance;
                LeftAngle.EndPointOffset.Dx    = _LowerBoltHorizontalDistance;
                LeftAngle.Modify();
                RightAngle.Position.PlaneOffset = -BoltGauge;
                RightAngle.StartPointOffset.Dx  = -_LowerBoltHorizontalDistance;
                RightAngle.EndPointOffset.Dx    = _UpperBoltHorizontalDistance;
                RightAngle.Modify();

                TopClip.Profile.ProfileString   = "PL" + _TopClipThickness + "*" + _TopClipWidth;
                TopClip.Material.MaterialString = _TopClipMaterial;
                TopClip.Name = _TopClipName;
                TopClip.Insert();

                Point        LeftPlatePoint1        = new Point(BottCenter.X - WebThick * 0.5, BottCenter.Y, 0);
                Point        LeftPlatePoint2        = new Point(BottCenter.X - WebThick * 0.5, BottCenter.Y + _PlateLength, 0);
                Point        LeftPlatePoint3        = new Point(BottCenter.X - WebThick * 0.5 - _PlateWidth, BottCenter.Y + _PlateLength, 0);
                Point        LeftPlatePoint4        = new Point(BottCenter.X - WebThick * 0.5 - _PlateWidth, BottCenter.Y, 0);
                ContourPoint LeftPlateContourPoint1 = new ContourPoint(LeftPlatePoint1, new Chamfer(30, 30, Chamfer.ChamferTypeEnum.CHAMFER_LINE));
                ContourPoint LeftPlateContourPoint2 = new ContourPoint(LeftPlatePoint2, new Chamfer());
                ContourPoint LeftPlateContourPoint3 = new ContourPoint(LeftPlatePoint3, new Chamfer());
                ContourPoint LeftPlateContourPoint4 = new ContourPoint(LeftPlatePoint4, new Chamfer());
                LeftPlate.AddContourPoint(LeftPlateContourPoint1);
                LeftPlate.AddContourPoint(LeftPlateContourPoint2);
                LeftPlate.AddContourPoint(LeftPlateContourPoint3);
                LeftPlate.AddContourPoint(LeftPlateContourPoint4);
                LeftPlate.Material.MaterialString = _PlateMaterial;
                LeftPlate.Profile.ProfileString   = "PL" + _PlateThickness.ToString();
                LeftPlate.Name = _PlateName;
                LeftPlate.Insert();

                Point        RightPlatePoint1        = new Point(BottCenter.X + WebThick * 0.5, BottCenter.Y, 0);
                Point        RightPlatePoint2        = new Point(RightPlatePoint1.X + _PlateWidth, RightPlatePoint1.Y, 0);
                Point        RightPlatePoint3        = new Point(RightPlatePoint2.X, RightPlatePoint2.Y + _PlateLength, 0);
                Point        RightPlatePoint4        = new Point(RightPlatePoint3.X - _PlateWidth, RightPlatePoint3.Y, 0);
                ContourPoint RightPlateContourPoint1 = new ContourPoint(RightPlatePoint1, new Chamfer(30, 30, Chamfer.ChamferTypeEnum.CHAMFER_LINE));
                ContourPoint RightPlateContourPoint2 = new ContourPoint(RightPlatePoint2, new Chamfer());
                ContourPoint RightPlateContourPoint3 = new ContourPoint(RightPlatePoint3, new Chamfer());
                ContourPoint RightPlateContourPoint4 = new ContourPoint(RightPlatePoint4, new Chamfer());
                RightPlate.AddContourPoint(RightPlateContourPoint1);
                RightPlate.AddContourPoint(RightPlateContourPoint2);
                RightPlate.AddContourPoint(RightPlateContourPoint3);
                RightPlate.AddContourPoint(RightPlateContourPoint4);
                RightPlate.Material.MaterialString = _PlateMaterial;
                RightPlate.Profile.ProfileString   = "PL" + _PlateThickness.ToString();
                RightPlate.Name = _PlateName;
                RightPlate.Insert();

                Beam LeftPurlin  = Purlin1;
                Beam RightPurlin = Purlin2;
                if ((Purlin1.StartPoint.X - Purlin2.StartPoint.X) > 1 || (Purlin1.StartPoint.Y - Purlin2.StartPoint.Y) > 1)
                {
                    RightPurlin = Purlin1;
                    LeftPurlin  = Purlin2;
                }

                Weld LeftPlateToIFlange = new Weld();
                LeftPlateToIFlange.MainObject      = IFlange;
                LeftPlateToIFlange.SecondaryObject = LeftPlate;
                LeftPlateToIFlange.ShopWeld        = true;
                LeftPlateToIFlange.Insert();
                Weld LeftPlateToWeb = new Weld();
                LeftPlateToWeb.MainObject      = Web;
                LeftPlateToWeb.SecondaryObject = LeftPlate;
                LeftPlateToWeb.ShopWeld        = true;
                LeftPlateToWeb.Insert();
                Weld RightPlateToIFlange = new Weld();
                RightPlateToIFlange.MainObject      = IFlange;
                RightPlateToIFlange.SecondaryObject = RightPlate;
                RightPlateToIFlange.ShopWeld        = true;
                RightPlateToIFlange.Insert();
                Weld RightPlateToWeb = new Weld();
                RightPlateToWeb.MainObject      = Web;
                RightPlateToWeb.SecondaryObject = RightPlate;
                RightPlateToWeb.ShopWeld        = true;
                RightPlateToWeb.Insert();

                PolygonWeld ClipToFlange = new PolygonWeld();
                ClipToFlange.TypeAbove       = BaseWeld.WeldTypeEnum.WELD_TYPE_FILLET;
                ClipToFlange.TypeBelow       = BaseWeld.WeldTypeEnum.WELD_TYPE_FILLET;
                ClipToFlange.SizeAbove       = _ClipWeldSize;
                ClipToFlange.SizeBelow       = _ClipWeldSize;
                ClipToFlange.MainObject      = OFlange;
                ClipToFlange.SecondaryObject = TopClip;
                ClipToFlange.ShopWeld        = true;
                ClipToFlange.Polygon.Points.Add(TopClip.StartPoint);
                ClipToFlange.Polygon.Points.Add(TopClip.EndPoint);
                ClipToFlange.Insert();

                // Bolting Brace with Plate or Purlin
                BoltArray UpperLeftBolt = new BoltArray();
                UpperLeftBolt.PartToBoltTo   = LeftPurlin;
                UpperLeftBolt.PartToBeBolted = LeftAngle;
                UpperLeftBolt.FirstPosition  = LeftAngle.StartPoint;
                UpperLeftBolt.SecondPosition = LeftAngle.EndPoint;
                UpperLeftBolt.AddBoltDistX(0.0);
                UpperLeftBolt.AddBoltDistY(0.0);
                UpperLeftBolt.BoltSize          = _BraceBoltSize;
                UpperLeftBolt.Tolerance         = 0.0625 * 25.4;
                UpperLeftBolt.BoltStandard      = _BraceBoltStandard;
                UpperLeftBolt.BoltType          = BoltGroup.BoltTypeEnum.BOLT_TYPE_SITE;
                UpperLeftBolt.CutLength         = 76.2;
                UpperLeftBolt.Bolt              = true;
                UpperLeftBolt.Position.Rotation = Position.RotationEnum.FRONT;
                BoltArray LowerLeftBolt = new BoltArray();
                LowerLeftBolt.PartToBoltTo   = LeftPlate;
                LowerLeftBolt.PartToBeBolted = LeftAngle;
                LowerLeftBolt.FirstPosition  = LeftAngle.EndPoint;
                LowerLeftBolt.SecondPosition = LeftAngle.StartPoint;
                LowerLeftBolt.AddBoltDistX(0.0);
                LowerLeftBolt.AddBoltDistY(0.0);
                LowerLeftBolt.BoltSize          = _BraceBoltSize;
                LowerLeftBolt.BoltStandard      = _BraceBoltStandard;
                LowerLeftBolt.Tolerance         = 0.0625 * 25.4;
                LowerLeftBolt.BoltType          = BoltGroup.BoltTypeEnum.BOLT_TYPE_SITE;
                LowerLeftBolt.CutLength         = 76.2;
                LowerLeftBolt.Bolt              = true;
                LowerLeftBolt.Position.Rotation = Position.RotationEnum.FRONT;
                BoltArray UpperRightBolt = new BoltArray();
                UpperRightBolt.PartToBoltTo   = RightPurlin;
                UpperRightBolt.PartToBeBolted = RightAngle;
                UpperRightBolt.FirstPosition  = RightAngle.EndPoint;
                UpperRightBolt.SecondPosition = RightAngle.StartPoint;
                UpperRightBolt.AddBoltDistX(0.0);
                UpperRightBolt.AddBoltDistY(0.0);
                UpperRightBolt.BoltSize          = _BraceBoltSize;
                UpperRightBolt.Tolerance         = 0.0625 * 25.4;
                UpperRightBolt.BoltStandard      = _BraceBoltStandard;
                UpperRightBolt.BoltType          = BoltGroup.BoltTypeEnum.BOLT_TYPE_SITE;
                UpperRightBolt.CutLength         = 76.2;
                UpperRightBolt.Bolt              = true;
                UpperRightBolt.Position.Rotation = Position.RotationEnum.FRONT;
                BoltArray LowerRightBolt = new BoltArray();
                LowerRightBolt.PartToBoltTo   = RightPlate;
                LowerRightBolt.PartToBeBolted = RightAngle;
                LowerRightBolt.FirstPosition  = RightAngle.StartPoint;
                LowerRightBolt.SecondPosition = RightAngle.EndPoint;
                LowerRightBolt.AddBoltDistX(0.0);
                LowerRightBolt.AddBoltDistY(0.0);
                LowerRightBolt.BoltSize          = _BraceBoltSize;
                LowerRightBolt.Tolerance         = 0.0625 * 25.4;
                LowerRightBolt.BoltStandard      = _BraceBoltStandard;
                LowerRightBolt.BoltType          = BoltGroup.BoltTypeEnum.BOLT_TYPE_SITE;
                LowerRightBolt.CutLength         = 76.2;
                LowerRightBolt.Bolt              = true;
                LowerRightBolt.Position.Rotation = Position.RotationEnum.FRONT;

                // Bolting ClipPlate with purlin
                BoltArray ClipBolts1 = new BoltArray();
                ClipBolts1.PartToBoltTo        = LeftPurlin;
                ClipBolts1.PartToBeBolted      = TopClip;
                ClipBolts1.FirstPosition       = TopClip.StartPoint;
                ClipBolts1.SecondPosition      = TopClip.EndPoint;
                ClipBolts1.StartPointOffset.Dx = 31.75;
                ClipBolts1.AddBoltDistX(0);
                ClipBolts1.AddBoltDistY(76.2);
                ClipBolts1.StartPointOffset.Dy = 76.2;
                ClipBolts1.EndPointOffset.Dy   = 76.2;
                ClipBolts1.BoltSize            = _ClipBoltSize;
                ClipBolts1.Tolerance           = 0.0625 * 25.4;
                ClipBolts1.BoltStandard        = _CliptBoltStandard;
                ClipBolts1.BoltType            = BoltGroup.BoltTypeEnum.BOLT_TYPE_SITE;
                ClipBolts1.CutLength           = 76.2;
                ClipBolts1.Bolt = true;
                ClipBolts1.Position.Rotation = Position.RotationEnum.FRONT;

                BoltArray ClipBolts2 = new BoltArray();
                ClipBolts2.PartToBoltTo        = RightPurlin;
                ClipBolts2.PartToBeBolted      = TopClip;
                ClipBolts2.FirstPosition       = TopClip.StartPoint;
                ClipBolts2.SecondPosition      = TopClip.EndPoint;
                ClipBolts2.StartPointOffset.Dx = _TopClipLength - 31.75;
                ClipBolts2.AddBoltDistX(0);
                ClipBolts2.AddBoltDistY(76.2);
                ClipBolts2.StartPointOffset.Dy = 76.2;
                ClipBolts2.EndPointOffset.Dy   = 76.2;
                ClipBolts2.BoltSize            = _ClipBoltSize;
                ClipBolts2.Tolerance           = 0.0625 * 25.4;
                ClipBolts2.BoltStandard        = _CliptBoltStandard;
                ClipBolts2.BoltType            = BoltGroup.BoltTypeEnum.BOLT_TYPE_SITE;
                ClipBolts2.CutLength           = 76.2;
                ClipBolts2.Bolt = true;
                ClipBolts2.Position.Rotation = Position.RotationEnum.FRONT;

                if (PurSys.AxisX.GetNormal() == new Vector(1, 0, 0) && PurSys.AxisX.GetNormal() == new Vector(0, 1, 0))
                {
                    UpperLeftBolt.FirstPosition      = LeftAngle.EndPoint;
                    UpperLeftBolt.SecondPosition     = LeftAngle.StartPoint;
                    UpperLeftBolt.Position.Rotation  = Position.RotationEnum.BACK;
                    LowerLeftBolt.FirstPosition      = LeftAngle.StartPoint;
                    LowerLeftBolt.SecondPosition     = LeftAngle.EndPoint;
                    LowerLeftBolt.Position.Rotation  = Position.RotationEnum.BACK;
                    UpperRightBolt.FirstPosition     = RightAngle.StartPoint;
                    UpperRightBolt.SecondPosition    = RightAngle.EndPoint;
                    UpperRightBolt.Position.Rotation = Position.RotationEnum.BACK;
                    LowerRightBolt.FirstPosition     = RightAngle.StartPoint;
                    LowerRightBolt.SecondPosition    = RightAngle.EndPoint;
                    LowerRightBolt.Position.Rotation = Position.RotationEnum.BACK;
                    ClipBolts1.Position.Rotation     = Position.RotationEnum.BACK;
                    ClipBolts2.Position.Rotation     = Position.RotationEnum.BACK;
                }
                UpperLeftBolt.Insert();
                LowerLeftBolt.Insert();
                UpperRightBolt.Insert();
                LowerRightBolt.Insert();
                ClipBolts1.Insert();
                ClipBolts2.Insert();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }

            return(true);
        }