コード例 #1
0
        public static void DateLastMark(TSD.Drawing croquis, out string revisionMark, out int revisionDateSeconds)
        {
            Type         drawingType  = croquis.GetType();
            PropertyInfo propertyInfo = drawingType.GetProperty("Identifier", BindingFlags.Instance | BindingFlags.NonPublic);
            object       value        = propertyInfo.GetValue(croquis, null);

            Identifier identifier = (Identifier)value;

            TSM.Beam fakeBeam = new TSM.Beam {
                Identifier = identifier
            };

            revisionMark = "";
            fakeBeam.GetReportProperty("REVISION.LAST_MARK", ref revisionMark);

            revisionDateSeconds = 0;
            fakeBeam.GetReportProperty("REVISION.LAST_DATE_CREATE", ref revisionDateSeconds);
        }
コード例 #2
0
ファイル: Plate.cs プロジェクト: Tekon-git/Tekla-plugin
        ContourPlate CreateConturePlate(TSM.Beam secondaryBeam, TSM.Beam primaryBeam, double plateThickness, string plateName)
        {
            double secondaryWidth  = 0.0;
            double secondaryHeight = 0.0;


            secondaryBeam.GetReportProperty("WIDTH", ref secondaryWidth);
            secondaryBeam.GetReportProperty("HEIGHT", ref secondaryHeight);


            //TSG.Point p1 = new TSG.Point(secondaryWidth / 2, 0, secondaryHeight / 2);
            //TSG.Point p2 = new TSG.Point(secondaryWidth / 2, 0, -secondaryHeight / 2);
            //TSG.Point p3 = new TSG.Point(-secondaryWidth / 2, 0, -secondaryHeight / 2);
            //TSG.Point p4 = new TSG.Point(-secondaryWidth / 2, 0, secondaryHeight / 2);

            TSG.Point p1 = new TSG.Point(0, secondaryHeight / 2, secondaryWidth / 2);
            TSG.Point p2 = new TSG.Point(0, -secondaryHeight / 2, secondaryWidth / 2);
            TSG.Point p3 = new TSG.Point(0, -secondaryHeight / 2, -secondaryWidth / 2);
            TSG.Point p4 = new TSG.Point(0, secondaryHeight / 2, -secondaryWidth / 2);

            ContourPlate CP            = new ContourPlate();
            ContourPoint conturePoint1 = new ContourPoint(p1, null);
            ContourPoint conturePoint2 = new ContourPoint(p2, null);
            ContourPoint conturePoint3 = new ContourPoint(p3, null);
            ContourPoint conturePoint4 = new ContourPoint(p4, null);

            CP.AddContourPoint(conturePoint1);
            CP.AddContourPoint(conturePoint2);
            CP.AddContourPoint(conturePoint3);
            CP.AddContourPoint(conturePoint4);
            CP.Name   = plateName;
            CP.Finish = "xxx";
            CP.Profile.ProfileString   = "PL" + plateThickness;
            CP.Material.MaterialString = "S235";
            CP.Position.Depth          = Position.DepthEnum.FRONT;



            return(CP);
        }
