/// <summary>
 /// 读取属性
 /// </summary>
 public static ElectrodeAllInfo GetAttribute(NXObject obj)
 {
     try
     {
         ElectrodeRemarksInfo     rem   = ElectrodeRemarksInfo.GetAttribute(obj);
         ElectrodeCAMInfo         cam   = ElectrodeCAMInfo.GetAttribute(obj);
         ElectrodeGapValueInfo    gap   = ElectrodeGapValueInfo.GetAttribute(obj);
         ElectrodePitchInfo       pitch = ElectrodePitchInfo.GetAttribute(obj);
         ElectrodePreparationInfo pre   = ElectrodePreparationInfo.GetAttribute(obj);
         ElectrodeSetValueInfo    sv    = ElectrodeSetValueInfo.GetAttribute(obj);
         ElectrodeNameInfo        name  = ElectrodeNameInfo.GetAttribute(obj);
         ElectrodeDatumInfo       da    = ElectrodeDatumInfo.GetAttribute(obj);
         return(new ElectrodeAllInfo()
         {
             Remarks = rem,
             CAM = cam,
             GapValue = gap,
             Pitch = pitch,
             Preparetion = pre,
             SetValue = sv,
             Name = name,
             Datum = da
         });
     }
     catch (NXException ex)
     {
         throw ex;
     }
 }
示例#2
0
        /// <summary>
        /// 通过行获取数据
        /// </summary>
        /// <param name="row"></param>
        public static ElectrodeCAMInfo GetInfoForDataRow(DataRow row)
        {
            ElectrodeCAMInfo info = new ElectrodeCAMInfo();

            for (int i = 0; i < row.Table.Columns.Count; i++)
            {
                try
                {
                    PropertyInfo propertyInfo = info.GetType().GetProperty(row.Table.Columns[i].ColumnName);
                    if (propertyInfo != null && row[i] != DBNull.Value)
                    {
                        propertyInfo.SetValue(info, row[i], null);
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            try
            {
                info.EleHeadDis[0] = Convert.ToInt32(row["EleHeadDis-X"]);
                info.EleHeadDis[1] = Convert.ToInt32(row["EleHeadDis-Y"]);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(info);
        }
示例#3
0
        /// <summary>
        ///创建行
        /// </summary>
        /// <param name="row"></param>
        public void CreateDataRow(ref DataRow row)
        {
            ElectrodeCAMInfo info = this.Clone() as ElectrodeCAMInfo;

            foreach (PropertyInfo propertyInfo in typeof(ElectrodeCAMInfo).GetProperties())
            {
                try
                {
                    row[propertyInfo.Name] = propertyInfo.GetValue(info, null);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            try
            {
                row["EleHeadDis-X"] = info.EleHeadDis[0];
                row["EleHeadDis-Y"] = info.EleHeadDis[1];
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#4
0
        /// <summary>
        /// 读取属性
        /// </summary>
        public static ElectrodeCAMInfo GetAttribute(NXObject obj)
        {
            ElectrodeCAMInfo info = new ElectrodeCAMInfo();

            try
            {
                info.EleMinDim   = AttributeUtils.GetAttrForDouble(obj, "EleMinDim");
                info.CamTemplate = AttributeUtils.GetAttrForString(obj, "CamTemplate");
                for (int i = 0; i < 2; i++)
                {
                    info.EleHeadDis[i] = AttributeUtils.GetAttrForDouble(obj, "EleHeadDis", i);
                }
                return(info);
            }
            catch (NXException ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// 创建表头
        /// </summary>
        /// <param name="table"></param>
        public static DataTable CreateDataTable()
        {
            try
            {
                DataTable table = new DataTable();
                ElectrodeCAMInfo.CreateDataTable(ref table);
                ElectrodeDatumInfo.CreateDataTable(ref table);
                ElectrodeGapValueInfo.CreateDataTable(ref table);
                ElectrodeNameInfo.CreateDataTable(ref table);

                ElectrodePitchInfo.CreateDataTable(ref table);
                ElectrodePreparationInfo.CreateDataTable(ref table);
                ElectrodeRemarksInfo.CreateDataTable(ref table);
                ElectrodeSetValueInfo.CreateDataTable(ref table);
                return(table);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 /// <summary>
 /// 通过行获取数据
 /// </summary>
 /// <param name="row"></param>
 public static ElectrodeAllInfo GetInfoForDataRow(DataRow row)
 {
     try
     {
         ElectrodeAllInfo info = new ElectrodeAllInfo()
         {
             CAM         = ElectrodeCAMInfo.GetInfoForDataRow(row),
             Datum       = ElectrodeDatumInfo.GetInfoForDataRow(row),
             GapValue    = ElectrodeGapValueInfo.GetInfoForDataRow(row),
             Name        = ElectrodeNameInfo.GetInfoForDataRow(row),
             Pitch       = ElectrodePitchInfo.GetInfoForDataRow(row),
             Preparetion = ElectrodePreparationInfo.GetInfoForDataRow(row),
             Remarks     = ElectrodeRemarksInfo.GetInfoForDataRow(row),
             SetValue    = ElectrodeSetValueInfo.GetInfoForDataRow(row)
         };
         return(info);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }