Beispiel #1
0
        public void get_circle_center(PolyBeam main_part, out t3d.Point center, out double radius)
        {
            model.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane());
            CoordinateSystem mainPart_coordinat = main_part.GetCoordinateSystem();

            if (main_part.Position.Rotation == Position.RotationEnum.BACK || main_part.Position.Rotation == Position.RotationEnum.FRONT)
            {
                mainPart_coordinat.AxisY = mainPart_coordinat.AxisX.Cross(mainPart_coordinat.AxisY);
            }

            model.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane(mainPart_coordinat));
            ArrayList points = main_part.GetCenterLine(true);

            //  getCircleCenter(points[0] as t3d.Point, points[points.Count-1] as t3d.Point, points[(int)(points.Count/2)] as t3d.Point,out a,out b,out c);
            t3d.Point point_1 = points[(int)(points.Count / 2) - 1] as t3d.Point;
            t3d.Point point_2 = points[(int)(points.Count / 2)] as t3d.Point;
            t3d.Point point_3 = points[((int)(points.Count / 2) + 1)] as t3d.Point;
            Line      _1_line = new Line(point_1, point_2);
            Line      _2_line = new Line(point_3, point_2);

            t3d.Point  mid_of_1line = new t3d.Point((point_1.X + point_2.X) / 2, (point_1.Y + point_2.Y) / 2, (point_1.Z + point_2.Z) / 2);
            t3d.Point  mid_of_2line = new t3d.Point((point_3.X + point_2.X) / 2, (point_3.Y + point_2.Y) / 2, (point_3.Z + point_2.Z) / 2);
            t3d.Vector fist_vector  = new Vector(_1_line.Direction);
            t3d.Vector scnd_vector  = new Vector(_2_line.Direction);

            t3d.Line    first_intersected_line = new Line(mid_of_1line, fist_vector.Cross(new t3d.Vector(0, 0, 1)));
            t3d.Line    sec_intersected_line   = new Line(mid_of_2line, scnd_vector.Cross(new t3d.Vector(0, 0, 1)));
            LineSegment final = Intersection.LineToLine(first_intersected_line, sec_intersected_line);

            // radius
            radius = Math.Sqrt(Math.Pow(point_1.X - final.Point1.X, 2) + Math.Pow(point_1.Y - final.Point1.Y, 2));
            center = final.Point1;
        }
        private static void createRectangles(List <TSD.Rectangle> input, List <TSD.Rectangle> output, TSD.ViewBase inputView, TSD.ViewBase outputView)
        {
            foreach (TSD.Rectangle inputRectangle in input)
            {
                T3D.Point startPoint = __GeometryOperations.applyGlobalOffset(inputRectangle.StartPoint);
                T3D.Point endPoint   = __GeometryOperations.applyGlobalOffset(inputRectangle.EndPoint);

                bool found = false;
                foreach (TSD.Rectangle outputLine in output)
                {
                    if (outputLine.StartPoint == startPoint && outputLine.EndPoint == endPoint)
                    {
                        found = true;
                        break;
                    }
                    else if (outputLine.StartPoint == endPoint && outputLine.EndPoint == startPoint)
                    {
                        found = true;
                        break;
                    }
                }

                if (found == false)
                {
                    TSD.Rectangle outputLine = new TSD.Rectangle(outputView, startPoint, endPoint, inputRectangle.Attributes);
                    outputLine.Attributes = inputRectangle.Attributes;
                    outputLine.Insert();
                }
            }
        }
Beispiel #3
0
        //Shows the beam's extremes in the coordinates of the reference model object
        private void ShowExtremesInOtherObjectCoordinates(ModelObject ReferenceObject, Beam Beam)
        {
            //Set the transformation plane to use the beam's coordinate system in order to get the beam's extremes in the local coordinate system
            TransformationPlane CurrentTP = _Model.GetWorkPlaneHandler().GetCurrentTransformationPlane();

            _Model.GetWorkPlaneHandler().SetCurrentTransformationPlane(new TransformationPlane(Beam.GetCoordinateSystem()));

            //Update the beam's extremes to the new transformation plane
            Beam.Select();
            T3D.Point LocalStartPoint = Beam.StartPoint;
            T3D.Point LocalEndPoint   = Beam.EndPoint;

            //Get the beam's extremes in the reference object's coordinates
            Matrix TransformationMatrix = MatrixFactory.ByCoordinateSystems(Beam.GetCoordinateSystem(), ReferenceObject.GetCoordinateSystem());

            //Transform the extreme points to the new coordinate system
            T3D.Point BeamStartPoint = TransformationMatrix.Transform(LocalStartPoint);
            T3D.Point BeamEndPoint   = TransformationMatrix.Transform(LocalEndPoint);

            _Model.GetWorkPlaneHandler().SetCurrentTransformationPlane(CurrentTP);

            //Transform the points where to show the texts to current work plane coordinate system
            Matrix TransformationToCurrent = MatrixFactory.FromCoordinateSystem(ReferenceObject.GetCoordinateSystem());

            T3D.Point BeamStartPointInCurrent = TransformationToCurrent.Transform(BeamStartPoint);
            T3D.Point BeamEndPointInCurrent   = TransformationToCurrent.Transform(BeamEndPoint);

            //Display results
            DrawCoordinateSytem(ReferenceObject.GetCoordinateSystem());
            GraphicsDrawer.DrawText(BeamStartPointInCurrent, FormatPointCoordinates(BeamStartPoint), TextColor);
            GraphicsDrawer.DrawText(BeamEndPointInCurrent, FormatPointCoordinates(BeamEndPoint), TextColor);
        }
Beispiel #4
0
        public static SingleRebar createBarraLongitudinal(T3D.Point p1, T3D.Point p2, double diametro)
        {
            SingleRebar rebar = crearBarra(p1, p2, diametro);

            rebar.Name = "BARRA_VIGUETA";
            return(rebar);
        }
        private static void createDetailMarks(List <TSD.DetailMark> input, List <TSD.DetailMark> output, TSD.View outputView)
        {
            foreach (TSD.DetailMark inputDetail in input)
            {
                T3D.Point centerPoint   = __GeometryOperations.applyGlobalOffset(inputDetail.CenterPoint);
                T3D.Point boundaryPoint = __GeometryOperations.applyGlobalOffset(inputDetail.BoundaryPoint);
                T3D.Point labelPoint    = __GeometryOperations.applyGlobalOffset(inputDetail.LabelPoint);

                bool found = false;
                foreach (TSD.DetailMark outputDetailMark in output)
                {
                    if (outputDetailMark.CenterPoint == centerPoint &&
                        outputDetailMark.BoundaryPoint == boundaryPoint &&
                        outputDetailMark.LabelPoint == labelPoint)
                    {
                        found = true;
                        break;
                    }
                }

                if (found == false)
                {
                    TSD.DetailMark outputDetailMark = new TSD.DetailMark(outputView, centerPoint, boundaryPoint, labelPoint);
                    outputDetailMark.Attributes = inputDetail.Attributes;
                    outputDetailMark.Insert();
                }
            }
        }
        public override bool Run()
        {
            try
            {
                GetValuesFromDialog();

                TSG.Point Point1       = (TSG.Point) this.Positions[0];
                TSG.Point Point2       = (TSG.Point) this.Positions[1];
                TSG.Point lengthVector = new TSG.Point(Point2.X - Point1.X, Point2.Y - Point1.Y, Point2.Z - Point1.Z);

                if (this.lengthFactor > 0)
                {
                    Point2.X = this.lengthFactor * lengthVector.X + Point1.X;
                    Point2.Y = this.lengthFactor * lengthVector.Y + Point1.Y;
                    Point2.Z = this.lengthFactor * lengthVector.Z + Point1.Z;
                }

                CreateTaperedBeam(Point1, Point2);
            }
            catch (Exception Ex)
            {
                TSM.Operations.Operation.DisplayPrompt(Ex.Message);
            }

            return(true);
        }
