258 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			258 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| using System;
 | |
| using System.Collections.Generic;
 | |
| using System.Linq;
 | |
| using System.Text;
 | |
| using System.Drawing;
 | |
| using System.ComponentModel;
 | |
| 
 | |
| namespace Project
 | |
| {
 | |
|    
 | |
|     public class ModelInfoV
 | |
|     {
 | |
|         [Browsable(false)]
 | |
|         public string SPN { get; set; }
 | |
|         //[Browsable(false)]
 | |
|         //public Boolean SplitSPN { get; set; }
 | |
|         [Browsable(false)]
 | |
|         public string Title { get; set; }
 | |
|         [Browsable(false)]
 | |
|         public int idx { get; set; }
 | |
| 
 | |
|         [Browsable(false)]
 | |
|         public Rectangle Roi_UnitArea { get; set; }
 | |
|         [Browsable(false)]
 | |
|         public Rectangle Roi_Orient { get; set; }
 | |
|         [Browsable(false)]
 | |
|         public Rectangle Roi_TrayDetect { get; set; }
 | |
|         [Browsable(false)]
 | |
|         public Rectangle Roi_DMDetect { get; set; }
 | |
|         [Browsable(false)]
 | |
|         public Rectangle Roi_DataMatrix { get; set; }
 | |
|         
 | |
|         [Browsable(false)]
 | |
|         public Point UnitCount { get; set; }
 | |
|         [Browsable(false)]
 | |
|         public Point RoiCount { get; set; }
 | |
|         [Browsable(false)]
 | |
|         public int ColCount { get { return UnitCount.X; } }
 | |
|         [Browsable(false)]
 | |
|         public int RowCount { get { return UnitCount.Y; } }
 | |
|         [Browsable(false)]
 | |
|         public int TotalUnitCount { get { return UnitCount.X * UnitCount.Y; } }
 | |
| 
 | |
|         [Browsable(false)]
 | |
|         public Point VisionCount { get; set; }
 | |
|         [Browsable(false)]
 | |
|         public int VisionColCount { get { return VisionCount.X; } }
 | |
|         [Browsable(false)]
 | |
|         public int VisionRowCount { get { return VisionCount.Y; } }
 | |
|         [Browsable(false)]
 | |
|         public int TotalVisionCount { get { return VisionCount.X * VisionCount.Y; } }
 | |
| 
 | |
|         [Browsable(false)]
 | |
|         public UInt16 airBlowRuntime { get; set; }
 | |
| 
 | |
| 
 | |
|         [Browsable(false)]
 | |
|         public UInt16 LimitCount { get; set; }
 | |
| 
 | |
|         [Browsable(false)]
 | |
|         public float DotFontSize { get; set; }
 | |
| 
 | |
| 
 | |
|         //여기는 사용하지 않는 코드(일단 몰라서 나둠)
 | |
| 
 | |
|         [Browsable(false), Description("범위 : 0.0~1.0")]
 | |
|         public double OrientScore { get; set; }
 | |
| 
 | |
|         [Browsable(false)]
 | |
|         public Size OrientROSSize { get; set; }
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|         [Category("ROI Offset(Front)"), DisplayName("모션이동(Column)"), Description("비젼축(X)이 이동하는 경우 적용할 옵셋값 입니다. 트레이기준 '열'의 위치가 변경되면 이 옵셋이 적용 됩니다")]
 | |
|         public RoiOffset ROIOffsetColF { get; set; }
 | |
|         [Category("ROI Offset(Front)"), DisplayName("모션이동(Row)"), Description("셔틀축(Y)이 이동하는 경우 적용할 옵셋값 입니다. 트레이기준 '줄'의 위치가 변경되면 이 옵셋이 적용 됩니다.")]
 | |
|         public RoiOffset ROIOffsetRowF { get; set; }
 | |
|         [Category("ROI Offset(Front)"), DisplayName("기본옵셋"), Description("입력된 ROI기준으로 추가로 적용할 옵셋값 입니다")]
 | |
|         public RoiOffset ROIOffsetFront { get; set; }
 | |
|         [Category("ROI Offset(Front)"), DisplayName("개별간격"), Description("자동으로 생성되는 ROI(=Dummy ROI)에 적용하는 옵셋 값입니다. Theta 의 오류가 있는 경우 이 값을 통해서 ROI를 회전하는 효과를 얻을 수 있습니다")]
 | |
|         public RoiOffset ROIOffsetUnitTermFront { get; set; }
 | |
| 
 | |
| 
 | |
|         [Category("ROI Offset(Rear)"), DisplayName("모션이동(Column)"), Description("비젼축(X)이 이동하는 경우 적용할 옵셋값 입니다. 트레이기준 '열'의 위치가 변경되면 이 옵셋이 적용 됩니다")]
 | |
|         public RoiOffset ROIOffsetColR { get; set; }
 | |
|         [Category("ROI Offset(Rear)"), DisplayName("모션이동(Row)"), Description("셔틀축(Y)이 이동하는 경우 적용할 옵셋값 입니다. 트레이기준 '줄'의 위치가 변경되면 이 옵셋이 적용 됩니다.")]
 | |
|         public RoiOffset ROIOffsetRowR { get; set; }
 | |
|         [Category("ROI Offset(Rear)"), DisplayName("기본옵셋"), Description("입력된 ROI기준으로 추가로 적용할 옵셋값 입니다")]
 | |
|         public RoiOffset ROIOffsetRear { get; set; }
 | |
|         [Category("ROI Offset(Rear)"), DisplayName("개별간격"), Description("자동으로 생성되는 ROI(=Dummy ROI)에 적용하는 옵셋 값입니다. Theta 의 오류가 있는 경우 이 값을 통해서 ROI를 회전하는 효과를 얻을 수 있습니다")]
 | |
|         public RoiOffset ROIOffsetUnitTermRear { get; set; }
 | |
| 
 | |
|         [Category("Common"), DisplayName("검사영역 간격"),Description("자동으로 생성되는 ROI(=Dummy ROI)의 간격입니다. 각 유닛의 Pitch 값이며, 화면을 보고 해당 간격을 맞추시기 바랍니다.")]
 | |
|         public Point UnitTerm { get; set; }
 | |
|         
 | |
|         [Category("Common"), DisplayName("조명 밝기"), Description("조명의 밝기 입니다. 라이브영상으로 전환 후 화면 하단의 Light 영역내에서 그 값을 변경하며 확인할 수 있습니다. (입력범위 : 0~255)")]
 | |
|         public UInt16 LightValue { get; set; }
 | |
| 
 | |
| 
 | |
|         [Browsable(false), Category("Common"), Description("비젼 판독을 위한 설정 값")]
 | |
|         public CVisionProcess VisionParameter { get; set; }
 | |
| 
 | |
| 
 | |
|         public ModelInfoV()
 | |
|         {
 | |
|             VisionParameter = new CVisionProcess();
 | |
|         }
 | |
| 
 | |
|         public void ReadValue(DataSet1.ModelRow dr)
 | |
|         {
 | |
|             this.Title = dr.Title;
 | |
|             this.idx = dr.idx;
 | |
|         }
 | |
|         public bool WriteValue()
 | |
|         {
 | |
|             var model = Pub.mdm.GetDataV(this.Title);
 | |
|             return WriteValue(ref model);
 | |
|         }
 | |
|         public bool WriteValue(ref DataSet1.ModelRow dr)
 | |
|         {
 | |
|             try
 | |
|             {
 | |
|                 dr.Title = this.Title;
 | |
|                 dr.EndEdit();
 | |
|                 Pub.mdm.SaveModelV();
 | |
|                 return true;
 | |
|             }
 | |
|             catch (Exception ex)
 | |
|             {
 | |
|                 Pub.log.AddE("write model error" + ex.Message);
 | |
|                 return false;
 | |
|             }
 | |
| 
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     [TypeConverterAttribute(typeof(ExpandableObjectConverter))]
 | |
|     public class RoiOffset
 | |
|     {
 | |
|         [DisplayName("Horizon"), Description("수직(Y축) 변화 값(+는 아래쪽,-는 위쪽)")]        
 | |
|         public double Y { get; set; }
 | |
|         [DisplayName("Vertical"), Description("수평(X축) 변화 값(+는 오른쪽,-는 왼쪽)")]
 | |
|         public double X { get; set; }
 | |
|         [Browsable(false)]
 | |
|         public bool IsEmpty { get { if (Y == 0 && X == 0) return true; else return false; } }
 | |
| 
 | |
|         public RoiOffset(double start = 0.0, double end = 0.0)
 | |
|         {
 | |
|             this.Y = start;
 | |
|             this.X = end;
 | |
|         }
 | |
|         public override string ToString()
 | |
|         {
 | |
|             return string.Format("{0},{1}", Y, X);
 | |
|         }
 | |
|         public string toPointStr()
 | |
|         {
 | |
|             return string.Format("{0};{1}", Y, X);
 | |
|         }
 | |
|     }
 | |
| 
 | |
| 
 | |
|     [TypeConverterAttribute(typeof(ExpandableObjectConverter))]
 | |
|     public class Range
 | |
|     {
 | |
|         [DisplayName("시작값")]
 | |
|         public uint Start { get; set; }
 | |
|         [DisplayName("종료값")]
 | |
|         public uint End { get; set; }
 | |
|         [Browsable(false)]
 | |
|         public bool IsEmpty { get { if (Start == 0 && End == 0) return true; else return false; } }
 | |
| 
 | |
|         public Range(UInt16 start, UInt16 end) : this((uint)start, (uint)end) { }
 | |
|         public Range(uint start = 0, uint end = 0)
 | |
|         {
 | |
|             this.Start = start;
 | |
|             this.End = end;
 | |
|         }
 | |
|         public static implicit operator RangeF(Range p)
 | |
|         {
 | |
|             return new RangeF((float)p.Start, (float)p.End);
 | |
|         }
 | |
|         public override string ToString()
 | |
|         {
 | |
|             return string.Format("{0}~{1}", Start, End);
 | |
|         }
 | |
|     }
 | |
|     [TypeConverterAttribute(typeof(ExpandableObjectConverter))]
 | |
|     public class RangeF
 | |
|     {
 | |
|         [DisplayName("시작값")]
 | |
|         public float Start { get; set; }
 | |
|         [DisplayName("종료값")]
 | |
|         public float End { get; set; }
 | |
|         [Browsable(false)]
 | |
|         public bool IsEmpty { get { if (Start == 0f && End == 0f) return true; else return false; } }
 | |
|         public RangeF(float start = 0f, float end = 0f)
 | |
|         {
 | |
|             this.Start = start;
 | |
|             this.End = end;
 | |
|         }
 | |
|         public static implicit operator Range(RangeF p)
 | |
|         {
 | |
|             return new Range((uint)p.Start, (uint)p.End);
 | |
|         }
 | |
|         public override string ToString()
 | |
|         {
 | |
|             return string.Format("{0}~{1}", Start, End);
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     [TypeConverterAttribute(typeof(ExpandableObjectConverter))]
 | |
|     public class CVisionProcess
 | |
|     {
 | |
| 
 | |
|         [Category("특수설정(개발자용)"), Description("미사용(DOT 인식시에 사용했음)")]
 | |
|         public UInt16 halfKernel { get; set; }
 | |
|         [Category("특수설정(개발자용)"), Description("미사용(DOT 인식시에 사용했음)")]
 | |
|         public UInt16 Constant { get; set; }
 | |
|         [Category("특수설정(개발자용)"), DisplayName("MP_Dilate"),Description("미사용(DOT 인식시에 사용했음)")]
 | |
|         public UInt16 dilate { get; set; }
 | |
|         [Category("특수설정(개발자용)"), DisplayName("MP_Erode"), Description("미사용(DOT 인식시에 사용했음)")]
 | |
|         public UInt16 erode { get; set; }
 | |
|         [Category("특수설정(개발자용)"), DisplayName("MP_Open"), Description("미사용(DOT 인식시에 사용했음)")]
 | |
|         public UInt16 open { get; set; }
 | |
|         [Category("특수설정(개발자용)"), DisplayName("MP_Open"), Description("미사용(DOT 인식시에 사용했음)")]
 | |
|         public UInt32 segment_threshold { get; set; }
 | |
|         [Category("특수설정(개발자용)"), DisplayName("MP_Open"), Description("미사용(DOT 인식시에 사용했음)")]
 | |
|         public Boolean isBlack { get; set; }
 | |
|         [Category("특수설정(개발자용)"), DisplayName("MP_Open"), Description("미사용(DOT 인식시에 사용했음)")]
 | |
|         public UInt32 judg_runcount { get; set; }
 | |
| 
 | |
| 
 | |
|         [Category("유닛 감지"),DisplayName("밝기 기준값"), Description("입력된 값 이상의 데이터를 취합니다. 이 값이 낮을 수록 검출값이 높아지게 됩니다. 이 기준값으로 검출된 값으로 판정을 합니다. 유닛은 밝은 데이터를 보고 판정 하므로 이 기준값 이상의 데이터가 검출이 됩니다")]
 | |
|         public byte detect_threhosld { get; set; }
 | |
|         [Category("유닛 감지"),DisplayName("판정 기준값"), Description("판정을 하는 기준 값입니다. 밝기기준값으로 인해 검출된 값이 5000이라면. 이 판정 기준에 입력된 값이 5000보다 크면 유닛이 존재하는 것으로 판정하며, 그 보다 낮을 때에는 유닛이 없는 'Empty' 유닛으로 감지 됩니다")]
 | |
|         public UInt16 detect_count { get; set; }
 | |
|         [Category("유닛 감지"), DisplayName("*예외영역 판정기준"), Description("빈 유닛(=Empty) 일때 셔틀 프레임의 빛 반사가 심할 경우 해당 반사값에 의해 유닛이 감지됩니다. 그러한 데이터를 제거하기위해 이 값이 사용되며, 유닛검출에 사용하는 흰색영역의 값외에 추가로 검은색 덩어리를 검사합니다. 설정한 값사이의 검은색 덩어리가 검출되면 'Empty' 유닛으로 감지 됩니다")]
 | |
|         public Point detect_blobrange { get; set; }
 | |
| 
 | |
|         [Category("2D 감지"), DisplayName("밝기 기준값"), Description("입력된 값 이하의 데이터를 취합니다. 이 값이 낮을 수록 검출값도 낮아지게 됩니다. 이 기준값으로 검출된 값으로 판정을 합니다. 2D는 어두운 데이터를 보고 판정 하므로 이 기준값 이하의 데이터가 검출이 됩니다")]
 | |
|         public byte detectDM_threhosld { get; set; }
 | |
|         [Category("2D 감지"), DisplayName("판정 기준값"), Description("판정을 하는 기준 값입니다. 밝기기준값으로 인해 검출된 값이 5000이라면. 이 판정 기준에 입력된 값이 5000보다 크면 ID가 존재하는 것으로 판정하며, 그 보다 낮을 때에는 ID가 없는 'New' 유닛으로 감지 됩니다")]
 | |
|         public UInt16 detectDM_count { get; set; }
 | |
| 
 | |
|         public CVisionProcess()
 | |
|         {
 | |
| 
 | |
|         }
 | |
|         public override string ToString()
 | |
|         {
 | |
|             return "비젼 설정 값";
 | |
|         }
 | |
|     }
 | |
| 
 | |
| }
 | 
