Exemplo n.º 1
0
 private bool WriteObjectToDataGrid(double[] PointData)
 {
     try
     {
         try
         {
             WriteObjectID(PointData, PointData, (index + "-A"));
         }
         catch (System.Exception)
         {
             //throw;
         }
         PointData = CadOprator.AixOprate(PointData, RefPoint, ApplyPlantAix.Checked);
         String Ttrack = string.Empty;
         if (SingeRoadSelected.Checked)
         {
             Ttrack = "SingerTrack";
         }
         else
         {
             Ttrack = "DoubleTrack";
         }
         int keepValuePoint = Convert.ToInt16(KeepValue.Text);
         DataRow               = datatable.NewRow();
         DataRow["序号"]         = index + "-" + "0";
         DataRow["X坐标"]        = Math.Round(PointData[0], keepValuePoint);
         DataRow["Y坐标"]        = Math.Round(PointData[1], keepValuePoint);
         DataRow["Z坐标"]        = Math.Round(PointData[2], keepValuePoint);
         DataRow["Radius"]     = 0;
         DataRow["CenterX"]    = 0;
         DataRow["CenterY"]    = 0;
         DataRow["CenterZ"]    = 0;
         DataRow["StartAngle"] = 0;
         DataRow["EndAngle"]   = 0;
         DataRow["FwAngle"]    = 0;
         DataRow["TrackType"]  = Ttrack;
         datatable.Rows.Add(DataRow);
         dataview            = new DataView(datatable);
         DataGrid.DataSource = dataview;
         DataGrid.Update();
         index += 1;
         return(true);
     }
     catch (System.Exception)
     {
         return(false);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 通过从CAD返回的点坐标进行Form中的添加及更新操作
        /// </summary>
        /// <param name="point">获取的点</param>
        /// <param name="BEP">起始点为A 结束点为B</param>
        private void OprateFormData(RxTypeList.AcDbArc arc)
        {
            if (SX_AIX.Text == string.Empty || SY_AIX.Text == string.Empty)
            {
                MessageBox.Show("未初始化参考坐标!请先初始化参考坐标系!");
                return;
            }
            int keepValuePoint = Convert.ToInt16(KeepValue.Text);

            double[] StartPoint = CadOprator.TackAix(arc.StartPoint, RefPoint, ApplyPlantAix.Checked);
            double[] EndPoint   = CadOprator.TackAix(arc.EndPoint, RefPoint, ApplyPlantAix.Checked);
            double[] TCenter    = CadOprator.TackAix(arc.Center, RefPoint, ApplyPlantAix.Checked);
            double   Radius     = Math.Round(arc.Radius / 1000 * 20, keepValuePoint);
            double   StartAngle = Math.Round(arc.StartAngle, keepValuePoint);
            double   EndAngle   = Math.Round(arc.EndAngle, keepValuePoint);
            String   Ttrack     = string.Empty;

            if (SingeRoadSelected.Checked)
            {
                Ttrack = "SingerTrack";
            }
            else
            {
                Ttrack = "DoubleTrack";
            }
            if (WriteObjectToDataGrid(StartPoint, TCenter, Radius, StartAngle, EndAngle, "A", Ttrack))
            {
                if (WriteObjectToDataGrid(EndPoint, 0, "B", Ttrack))
                {
                    ///////////////////////////////////////////////////////
                }
            }
            try
            {
                WriteObjectID(arc.StartPoint, arc.EndPoint, (index + "-A"));
            }
            catch (System.Exception)
            {
                //throw;
            }

            index += 1;
        }
Exemplo n.º 3
0
        /// <summary>
        /// 通过从CAD返回的点坐标进行Form中的添加及更新操作
        /// </summary>
        /// <param name="point">获取的点</param>
        /// <param name="BEP">起始点为A 结束点为B</param>
        /// <param name="Line"></param>
        private void OprateFormData(RxTypeList.AcadLine Line)
        {
            if (SX_AIX.Text == string.Empty || SY_AIX.Text == string.Empty)
            {
                MessageBox.Show("未初始化参考坐标!请先初始化参考坐标系!");
                return;
            }
            double[] StartPoint = CadOprator.TackAix(Line.StartPoint, RefPoint, ApplyPlantAix.Checked);
            double[] EndPoint   = CadOprator.TackAix(Line.EndPoint, RefPoint, ApplyPlantAix.Checked);
            String   Ttrack     = string.Empty;

            if (SingeRoadSelected.Checked)
            {
                Ttrack = "SingerTrack";
            }
            else
            {
                Ttrack = "DoubleTrack";
            }
            if (WriteObjectToDataGrid(StartPoint, Line.FwAngle, "A", Ttrack))
            {
                if (WriteObjectToDataGrid(EndPoint, 0, "B", Ttrack))
                {
                    ///////////////////////////////////////////////////////
                }
            }
            try
            {
                WriteObjectID(Line.StartPoint, Line.EndPoint, (index + "-A"));
            }
            catch (System.Exception)
            {
                //throw;
            }
            index += 1;
        }