Beispiel #7
0
        private Tuple <TSG.Point, TSDrg.View> GetPointViewFromUser()
        {
            TSDrg.DrawingHandler myDrawingHandler = new TSDrg.DrawingHandler();
            TSDrg.UI.Picker      pointPicker      = myDrawingHandler.GetPicker();
            TSG.Point            myPoint          = null;
            TSDrg.ViewBase       myViewBase       = null;
            TSDrg.View           myView           = myViewBase as TSDrg.View;

            try
            {
                pointPicker.PickPoint("Pick a point to insert dimesnion", out myPoint, out myViewBase);
                myView = myViewBase as TSDrg.View;

                while (myView == null)
                {
                    pointPicker.PickPoint("Selected point is not inside a view. Pick a point to insert dimension", out myPoint, out myViewBase);
                    myView = myViewBase as TSDrg.View;
                }

                return(new Tuple <TSG.Point, TSDrg.View>(myPoint, myView));
            }

            catch (Tekla.Structures.Drawing.PickerInterruptedException interrupted)
            {
                //Tekla.Structures.Model.Operations.Operation.DisplayPrompt("THIS METHOD NOT WORKING BECAUSE TEKLA API IS THE WORST THING I HAVE EVER WORKED WITH");
                lbl_status.Text = "User interrupted action.";
                return(new Tuple <TSG.Point, TSDrg.View>(myPoint, myView));
            }
        }
Beispiel #8
0
 private void addUniquePoints(T3D.Point point)
 {
     if (!_points.Contains(point))
     {
         _points.Add(point);
     }
 }
Beispiel #9
0
        public override bool Run(List <InputDefinition> Input)
        {
            try
            {
                GetValuesFromDialog();

                TSG.Point Point1       = (TSG.Point)(Input[0]).GetInput();
                TSG.Point Point2       = (TSG.Point)(Input[1]).GetInput();
                TSG.Point LengthVector = new TSG.Point(Point2.X - Point1.X, Point2.Y - Point1.Y, Point2.Z - Point1.Z);

                if (_LengthFactor > 0)
                {
                    Point2.X = _LengthFactor * LengthVector.X + Point1.X;
                    Point2.Y = _LengthFactor * LengthVector.Y + Point1.Y;
                    Point2.Z = _LengthFactor * LengthVector.Z + Point1.Z;
                }
                CreateBeam(Point1, Point2);
            }
            catch (Exception Ex)
            {
                Console.WriteLine("Exception : " + Ex.ToString());
            }

            return(true);
        }
Beispiel #10
0
        public TSM.Beam BeamFirst(TSG.Point pointFirst, TSG.Point pointSecond)
        {
            TSM.Beam beam = new TSM.Beam();
            beam.StartPoint = pointFirst;
            beam.EndPoint   = pointSecond;
            if (tb_profileBeams.Text != string.Empty)
            {
                beam.Profile.ProfileString = tb_profileBeams.Text;
            }
            else
            {
                beam.Profile.ProfileString = "HEA300";
            }

            if (tb_materialBeams.Text != string.Empty)
            {
                beam.Material.MaterialString = tb_materialBeams.Text;
            }
            else
            {
                beam.Material.MaterialString = "S235";
            }
            beam.Class          = "3";
            beam.Position.Depth = TSM.Position.DepthEnum.MIDDLE;
            if (tb_nameBeams.Text != string.Empty)
            {
                beam.Name = tb_nameBeams.Text;
            }
            else
            {
                beam.Name = "Beam";
            }

            return(beam);
        }
Beispiel #11
0
        public TSM.ContourPlate PlateFirst(double width, double height, double offset)
        {
            TSM.ContourPlate plate = new TSM.ContourPlate();

            //inicialize input points
            TSG.Point p1 = new TSG.Point(width / 2, height / 2, 0);
            TSG.Point p2 = new TSG.Point(width / 2, -height / 2, 0);
            TSG.Point p3 = new TSG.Point(-width / 2, -height / 2, 0);
            TSG.Point p4 = new TSG.Point(-width / 2, height / 2, 0);

            //set contour points
            plate.AddContourPoint(new TSM.ContourPoint(p1, null));
            plate.AddContourPoint(new TSM.ContourPoint(p2, null));
            plate.AddContourPoint(new TSM.ContourPoint(p3, null));
            plate.AddContourPoint(new TSM.ContourPoint(p4, null));
            plate.Profile.ProfileString = "PL" + offset;
            if (tb_materialPlates.Text != string.Empty)
            {
                plate.Material.MaterialString = tb_materialPlates.Text;
            }
            else
            {
                plate.Material.MaterialString = "S235";
            }
            if (tb_namePlates.Text != string.Empty)
            {
                plate.Name = tb_namePlates.Text;
            }
            else
            {
                plate.Name = "Plate";
            }
            return(plate);
        }
        /// <summary>
        /// Method for modeling angle
        /// </summary>
        /// <param name="firstPoint"></param>
        /// <param name="secondPoint"></param>
        /// <param name="beamProfile"></param>
        /// <param name="isSecondAngle"></param>
        public void ModelAngle(T3D.Point firstPoint, T3D.Point secondPoint, string beamProfile, bool isSecondAngle)
        {
            try
            {
                // assign start and finish point to beam
                base.classBeam.StartPoint = firstPoint;
                base.classBeam.EndPoint   = secondPoint;

                // set parameters for beam
                base.setProfile(beamProfile);


                base.insertBeam();  // insert beam into model

                base.updateModel(); // commit changes to model
            }
            catch
            {
                // set pickedpoints to null
                firstPoint  = null;
                secondPoint = null;

                // read error message to user
                MessageBox.Show("No points were picked");
            }
        }