コード例 #3
0
ファイル: ModelPart.cs プロジェクト: lijuncq/Tekla-Properties
            public void GetProperties()
            {
                ModelObjectEnumerator modelObjectEnum = model.GetModelObjectSelector().GetSelectedObjects();

                if (modelObjectEnum.GetSize() == 1)
                {
                    while (modelObjectEnum.MoveNext())
                    {
                        if (modelObjectEnum.Current is Tekla.Structures.Model.Beam)
                        {
                            Tekla.Structures.Model.Beam beam = (Tekla.Structures.Model.Beam)modelObjectEnum.Current;

                            TransformationPlane currentTP = new TransformationPlane();
                            currentTP = model.GetWorkPlaneHandler().GetCurrentTransformationPlane();

                            model.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane());

                            beam.Select();

                            Assembly assembly = beam.GetAssembly() as Tekla.Structures.Model.Assembly;
                            assembly.GetReportProperty("ASSEMBLY_POSITION_CODE", ref gridLocation);
                            partType = beam.GetType().Name;
                            partID   = beam.Identifier.ID.ToString();
                            beam.GetReportProperty("OWNER", ref owner);
                            zStart          = beam.StartPoint.Z.ToString("F02");
                            zEnd            = beam.EndPoint.Z.ToString("F02");
                            partPrefix      = beam.PartNumber.Prefix;
                            partStartNo     = beam.PartNumber.StartNumber.ToString();
                            assemblyPrefix  = beam.AssemblyNumber.Prefix;
                            assemblyStartNo = beam.AssemblyNumber.StartNumber.ToString();
                            Phase CurrentPhase = new Phase();
                            beam.GetPhase(out CurrentPhase);
                            phase      = CurrentPhase.PhaseNumber.ToString();
                            name       = beam.Name;
                            profile    = beam.Profile.ProfileString;
                            material   = beam.Material.MaterialString;
                            finish     = beam.Finish;
                            classValue = beam.Class;
                            if (beam.Position.Plane == Position.PlaneEnum.LEFT)
                            {
                                positionOnPlane = PositionPlaneEnum.Left;
                            }
                            else if (beam.Position.Plane == Position.PlaneEnum.MIDDLE)
                            {
                                positionOnPlane = PositionPlaneEnum.Middle;
                            }
                            else if (beam.Position.Plane == Position.PlaneEnum.RIGHT)
                            {
                                positionOnPlane = PositionPlaneEnum.Right;
                            }
                            positionOnPlaneOffset = beam.Position.PlaneOffset.ToString("F02");
                            if (beam.Position.Rotation == Position.RotationEnum.BACK)
                            {
                                positionRotation = PositionRotationEnum.Back;
                            }
                            else if (beam.Position.Rotation == Position.RotationEnum.BELOW)
                            {
                                positionRotation = PositionRotationEnum.Below;
                            }
                            else if (beam.Position.Rotation == Position.RotationEnum.FRONT)
                            {
                                positionRotation = PositionRotationEnum.Front;
                            }
                            else if (beam.Position.Rotation == Position.RotationEnum.TOP)
                            {
                                positionRotation = PositionRotationEnum.Top;
                            }
                            positionRotationOffset = beam.Position.RotationOffset.ToString("F02");
                            if (beam.Position.Depth == Position.DepthEnum.BEHIND)
                            {
                                positionAtDepth = PositionDepthEnum.Behind;
                            }
                            else if (beam.Position.Depth == Position.DepthEnum.FRONT)
                            {
                                positionAtDepth = PositionDepthEnum.Front;
                            }
                            else if (beam.Position.Depth == Position.DepthEnum.MIDDLE)
                            {
                                positionAtDepth = PositionDepthEnum.Middle;
                            }
                            positionAtDepthOffset = beam.Position.DepthOffset.ToString("F02");
                            offsetStartPointX     = beam.StartPointOffset.Dx.ToString("F02");
                            offsetStartPointY     = beam.StartPointOffset.Dy.ToString("F02");
                            offsetStartPointZ     = beam.StartPointOffset.Dz.ToString("F02");
                            offsetEndPointX       = beam.EndPointOffset.Dx.ToString("F02");
                            offsetEndPointY       = beam.EndPointOffset.Dy.ToString("F02");
                            offsetEndPointZ       = beam.EndPointOffset.Dz.ToString("F02");
                            beam.GetUserProperty("USER_FIELD_1", ref userfield1);
                            beam.GetUserProperty("USER_FIELD_2", ref userfield2);
                            beam.GetUserProperty("USER_FIELD_3", ref userfield3);
                            beam.GetUserProperty("USER_FIELD_4", ref userfield4);
                            beam.GetUserProperty("comment", ref notesComments);
                            beam.GetUserProperty("FIT_NOTES", ref fittingNotes);
                            beam.GetUserProperty("FIT_NOTES2", ref fittingNotes2);
                            beam.GetUserProperty("cambering", ref cambering);
                            beam.GetUserProperty("PAINT", ref paint);
                            beam.GetUserProperty("PRELIM_MARK", ref preliminaryMark);
                            beam.GetUserProperty("PAINT_WFT", ref paintWFT);
                            beam.GetUserProperty("PAINT_DFT", ref paintDFT);
                            double dblshear1  = 0; beam.GetUserProperty("shear1", ref dblshear1); dblshear1 = dblshear1 * 0.001; shearStart = dblshear1.ToString();
                            double dblshear2  = 0; beam.GetUserProperty("shear2", ref dblshear2); dblshear2 = dblshear2 * 0.001; shearEnd = dblshear2.ToString();
                            double dblaxial1  = 0; beam.GetUserProperty("axial1", ref dblaxial1); dblaxial1 = dblaxial1 * 0.001; axialStart = dblaxial1.ToString();
                            double dblaxial2  = 0; beam.GetUserProperty("axial2", ref dblaxial2); dblaxial2 = dblaxial2 * 0.001; axialEnd = dblaxial2.ToString();
                            double dblmoment1 = 0; beam.GetUserProperty("moment1", ref dblmoment1); dblmoment1 = dblmoment1 * 0.001; momentStart = dblmoment1.ToString();
                            double dblmoment2 = 0; beam.GetUserProperty("moment2", ref dblmoment2); dblmoment2 = dblmoment2 * 0.001; momentEnd = dblmoment2.ToString();

                            beam.GetUserProperty("CONN_CODE_END1", ref connCodeStart);
                            beam.GetUserProperty("CONN_CODE_END2", ref connCodeEnd);
                            model.GetWorkPlaneHandler().SetCurrentTransformationPlane(currentTP);
                        }
                    }
                }
                if (modelObjectEnum.GetSize() > 1)
                {
                    partType               = "";
                    partID                 = "";
                    owner                  = "";
                    gridLocation           = "";
                    partPrefix             = "";
                    partStartNo            = "";
                    assemblyPrefix         = "";
                    assemblyStartNo        = "";
                    phase                  = "";
                    name                   = "";
                    profile                = "";
                    material               = "";
                    finish                 = "";
                    classValue             = "";
                    userfield1             = "";
                    userfield2             = "";
                    userfield3             = "";
                    userfield4             = "";
                    notesComments          = "";
                    fittingNotes           = "";
                    fittingNotes2          = "";
                    cambering              = "";
                    paint                  = "";
                    preliminaryMark        = "";
                    paintWFT               = "";
                    paintDFT               = "";
                    shearStart             = "";
                    shearEnd               = "";
                    axialStart             = "";
                    axialEnd               = "";
                    momentStart            = "";
                    momentEnd              = "";
                    connCodeStart          = "";
                    connCodeEnd            = "";
                    positionOnPlane        = new PositionPlaneEnum();
                    positionOnPlaneOffset  = "";
                    positionRotation       = new PositionRotationEnum();
                    positionRotationOffset = "";
                    positionAtDepth        = new PositionDepthEnum();
                    positionAtDepthOffset  = "";
                    offsetStartPointX      = "";
                    offsetStartPointY      = "";
                    offsetStartPointZ      = "";
                    offsetEndPointX        = "";
                    offsetEndPointY        = "";
                    offsetEndPointZ        = "";
                    zStart                 = "";
                    zEnd                   = "";
                }
            }
