Пример #1
0
        /// <summary>
        /// Function which computes all deviations for marks
        /// </summary>
        /// <param name="defMarks">List of deformation marks</param>
        /// <param name="bearMarks">List of bear marks</param>
        /// <param name="mL">mL deviation</param>
        /// <param name="mN">nm deviation</param>
        public void ComputeAllDeviations(List <DeformationMark> defMarks, List <Mark> bearMarks, double mL, double mN)
        {
            MathCalculating mc = new MathCalculating();

            Loop : for (int i = 0; i < defMarks.Count; i++)
            {
                for (int j = 0; j < bearMarks.Count; j++)
                {
                    double L = mc.PointDistance(defMarks[i].GetAllCoordinates(), bearMarks[j].GetAllCoordinates());
                    defMarks[i].SetDistance(bearMarks[j], L);

                    if (L == -1)
                    {
                        WinForms.MessageBox.Show("ERROR: Ошибка вычисления расстояний для марки " + defMarks[i].Name + ": результат меньше либо равен нулю\n", "Ошибка");
                        goto Loop;
                    }
                }

                try
                {
                    double mx = mc.XStandardDeviation(bearMarks[1].XCoordinate,
                                                      defMarks[i].GetDistance(bearMarks[1]),
                                                      defMarks[i].GetDistance(bearMarks[0]),
                                                      mL);
                    defMarks[i].Mx = Math.Round(mx, 3);
                    double my = mc.YStandardDeviation(bearMarks[2].YCoordinate,
                                                      defMarks[i].GetDistance(bearMarks[2]),
                                                      defMarks[i].GetDistance(bearMarks[0]),
                                                      mL,
                                                      bearMarks[2].XCoordinate,
                                                      mx);
                    defMarks[i].My = Math.Round(my, 3);
                    double mz = mc.ZStandardDeviation(defMarks[i].XCoordinate,
                                                      defMarks[i].YCoordinate,
                                                      defMarks[i].ZCoordinate,
                                                      mx,
                                                      defMarks[i].GetDistance(bearMarks[0]),
                                                      mL,
                                                      my);
                    defMarks[i].Mz = Math.Round(mz, 3);

                    double m = mc.GeneralErr(mx, my, mz);
                    defMarks[i].M = Math.Round(m, 3);
                    defMarks[i].DetermineStatus(mN);
                }
                catch (System.Exception)
                {
                    WinForms.MessageBox.Show("ERROR: Ошибка вычислений для марки " + defMarks[i].Name + "Ошибка");
                    throw;
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Funtion for finding coordinates of the point for each text from drawing
        /// </summary>
        /// <param name="point">Point primitive from draw</param>
        /// <param name="name">Text object from draw</param>
        /// <param name="ed">Current autocad editor</param>
        /// <returns></returns>
        public static bool ContainMarkAndName(Point3d point, DBText name, Editor ed)
        {
            Matrix3d mat       = ed.CurrentUserCoordinateSystem.Inverse();
            Point3d  wcsCoords = name.Position;
            Point3d  ucsCoords = wcsCoords.TransformBy(mat);

            double nameX = ucsCoords.X;
            double nameY = ucsCoords.Y;
            double nameZ = ucsCoords.Z;

            MathCalculating mc = new MathCalculating();

            if (mc.IsDoubleEqual(nameX, point.X, 0.00001) & mc.IsDoubleEqual(nameY, point.Y, 0.00001) & mc.IsDoubleEqual(nameZ, point.Z, 0.00001))
            {
                return(true);
            }
            return(false);
        }