Пример #1
0
 private void CreatBeams(Point Point1, Point Point2, String Profile)
 {
     tsm.Beam mybeams = new tsm.Beam(Point1, Point2);
     mybeams.Profile.ProfileString = Profile;
     mybeams.Finish = "Paint";
     mybeams.Insert();
 }
Пример #2
0
        private void CreateBeam(TSG.Point Point1, TSG.Point Point2)
        {
            TSM.Beam MyBeam = new TSM.Beam(Point1, Point2);

            MyBeam.Profile.ProfileString = _Profile;
            MyBeam.Class = _Color.ToString();
            MyBeam.Insert();
        }
Пример #3
0
        private void CreateBeam(Point Point1, Point Point2, string profile)
        {
            TSM.Beam MyBeam = new TSM.Beam(Point1, Point2);

            MyBeam.Profile.ProfileString = profile;      //_Profile;
            MyBeam.Finish = "PAINT";
            MyBeam.Insert();
        }
Пример #4
0
        private void CreateBeam(TSG.Point Point1, TSG.Point Point2)
        {
            TSM.Beam MyBeam = new TSM.Beam(Point1, Point2);

            MyBeam.Profile.ProfileString = _Profile;
            MyBeam.Finish = "PAINT";
            MyBeam.Insert();
        }
Пример #5
0
        /// <summary>
        /// Creates a beam using two input points.
        /// </summary>
        /// <param name="point1">The first input point.</param>
        /// <param name="point2">The second input point.</param>
        private void CreateBeam(Point point1, Point point2)
        {
            var myBeam = new TSM.Beam(point1, point2)
            {
                Profile = { ProfileString = this.profile },
                Finish  = "PAINT"
            };

            myBeam.Insert();
        }
Пример #6
0
        private void CreateWebPlate(TSG.Point Point1, TSG.Point Point2)
        {
            TSM.Beam myBeam = new TSM.Beam(new TSG.Point(Point1), new TSG.Point(Point2));

            string profileString = "Pl" + this.webThickness.ToString() + "*" + (this.webHeight - 2.0 * this.flangeThickness).ToString();

            myBeam.Profile.ProfileString = profileString.Replace(",", ".");
            myBeam.Finish            = "PAINTT";
            myBeam.Position.Depth    = TSM.Position.DepthEnum.MIDDLE;
            myBeam.Position.Plane    = TSM.Position.PlaneEnum.MIDDLE;
            myBeam.Position.Rotation = TSM.Position.RotationEnum.BACK;
            myBeam.Insert();
        }
Пример #7
0
        /// <summary>
        /// Creates a beam using two input points.
        /// </summary>
        /// <param name="point1">The first input point.</param>
        /// <param name="point2">The second input point.</param>
        private void CreateBeam(Point point1, Point point2)
        {
            var myBeam = new TSM.Beam(point1, point2)
            {
                Profile = { ProfileString = this.profile },
                Finish  = "PAINT"
            };

            myBeam.Class = "2";
            myBeam.Material.MaterialString = "Steel_Undefined";
            myBeam.Name = "MyBeam";

            myBeam.Insert();
        }
Пример #8
0
        private void button1_Click(object sender, EventArgs e)
        {
            Model MyModel = new Model();

            TSM.Beam newObject = new TSM.Beam();

            int rowsCount = dataTable.Rows.Count;

            //string fabCode = "";

            if (rowsCount == 0)
            {
                MessageBox.Show("Open the file to proceed!", "COG Message");
            }
            else
            {
                progressBar1.Minimum = 1;
                progressBar1.Maximum = rowsCount;
                progressBar1.Value   = 1;
                progressBar1.Step    = 1;

                for (int i = 0; i < rowsCount; i++)
                {
                    newObject.Name = "COG for: " + dataTable.Rows[i]["Fabrication Code"].ToString();
                    //fabCode = newObject.Name;
                    //Console.WriteLine(newObject.Name + " "  + fabCode);
                    //newObject.SetUserProperty("FABRICATION_CODE", fabCode);
                    newObject.Profile.ProfileString   = "ELD1*1*100*100";//ELD1*15*100*100 d100
                    newObject.Material.MaterialString = "Z35";
                    newObject.Class                 = "1001";
                    newObject.PartNumber.Prefix     = "cog";
                    newObject.AssemblyNumber.Prefix = "COG";
                    newObject.StartPoint.X          = Convert.ToDouble(dataTable.Rows[i]["COG X"]);
                    newObject.StartPoint.Y          = Convert.ToDouble(dataTable.Rows[i]["COG Y"]);
                    newObject.StartPoint.Z          = Convert.ToDouble(dataTable.Rows[i]["COG Z"]);
                    newObject.EndPoint.X            = Convert.ToDouble(dataTable.Rows[i]["COG X"]);
                    newObject.EndPoint.Y            = Convert.ToDouble(dataTable.Rows[i]["COG Y"]);
                    newObject.EndPoint.Z            = Convert.ToDouble(dataTable.Rows[i]["COG Z"]) + 100;
                    newObject.Position.Rotation     = Position.RotationEnum.TOP;
                    newObject.Position.Plane        = Position.PlaneEnum.MIDDLE;
                    newObject.Position.Depth        = Position.DepthEnum.MIDDLE;

                    newObject.Insert();
                    progressBar1.PerformStep();
                    textBox2.Text = rowsCount + " " + "COGs created";
                }
                MyModel.CommitChanges();
            }
        }