Beispiel #13
0
 private static void swapBeam(TSM.Beam part)
 {
     T3D.Point startPoint = part.StartPoint;
     T3D.Point endPoint   = part.EndPoint;
     part.StartPoint = endPoint;
     part.EndPoint   = startPoint;
 }
Beispiel #14
0
        public BoltArray insert_hole(PolyBeam mainPart, t3d.Point point1, t3d.Point point2, double size, double angle)
        {
            BoltArray hole = new BoltArray();

            hole.PartToBeBolted          = mainPart;
            hole.PartToBoltTo            = mainPart;
            hole.FirstPosition           = point1;
            hole.SecondPosition          = point2;
            hole.Position.Rotation       = Position.RotationEnum.BACK;
            hole.Position.RotationOffset = angle;
            hole.Position.Rotation       = Position.RotationEnum.BACK;
            hole.Position.Depth          = Position.DepthEnum.MIDDLE;
            hole.Position.Plane          = Position.PlaneEnum.MIDDLE;
            hole.AddBoltDistX(0);
            hole.AddBoltDistY(0);
            hole.Tolerance = 0;
            hole.BoltSize  = size;

            hole.Hole1   = false;
            hole.Hole2   = false;
            hole.Hole3   = false;
            hole.Hole4   = false;
            hole.Hole5   = false;
            hole.Washer1 = false;
            hole.Washer2 = false;
            hole.Washer3 = false;
            hole.Nut1    = false;
            hole.Nut2    = false;

            hole.Insert();
            return(hole);
        }
        public void CK06_Pick2Points()
        {
            T3D.Point FirstPoint  = null;
            T3D.Point SecondPoint = null;
            Picker    Picker      = new Picker();

            try
            {
                ArrayList PickPoints = Picker.PickPoints(Picker.PickPointEnum.PICK_TWO_POINTS);
                FirstPoint  = PickPoints[0] as T3D.Point;
                SecondPoint = PickPoints[1] as T3D.Point;
            }
            catch { FirstPoint = SecondPoint = null; }

            if (FirstPoint != null && SecondPoint != null)
            {
                T3D.Vector XVector = new T3D.Vector(SecondPoint.X - FirstPoint.X,
                                                    SecondPoint.Y - FirstPoint.Y, SecondPoint.Z - FirstPoint.Z);
                T3D.Vector YVector = XVector.Cross(new T3D.Vector(0, 0, -1));
                Model.GetWorkPlaneHandler()
                .SetCurrentTransformationPlane(new TransformationPlane(FirstPoint
                                                                       , XVector, YVector));
                ViewHandler.SetRepresentation("standard"); //PKh> should be add for Tekla-2018
                Model.CommitChanges();
                mw.Msg("Появляется рисунок осей X и Y ПСК, ось X в направлении от точки 1 к точке 2");
                MessageBox.Show("вывел ПСК");
                mw.Msg();
            }
        }