コード例 #4
0
        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();
        }
コード例 #5
0
        private void btn_multiBeams_Click(object sender, EventArgs e)
        {
            try
            {
                Picker    picker = new Picker();
                ArrayList points = picker.PickPoints(Picker.PickPointEnum.PICK_POLYGON);

                if (points.Count >= 3)
                {
                    TSG.Point  start     = new TSG.Point(0, 0, 0);
                    TSG.Point  middle    = new TSG.Point(0, 0, 0);
                    TSG.Point  end       = new TSG.Point(0, 0, 0);
                    TSG.Vector vectorFit = new TSG.Vector();
                    TSG.Vector vectorZ   = new TSG.Vector();
                    TSG.Vector vectorOne = new TSG.Vector();
                    TSG.Vector vectorTwo = new TSG.Vector();

                    ArrayList listBeams  = new ArrayList();
                    ArrayList listPlates = new ArrayList();

                    double angelDegree = 0.0;

                    for (int i = 0; i < points.Count - 1; i++)
                    {
                        TSM.Beam beam = BeamFirst(points[i] as TSG.Point, points[i + 1] as TSG.Point);
                        beam.Insert();
                        listBeams.Add(beam);
                        this.model.CommitChanges();
                    }

                    double primaryWidth  = 0.0;
                    double primaryHeight = 0.0;

                    for (int i = 0; i < points.Count - 1; i++)
                    {
                        try
                        {
                            start  = points[i] as TSG.Point;
                            middle = points[i + 1] as TSG.Point;
                            end    = points[i + 2] as TSG.Point;
                        }
                        catch
                        {
                        }

                        vectorOne = new TSG.Vector(middle.X - start.X, middle.Y - start.Y, middle.Z - start.Z);
                        vectorOne.Normalize();
                        vectorTwo = new TSG.Vector(middle.X - end.X, middle.Y - end.Y, middle.Z - end.Z);
                        vectorTwo.Normalize();
                        double angle = vectorOne.GetAngleBetween(vectorTwo);
                        angelDegree = angle * 180 / Math.PI;

                        //TSG.Vector vectorFit = new TSG.Vector(1 * Math.Cos(angle / 2), 1 * Math.Cos(angle / 2), 0);
                        vectorFit = new TSG.Vector(vectorOne.X + vectorTwo.X, vectorOne.Y + vectorTwo.Y, vectorOne.Z + vectorTwo.Z);
                        vectorZ   = vectorOne.Cross(vectorTwo);

                        TSG.CoordinateSystem coordinateSystem = new TSG.CoordinateSystem();

                        double thick;
                        if (tb_thcikPlates.Text != string.Empty)
                        {
                            double.TryParse(tb_thcikPlates.Text, out thick);
                        }
                        else
                        {
                            thick = 20.0;
                        }

                        double offset  = thick;
                        double angleFD = 90 - (angelDegree / 2);
                        double angleFR = Math.PI * angleFD / 180;

                        double width  = 0.0;
                        double heigth = 0.0;

                        double x = Math.Round(vectorFit.X, 2, MidpointRounding.ToEven);
                        double y = Math.Round(vectorFit.Y, 2, MidpointRounding.ToEven);
                        double z = Math.Round(vectorFit.Z, 2, MidpointRounding.ToEven);


                        TSM.Beam beam1 = listBeams[i] as TSM.Beam;
                        TSM.Beam beam2 = listBeams[i + 1] as TSM.Beam;
                        beam1.GetReportProperty("WIDTH", ref primaryWidth);
                        beam1.GetReportProperty("HEIGHT", ref primaryHeight);

                        if (x == 0.0 && y == 0.0 && z == 0.0)
                        {
                            TSG.Vector bAxisX = beam1.GetCoordinateSystem().AxisX;
                            TSG.Vector bAxisY = beam1.GetCoordinateSystem().AxisY;
                            TSG.Vector bAxisZ = bAxisY.Cross(bAxisX);

                            coordinateSystem = new TSG.CoordinateSystem(middle, bAxisZ, bAxisY);
                        }
                        else
                        {
                            coordinateSystem = new TSG.CoordinateSystem(
                                middle, vectorFit, vectorZ);
                        }

                        TSM.WorkPlaneHandler planeHandler = model.GetWorkPlaneHandler();

                        TSM.TransformationPlane original  = planeHandler.GetCurrentTransformationPlane();
                        TSM.TransformationPlane beamPlane = new TSM.TransformationPlane(coordinateSystem);
                        planeHandler.SetCurrentTransformationPlane(beamPlane);

                        FitBeam(beam1, -offset);
                        FitBeam(beam2, offset);

                        if (z != 0)
                        {
                            vectorZ = vectorTwo.Cross(vectorOne);

                            planeHandler.SetCurrentTransformationPlane(original);
                            TSG.CoordinateSystem coordinatePlate = new TSG.CoordinateSystem(
                                middle, vectorZ, vectorFit);

                            TSM.TransformationPlane beamPlate = new TSM.TransformationPlane(coordinatePlate);
                            planeHandler.SetCurrentTransformationPlane(beamPlate);

                            width  = primaryWidth;
                            heigth = 50 + primaryHeight / (Math.Cos(angleFR));
                        }
                        else
                        {
                            width  = 50 + primaryWidth / (Math.Cos(angleFR));
                            heigth = primaryHeight;
                        }


                        bool positionPlate = true;

                        for (int k = 0; k < 2; k++)
                        {
                            TSM.ContourPlate plate = PlateFirst(width, heigth, offset);
                            if (positionPlate)
                            {
                                plate.Position.Depth = TSM.Position.DepthEnum.BEHIND;
                                positionPlate        = false;
                            }
                            else
                            {
                                plate.Position.Depth = TSM.Position.DepthEnum.FRONT;
                            }
                            plate.Insert();
                            listPlates.Add(plate);
                        }

                        TSM.ContourPlate plate1 = listPlates[0] as TSM.ContourPlate;
                        TSM.ContourPlate plate2 = listPlates[1] as TSM.ContourPlate;

                        BoltPlatetoPlate(plate1, plate2, heigth, width);

                        WeldBeamToPlate(beam1, plate1);
                        WeldBeamToPlate(beam2, plate2);

                        planeHandler.SetCurrentTransformationPlane(original);

                        this.model.CommitChanges();
                        listPlates.Clear();
                    }

                    this.model.CommitChanges();

                    listBeams.Clear();
                }
                else
                {
                    MessageBox.Show(Tekla.Structures.Dialog.UIControls.LocalizeForm.Localization.GetText("albl_Invalid_input_parts"));//translation of text in message box
                }
            }
            catch
            {
            }
        }