Пример #9
0
        public static bool CreateBeam()
        {
            TSM.Model myModel = new TSM.Model();
            TSM.Beam  myBeam  = new TSM.Beam(new TSG3d.Point(1000, 1000, 1000),
                                             new TSG3d.Point(6000, 6000, 1000));
            myBeam.Material.MaterialString = "Concrete_Undefined";
            myBeam.Profile.ProfileString   = "800*400";
            bool creationResult = false;

            if (myBeam.Insert())
            {
                creationResult = myModel.CommitChanges();
            }
            return(creationResult);
        }
Пример #10
0
        private void btn_createbeam_Click(object sender, EventArgs e)
        {
            TSG.Point point1 = new TSG.Point(0, 0, 0);
            TSG.Point point2 = new TSG.Point(1000, 0, 0);

            TSM.Beam beam = new TSM.Beam();
            beam.StartPoint              = point1;
            beam.EndPoint                = point2;
            beam.Profile.ProfileString   = "H400X200X8X13";
            beam.Material.MaterialString = "C40";

            bool result = false;

            result = beam.Insert();
        }
Пример #11
0
        public void CreateBottomFlangePlate(TSG.Point Point1, TSG.Point Point2)
        {
            TSM.Beam myBeam = new TSM.Beam(new TSG.Point(Point1), new TSG.Point(Point2));
            myBeam.StartPoint.Y = myBeam.StartPoint.Y - this.webHeight / 2.0;
            myBeam.EndPoint.Y   = myBeam.EndPoint.Y - this.webHeight / 2.0;

            string profileString = "PL" + this.flangeThickness.ToString() + "*" + this.flangeWidth.ToString();

            myBeam.Profile.ProfileString = profileString.Replace(",", ".");
            myBeam.Finish            = "PAINT";
            myBeam.Position.Depth    = TSM.Position.DepthEnum.MIDDLE;
            myBeam.Position.Plane    = TSM.Position.PlaneEnum.LEFT;
            myBeam.Position.Rotation = TSM.Position.RotationEnum.TOP;
            myBeam.Insert();
        }
Пример #12
0
        // Top Plate
        private void CreateTopFlangePlate(TSG.Point Point1, TSG.Point Point2)
        {
            TSM.Beam myBeam = new TSM.Beam(new TSG.Point(Point1), new TSG.Point(Point2));
            myBeam.StartPoint.Y = myBeam.StartPoint.Y + this.WebHeight / 2.0;
            myBeam.EndPoint.Y   = myBeam.EndPoint.Y + this.WebHeight / 2.0;

            string profileString = "PL" + this.FlangeThickness.ToString() + "*" + this.FlangeWidth.ToString();

            myBeam.Profile.ProfileString = profileString.Replace(",", ".");

            myBeam.Finish            = "PAINT";
            myBeam.Position.Depth    = TSM.Position.DepthEnum.MIDDLE;
            myBeam.Position.Plane    = TSM.Position.PlaneEnum.RIGHT;
            myBeam.Position.Rotation = TSM.Position.RotationEnum.BELOW;
            myBeam.Insert();
        }
Пример #13
0
        private void btn_createColumn_Click(object sender, EventArgs e)
        {
            // Column 객체 생성
            // 왜 Beam타입으로 생성하는가? Tekla에서는 모든 직선객체는 Beam타입으로 생성한다.
            // 부재의 Profile 과 StartPoint, EndPoint를 지정하여 부재를 생성하는 방식.
            TSM.Beam column = new TSM.Beam();

            column.StartPoint              = new TSG.Point(0, 0, 0);    // column 생성 시작지점
            column.EndPoint                = new TSG.Point(0, 0, 3000); // column 생성 끝지점
            column.Profile.ProfileString   = "400*400";                 // column 규격
            column.Material.MaterialString = "C40";                     // column 재질
            column.Class = "1";                                         // column 클래스 (캐드의 Layer와 같은 개념)

            column.Insert();                                            // 현재 켜져있는 Tekla 모델에 column 삽입

            model.CommitChanges();                                      // model의 변경사항을 커밋
        }