Beispiel #16
0
        /// <summary>Checks intersection between two line segments. Line segments are fragments of lines with start and end point.</summary>
        /// <param name="lineSegment1"></param>
        /// <param name="lineSegment2"></param>
        /// <param name="intersectionPoint">The point on the first or second line segment.</param>
        /// <returns>Return true if lines intersects and if point is on the linesegments.</returns>
        public static bool LineSegmentToLineSegment(T3D.LineSegment lineSegment1, T3D.LineSegment lineSegment2, out T3D.Point intersectionPoint)
        {
            intersectionPoint = new T3D.Point();
            if (lineSegment1 == null | lineSegment2 == null)
            {
                return(false);
            }
            var line1 = new T3D.Line(lineSegment1);
            var line2 = new T3D.Line(lineSegment2);
            var intersectionLineSegment = T3D.Intersection.LineToLine(line1, line2);

            if (intersectionLineSegment == null)
            {
                return(false);
            }

            intersectionPoint = T3D.Projection.PointToLine(intersectionLineSegment.Point1, line1);
            if (!IsThePointOnTheLineSegment(lineSegment1, intersectionPoint))
            {
                return(false);
            }

            intersectionPoint = T3D.Projection.PointToLine(intersectionLineSegment.Point1, line2);
            if (!IsThePointOnTheLineSegment(lineSegment2, intersectionPoint))
            {
                return(false);
            }

            return(true);
        }
        public void CK06_ByPickPart()
        {
            ModelObject PickedObject = null;
            Picker      Picker       = new Picker();

            try
            {
                PickedObject = Picker.PickObject(Picker.PickObjectEnum.PICK_ONE_OBJECT);
            }
            catch { PickedObject = null; }

            if (PickedObject != null)
            {
                T3D.CoordinateSystem ObjectSystem = PickedObject.GetCoordinateSystem();
                Model.GetWorkPlaneHandler()
                .SetCurrentTransformationPlane(new TransformationPlane(ObjectSystem));

                double StartX = 500;
                for (int i = 0; i < 7; i++)
                {
                    T3D.Point p1 = new T3D.Point(StartX, 0);
                    T3D.Point p2 = new T3D.Point(StartX, 0, 1000);
                    CreateBeam("test Beam", "I30B1_20_93", p1, p2);
                    StartX += 500;
                }
                ViewHandler.SetRepresentation("standard"); //PKh> should be add for Tekla-2018
                Model.CommitChanges();
            }
            mw.Msg("Изображение ПСК теперь на стартовой точке - на желтой ручке балки:"
                   + " Х по опорной линии, Y вверх. Перпендикулярно балке создано"
                   + " 7 дополнительных отрезков другого цвета.  [OK]");
            MessageBox.Show("вывел ПСК и 7 перпендикулярных дополнительных балок");
            mw.Msg();
        }
Beispiel #18
0
        private T findClosestMark <T>(List <T> others) where T : _Mark
        {
            T      match = null;
            double min   = double.MaxValue;

            foreach (T other in others)
            {
                T3D.Point inputStart = __GeometryOperations.factor1Point((other._part as TSM.Beam).StartPoint, other._view as TSD.View);
                inputStart = __GeometryOperations.applyGlobalOffset(inputStart);
                T3D.Point inputEnd = __GeometryOperations.factor1Point((other._part as TSM.Beam).EndPoint, other._view as TSD.View);
                inputEnd = __GeometryOperations.applyGlobalOffset(inputEnd);

                T3D.Point outputStart = __GeometryOperations.factor1Point((this._part as TSM.Beam).StartPoint, this._view as TSD.View);
                T3D.Point outputEnd   = __GeometryOperations.factor1Point((this._part as TSM.Beam).EndPoint, this._view as TSD.View);

                double dist = 0;
                dist += __GeometryOperations.getLength(inputStart, outputStart);
                dist += __GeometryOperations.getLength(inputEnd, outputEnd);

                if (dist < min)
                {
                    match = other;
                    min   = dist;
                }
            }

            return(match);
        }
Beispiel #19
0
 private void moveDim(TSDrg.StraightDimension line, TSG.Point startPoint, TSG.Point endPoint)
 {
     line.Select();
     line.StartPoint = startPoint;
     line.EndPoint   = endPoint;
     line.Modify();
 }
Beispiel #20
0
        double GetAngle(TSG.Point point)
        {
            double ang = 0;

            if (point.Y == 0 && point.X > 0)
            {
                return(0);
            }
            if (point.Y == 0 && point.X < 0)
            {
                return(Math.PI / 2);
            }
            if (point.X >= 0 && point.Y > 0)
            {
                return(Math.Atan(point.Y / point.X));
            }
            if (point.X >= 0 && point.Y < 0)
            {
                return(Math.PI * 2 - Math.Abs(Math.Atan(point.Y / point.X)));
            }
            if (point.X < 0 && point.Y < 0)
            {
                return(Math.PI + Math.Abs(Math.Atan(point.Y / point.X)));
            }
            if (point.X < 0 && point.Y < 0)
            {
                return(Math.PI - Math.Abs(Math.Atan(point.Y / point.X)));
            }

            return(ang);
        }
Beispiel #21
0
        public static SingleRebar createDiagonal(T3D.Point p1, T3D.Point p2, double diametro)
        {
            SingleRebar rebar = crearBarra(p1, p2, diametro);

            rebar.Name = "DIAGONAL";
            return(rebar);
        }
        private static void getPoint(__DrawingData drawing)
        {
            TSD.DrawingHandler drawingHandler = new TSD.DrawingHandler();

            if (drawingHandler.GetConnectionStatus())
            {
                TSD.ContainerView sheet = drawingHandler.GetActiveDrawing().GetSheet();

                TSD.UI.Picker picker       = drawingHandler.GetPicker();
                T3D.Point     viewPoint    = null;
                TSD.ViewBase  selectedView = null;

                MainForm._form.add_text("Select origin point in drawing view");
                picker.PickPoint("Pick one point", out viewPoint, out selectedView);
                T3D.Point sheetPoint = TSD.Tools.DrawingCoordinateConverter.Convert(selectedView, sheet, viewPoint);

                if (selectedView != null)
                {
                    if (selectedView is TSD.View)
                    {
                        drawing.setView(selectedView as TSD.View);
                    }
                }

                drawing.setSheet(sheet);
                drawing.setPoints(viewPoint, sheetPoint);
            }
        }
        private static void createSectionMarks(List <_SectionMark> input, List <_SectionMark> output, TSD.View outputView)
        {
            foreach (_SectionMark inputSection in input)
            {
                T3D.Point leftPoint  = __GeometryOperations.applyGlobalOffset(inputSection._obj.LeftPoint);
                T3D.Point rightPoint = __GeometryOperations.applyGlobalOffset(inputSection._obj.RightPoint);

                bool found = false;
                foreach (_SectionMark outputSectionMark in output)
                {
                    if (outputSectionMark._obj.LeftPoint == leftPoint &&
                        outputSectionMark._obj.RightPoint == rightPoint)
                    {
                        found = true;
                        break;
                    }
                }

                if (found == false)
                {
                    TSD.SectionMark outputSectionMark = new TSD.SectionMark(outputView, leftPoint, rightPoint);
                    outputSectionMark.Attributes = inputSection._obj.Attributes;

                    //if (inputSection._txt != null)
                    //{
                    //    outputSectionMark.Attributes.TagsAttributes.TagA2.TagContent.Clear();
                    //    outputSectionMark.Attributes.TagsAttributes.TagA2.TagContent.Add(inputSection._txt);
                    //    outputSectionMark.Modify();
                    //}

                    outputSectionMark.Insert();
                }
            }
        }
Beispiel #24
0
        private static void DrawMesh(Plane plane)
        {
            GraphicsDrawer graphicsDrawer = new GraphicsDrawer();

            Mesh  mesh   = new Mesh();
            Point Point1 = new Point(plane.Origin);

            Vector NormalX = plane.AxisX.GetNormal() * 300;

            Point Point2 = new Point(plane.Origin);

            Point2.Translate(NormalX.X, NormalX.Y, NormalX.Z);

            Vector NormalY = plane.AxisY.GetNormal() * 300;

            Point Point3 = new Point(plane.Origin);

            Point3.Translate(NormalY.X, NormalY.Y, NormalY.Z);

            Point Point4 = new Point(Point2);

            Point4.Translate(NormalY.X, NormalY.Y, NormalY.Z);

            mesh.AddPoint(Point1);
            mesh.AddPoint(Point2);
            mesh.AddPoint(Point3);
            mesh.AddPoint(Point4);

            mesh.AddTriangle(0, 1, 2);
            mesh.AddTriangle(2, 1, 0);
            mesh.AddTriangle(1, 2, 3);
            mesh.AddTriangle(3, 2, 1);

            graphicsDrawer.DrawMeshSurface(mesh, new Color(1, 0, 0));
        }
        private static void createText(List <TSD.Text> input, List <TSD.Text> output, __ViewBaseData inputData, __ViewBaseData outputData)
        {
            foreach (TSD.Text inputText in input)
            {
                T3D.Point insertionPoint = __GeometryOperations.applyGlobalOffset(inputText.InsertionPoint);

                bool found = false;

                //foreach (TSD.Text outputText in output)
                //{
                //    if (outputText.InsertionPoint == insertionPoint && outputText.TextString == inputText.TextString)
                //    {
                //        found = true;
                //        break;
                //    }
                //}

                if (found == false)
                {
                    TSD.Text outputText = new TSD.Text(outputData.view, insertionPoint, inputText.TextString);
                    outputText.Placing    = inputText.Placing;
                    outputText.Attributes = inputText.Attributes;
                    outputText.Insert();
                }
            }
        }