Пример #14
0
        private static void newObject(string fromModelCUP, double fromModelCOG_X, double fromModelCOG_Y, double fromModelCOG_Z)
        {
            TSM.Beam newObject = new TSM.Beam();

            newObject.Name = "COG for: " + fromModelCUP;
            newObject.Profile.ProfileString   = "D100";
            newObject.Material.MaterialString = "Z35";
            newObject.Class                 = "1000";
            newObject.PartNumber.Prefix     = "cg";
            newObject.AssemblyNumber.Prefix = "CG";
            newObject.StartPoint.X          = fromModelCOG_X;
            newObject.StartPoint.Y          = fromModelCOG_Y;
            newObject.StartPoint.Z          = fromModelCOG_Z;
            newObject.EndPoint.X            = fromModelCOG_X + 10000;
            newObject.EndPoint.Y            = fromModelCOG_Y;
            newObject.EndPoint.Z            = fromModelCOG_Z;
            newObject.Position.Rotation     = Position.RotationEnum.TOP;
            newObject.Position.Plane        = Position.PlaneEnum.MIDDLE;
            newObject.Position.Depth        = Position.DepthEnum.MIDDLE;

            newObject.Insert();
        }
Пример #15
0
        public override bool Run(List <InputDefinition> Input)
        {
            try
            {
                double Height = _data.height;

                TSG.Point StartPoint = (TSG.Point)Input[0].GetInput();

                TSG.Point EndPoint = new TSG.Point(StartPoint);
                EndPoint.Z += Height;

                TSM.Beam Column = new TSM.Beam(StartPoint, EndPoint);
                Column.Profile.ProfileString = "HEA400";

                Column.Insert();

                _model.CommitChanges();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return(true);
        }
Пример #16
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();
        }
Пример #17
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
            {
            }
        }