Beispiel #26
0
        internal static bool ArePointAligned(Point Point1, Point Point2, Point Point3)
        {
            Vector Vector1 = new Vector(Point2.X - Point1.X, Point2.Y - Point1.Y, Point2.Z - Point1.Z);
            Vector Vector2 = new Vector(Point3.X - Point1.X, Point3.Y - Point3.Y, Point3.Z - Point1.Z);

            return(Parallel.VectorToVector(Vector1, Vector2));
        }
        private static void createLinesNoOffset(List <TSD.Line> input, List <TSD.Line> output, TSD.ViewBase inputView, TSD.ViewBase outputView)
        {
            foreach (TSD.Line inputLine in input)
            {
                T3D.Point startPoint = inputLine.StartPoint;
                T3D.Point endPoint   = inputLine.EndPoint;

                bool found = false;
                foreach (TSD.Line outputLine in output)
                {
                    if (outputLine.StartPoint == startPoint && outputLine.EndPoint == endPoint)
                    {
                        found = true;
                        break;
                    }
                }

                if (found == false)
                {
                    TSD.Line outputLine = new TSD.Line(outputView, startPoint, endPoint, inputLine.Attributes);
                    outputLine.Attributes = inputLine.Attributes;
                    outputLine.Insert();
                }
            }
        }
Beispiel #28
0
        ContourPlate CreateConturePlate(TSG.Point point)
        {
            double x = 300;
            double y = 300;

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

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

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

            return(CP);
        }
Beispiel #29
0
        //Draws the vector of the coordinate system
        private static void DrawVector(T3D.Point StartPoint, T3D.Vector Vector, string Text)
        {
            Color        Color   = new Color(0, 1, 1);
            const double Radians = 0.43;

            Vector = Vector.GetNormal();
            T3D.Vector Arrow01 = new T3D.Vector(Vector);

            Vector.Normalize(500);
            T3D.Point EndPoint = new T3D.Point(StartPoint);
            EndPoint.Translate(Vector.X, Vector.Y, Vector.Z);
            GraphicsDrawer.DrawLineSegment(StartPoint, EndPoint, Color);

            GraphicsDrawer.DrawText(EndPoint, Text, Color);

            Arrow01.Normalize(-100);
            T3D.Vector Arrow = ArrowVector(Arrow01, Radians);

            T3D.Point ArrowExtreme = new T3D.Point(EndPoint);
            ArrowExtreme.Translate(Arrow.X, Arrow.Y, Arrow.Z);
            GraphicsDrawer.DrawLineSegment(EndPoint, ArrowExtreme, Color);

            Arrow = ArrowVector(Arrow01, -Radians);

            ArrowExtreme = new T3D.Point(EndPoint);
            ArrowExtreme.Translate(Arrow.X, Arrow.Y, Arrow.Z);
            GraphicsDrawer.DrawLineSegment(EndPoint, ArrowExtreme, Color);
        }
        public static T3D.Point applyGlobalOffset(T3D.Point input)
        {
            if (__GeometryOperations.viewInputPoint != null && __GeometryOperations.viewOutputPoint != null)
            {
                T3D.Point a = __GeometryOperations.viewInputPoint;
                T3D.Point b = __GeometryOperations.viewOutputPoint;

                double cs = Math.Cos(Math.PI * UserProperties._dR / 180);
                double sn = Math.Sin(Math.PI * UserProperties._dR / 180);

                double dX = b.X - a.X;
                double dY = b.Y - a.Y;

                double iX = input.X - a.X;
                double iY = input.Y - a.Y;

                double X = (iX * cs) - (iY * sn) + a.X + dX;
                double Y = (iX * sn) + (iY * cs) + a.Y + dY;

                T3D.Point tr = new T3D.Point(X, Y, 0);

                return(tr);
            }

            else
            {
                return(input);
            }
        }