Пример #18
0
        private Part DrawStep(Point input, Vector shortEdge, double width, double length, string frameProfile, string floorProfile)
        {
            Vector zaxis           = new Vector(0, 0, -1);
            Vector longEdgeLeftDir = Vector.Cross(zaxis, shortEdge);

            longEdgeLeftDir = longEdgeLeftDir * (length / 2);
            Vector longEdgeRightDir = longEdgeLeftDir * (-1);

            shortEdge = shortEdge * width * (-1);

            Point leftEdgePt1 = new Point(input.X + longEdgeLeftDir.X, input.Y + longEdgeLeftDir.Y, input.Z + longEdgeLeftDir.Z);
            Point leftEdgePt2 = new Point(leftEdgePt1.X + shortEdge.X, leftEdgePt1.Y + shortEdge.Y, leftEdgePt1.Z + shortEdge.Z);

            Point rightEdgePt1 = new Point(input.X + longEdgeRightDir.X, input.Y + longEdgeRightDir.Y, input.Z + longEdgeRightDir.Z);
            Point rightEdgePt2 = new Point(rightEdgePt1.X + shortEdge.X, rightEdgePt1.Y + shortEdge.Y, rightEdgePt1.Z + shortEdge.Z);

            var floorBeam = new Beam(Beam.BeamTypeEnum.PANEL);

            floorBeam.Class                   = "1";
            floorBeam.Name                    = "Ступень";
            floorBeam.StartPoint              = leftEdgePt1;
            floorBeam.EndPoint                = rightEdgePt1;
            floorBeam.Position.Plane          = TSM.Position.PlaneEnum.LEFT;
            floorBeam.Position.Depth          = Position.DepthEnum.BEHIND;
            floorBeam.Position.Rotation       = TSM.Position.RotationEnum.BACK;
            floorBeam.Profile.ProfileString   = $"PL{width}*20";
            floorBeam.Material.MaterialString = "ПВ406";
            floorBeam.Finish                  = "PAINT";
            floorBeam.Insert();


            // для вычисления высоты выбранного профиля находим его систему координат (находится в центре)
            // и вычисляем разницу по Z точек вставки профиля и точки в системе координат профиля.
            var floorSolid = floorBeam.GetSolid();
            var thickness  = floorSolid.MaximumPoint.Z - floorSolid.MinimumPoint.Z;

            var    hprofile          = thickness; // GetHeightBeam(floorBeam, leftEdgePt1);
            Vector hOffsetVect       = zaxis * hprofile;
            Point  shiftLeftEdgePt1  = new Point(leftEdgePt1.X + hOffsetVect.X, leftEdgePt1.Y + hOffsetVect.Y, leftEdgePt1.Z + hOffsetVect.Z);
            Point  shiftLeftEdgePt2  = new Point(leftEdgePt2.X + hOffsetVect.X, leftEdgePt2.Y + hOffsetVect.Y, leftEdgePt2.Z + hOffsetVect.Z);
            Point  shiftRightEdgePt1 = new Point(rightEdgePt1.X + hOffsetVect.X, rightEdgePt1.Y + hOffsetVect.Y, rightEdgePt1.Z + hOffsetVect.Z);
            Point  shiftRightEdgePt2 = new Point(rightEdgePt2.X + hOffsetVect.X, rightEdgePt2.Y + hOffsetVect.Y, rightEdgePt2.Z + hOffsetVect.Z);

            leftStartPt  = shiftLeftEdgePt1;
            leftEndPt    = shiftLeftEdgePt2;
            rightStartPt = shiftRightEdgePt1;
            rightEndPt   = shiftRightEdgePt2;

            TSM.Beam leftshortBeam = new TSM.Beam(shiftLeftEdgePt1, shiftLeftEdgePt2);

            leftshortBeam.Class                   = "8";
            leftshortBeam.Name                    = "Ступень";
            leftshortBeam.Position.Plane          = TSM.Position.PlaneEnum.RIGHT;   // LEFT
            leftshortBeam.Position.Depth          = Position.DepthEnum.BEHIND;
            leftshortBeam.Position.Rotation       = TSM.Position.RotationEnum.BACK; // BELOW
            leftshortBeam.Profile.ProfileString   = StepFrameProfile;
            leftshortBeam.Material.MaterialString = "C245-4";
            leftshortBeam.Finish                  = "PAINT";
            leftshortBeam.Insert();

            TSM.Beam leftlongBeam = new TSM.Beam(shiftLeftEdgePt2, shiftRightEdgePt2);

            leftlongBeam.Class                   = "8";
            leftlongBeam.Name                    = "Ступень";
            leftlongBeam.Position.Plane          = TSM.Position.PlaneEnum.RIGHT;   // LEFT
            leftlongBeam.Position.Depth          = Position.DepthEnum.BEHIND;
            leftlongBeam.Position.Rotation       = TSM.Position.RotationEnum.BACK; // BELOW
            leftlongBeam.Profile.ProfileString   = StepFrameProfile;
            leftlongBeam.Material.MaterialString = "C245-4";
            leftlongBeam.Finish                  = "PAINT";
            leftlongBeam.Insert();


            TSM.Beam rightshortBeam = new TSM.Beam(shiftRightEdgePt2, shiftRightEdgePt1);

            rightshortBeam.Class                   = "8";
            rightshortBeam.Name                    = "Ступень";
            rightshortBeam.Position.Plane          = TSM.Position.PlaneEnum.RIGHT;
            rightshortBeam.Position.Depth          = Position.DepthEnum.BEHIND;
            rightshortBeam.Position.Rotation       = TSM.Position.RotationEnum.BACK;
            rightshortBeam.Profile.ProfileString   = StepFrameProfile;
            rightshortBeam.Material.MaterialString = "C245-4";
            rightshortBeam.Finish                  = "PAINT";
            rightshortBeam.Insert();


            TSM.Beam rightlongBeam = new TSM.Beam(shiftRightEdgePt1, shiftLeftEdgePt1);

            rightlongBeam.Class                   = "8";
            rightlongBeam.Name                    = "Ступень";
            rightlongBeam.Position.Plane          = TSM.Position.PlaneEnum.RIGHT;
            rightlongBeam.Position.Depth          = Position.DepthEnum.BEHIND;
            rightlongBeam.Position.Rotation       = TSM.Position.RotationEnum.BACK;
            rightlongBeam.Profile.ProfileString   = StepFrameProfile;
            rightlongBeam.Material.MaterialString = "C245-4";
            rightlongBeam.Finish                  = "PAINT";
            rightlongBeam.Insert();

            var stepAssy = floorBeam.GetAssembly();

            stepAssy.Add(leftshortBeam);
            stepAssy.Add(leftlongBeam);
            stepAssy.Add(rightshortBeam);
            stepAssy.Add(rightlongBeam);

            bool isStepAssy = stepAssy.Modify();

            return(floorBeam);
        }