public void Read() { StringBuilder sb = new StringBuilder(32); AUtil.GetPrivateProfileString("P" + (m_nPosition + 1), "Frame_CommonX", "0", sb, 32, ASDef._INI_FILE); m_stCommon.dX = Convert.ToDouble(sb.ToString()); AUtil.GetPrivateProfileString("P" + (m_nPosition + 1), "Frame_CommonY", "0", sb, 32, ASDef._INI_FILE); m_stCommon.dY = Convert.ToDouble(sb.ToString()); AUtil.GetPrivateProfileString("P" + (m_nPosition + 1), "Frame_CommonZ", "0", sb, 32, ASDef._INI_FILE); m_stCommon.dZ = Convert.ToDouble(sb.ToString()); AUtil.GetPrivateProfileString("P" + (m_nPosition + 1), "Frame_CommonAX", "0", sb, 32, ASDef._INI_FILE); m_stCommon.dAX = Convert.ToDouble(sb.ToString()); AUtil.GetPrivateProfileString("P" + (m_nPosition + 1), "Frame_CommonAY", "0", sb, 32, ASDef._INI_FILE); m_stCommon.dAY = Convert.ToDouble(sb.ToString()); AUtil.GetPrivateProfileString("P" + (m_nPosition + 1), "Frame_CommonAZ", "0", sb, 32, ASDef._INI_FILE); m_stCommon.dAZ = Convert.ToDouble(sb.ToString()); // 2016.10.11 AUtil.GetPrivateProfileString(m_strType, "Frame_PoseX_P" + (m_nPosition + 1).ToString(), "0", sb, 32, ASDef._INI_FILE); m_stPose.dX = Convert.ToDouble(sb.ToString()); AUtil.GetPrivateProfileString(m_strType, "Frame_PoseY_P" + (m_nPosition + 1).ToString(), "0", sb, 32, ASDef._INI_FILE); m_stPose.dY = Convert.ToDouble(sb.ToString()); AUtil.GetPrivateProfileString(m_strType, "Frame_PoseZ_P" + (m_nPosition + 1).ToString(), "0", sb, 32, ASDef._INI_FILE); m_stPose.dZ = Convert.ToDouble(sb.ToString()); AUtil.GetPrivateProfileString(m_strType, "Frame_PoseAX_P" + (m_nPosition + 1).ToString(), "0", sb, 32, ASDef._INI_FILE); m_stPose.dAX = Convert.ToDouble(sb.ToString()); AUtil.GetPrivateProfileString(m_strType, "Frame_PoseAY_P" + (m_nPosition + 1).ToString(), "0", sb, 32, ASDef._INI_FILE); m_stPose.dAY = Convert.ToDouble(sb.ToString()); AUtil.GetPrivateProfileString(m_strType, "Frame_PoseAZ_P" + (m_nPosition + 1).ToString(), "0", sb, 32, ASDef._INI_FILE); m_stPose.dAZ = Convert.ToDouble(sb.ToString()); }
private void AFrmPW_Load(object sender, EventArgs e) { StringBuilder sb = new StringBuilder(16); AUtil.GetPrivateProfileString("PASSWORD", "PW", "*****", sb, 10, ASDef._INI_FILE); m_strPassWord = sb.ToString(); }
public void LoadIni(string strName) { StringBuilder strIP = new StringBuilder(32); AUtil.GetPrivateProfileString(strName, "IP", "127.0.0.1", strIP, 20, ASDef._INI_FILE); m_strIP = strIP.ToString(); m_nPort = AUtil.GetPrivateProfileInt(strName, "Port", 1000, ASDef._INI_FILE); }
public void ReadIniPlcToPc() { try { // 2011.06.23 StringBuilder sb = new StringBuilder(255); AUtil.GetPrivateProfileString(Name, "PlcToPc", "0", sb, 255, ASDef._INI_FILE); m_strPlcToPc = sb.ToString(); } catch { } }
public void Read() { StringBuilder sb = new StringBuilder(32); for (int i = 0; i < ASDef._3D_POSITION_COUNT; i++) { AUtil.GetPrivateProfileString(m_strType, "HoleLocation_P" + (i + 1).ToString() + "_X", "0", sb, 32, ASDef._INI_FILE); m_pstXYZ[i].dX = Convert.ToDouble(sb.ToString()); AUtil.GetPrivateProfileString(m_strType, "HoleLocation_P" + (i + 1).ToString() + "_Y", "0", sb, 32, ASDef._INI_FILE); m_pstXYZ[i].dY = Convert.ToDouble(sb.ToString()); AUtil.GetPrivateProfileString(m_strType, "HoleLocation_P" + (i + 1).ToString() + "_Z", "0", sb, 32, ASDef._INI_FILE); m_pstXYZ[i].dZ = Convert.ToDouble(sb.ToString()); } AUtil.GetPrivateProfileString(m_strType, "HoleLocation_CheckLength", "5", sb, 32, ASDef._INI_FILE); m_dCheckLength = Convert.ToDouble(sb.ToString()); }
private string GetCommentFromIni(int nRW, int nAddress) { StringBuilder sb = new StringBuilder(256); if (nRW == 0) { // 2017.04.15 32->255 AUtil.GetPrivateProfileString("PLC", "R_Comment" + nAddress.ToString(), "", sb, 255, ASDef._INI_FILE); } else { // 2017.04.15 32->255 AUtil.GetPrivateProfileString("PLC", "W_Comment" + nAddress.ToString(), "", sb, 255, ASDef._INI_FILE); } return(sb.ToString()); }
public void LoadIni(string strApp) { // 2011.05.24 StringBuilder strTmp = new StringBuilder(32); AUtil.GetPrivateProfileString(strApp, "Port", "COM1", strTmp, 10, ASDef._INI_FILE); m_stCommCfg.strPort = strTmp.ToString(); m_stCommCfg.nBaud = (int)AUtil.GetPrivateProfileInt(strApp, "Baud", 9600, ASDef._INI_FILE); AUtil.GetPrivateProfileString(strApp, "Parity", "N", strTmp, 10, ASDef._INI_FILE); switch (strTmp[0]) { case 'N': m_stCommCfg.emParity = Parity.None; break; case 'E': m_stCommCfg.emParity = Parity.Even; break; case 'O': m_stCommCfg.emParity = Parity.Odd; break; } m_stCommCfg.nData = (int)AUtil.GetPrivateProfileInt(strApp, "Data", 8, ASDef._INI_FILE); int nStopBit = (int)AUtil.GetPrivateProfileInt(strApp, "Stop", 1, ASDef._INI_FILE); switch (nStopBit) { case 0: m_stCommCfg.emStop = StopBits.None; break; case 1: m_stCommCfg.emStop = StopBits.One; break; case 2: m_stCommCfg.emStop = StopBits.Two; break; } AUtil.GetPrivateProfileString(strApp, "HandShake", "N", strTmp, 10, ASDef._INI_FILE); switch (strTmp[0]) { case 'N': m_stCommCfg.emHandshake = Handshake.None; break; case 'X': m_stCommCfg.emHandshake = Handshake.XOnXOff; break; case 'R': m_stCommCfg.emHandshake = Handshake.RequestToSend; break; case 'A': m_stCommCfg.emHandshake = Handshake.RequestToSendXOnXOff; break; } }
public ACaliper() { m_cogCaliperTool = new CogCaliperTool(); //------------------------------- // 2015.05.11 // default 값 StringBuilder sb = new StringBuilder(256); AUtil.GetPrivateProfileString("CaliperTool", "ContrastThreshold", "5", sb, 32, ASDef._INI_FILE); m_cogCaliperTool.RunParams.ContrastThreshold = Convert.ToDouble(sb.ToString()); AUtil.GetPrivateProfileString("CaliperTool", "FilterHalfSizeInPixels", "2", sb, 32, ASDef._INI_FILE); m_cogCaliperTool.RunParams.FilterHalfSizeInPixels = Convert.ToInt32(sb.ToString()); //------------------------------- Init(); }
// 2014.11.04 public void ReadIniUse() { try { StringBuilder sb = new StringBuilder(255); AUtil.GetPrivateProfileString(Name, "Use", "X", sb, 10, ASDef._INI_FILE); if (sb.ToString() == "O") { m_bUse = true; } else { m_bUse = false; } } catch { } }
private void AFrmFileDel_Load(object sender, EventArgs e) { StringBuilder sb = new StringBuilder(16); AUtil.GetPrivateProfileString("DelTime", "OK", "30", sb, 5, ASDef._INI_FILE); txtOk.Text = sb.ToString(); AUtil.GetPrivateProfileString("DelTime", "NG", "30", sb, 5, ASDef._INI_FILE); txtNg.Text = sb.ToString(); // 2011.08.17 AUtil.GetPrivateProfileString("DelTime", "TOTAL_OK", "30", sb, 5, ASDef._INI_FILE); txtTotalOK.Text = sb.ToString(); AUtil.GetPrivateProfileString("DelTime", "TOTAL_NG", "30", sb, 5, ASDef._INI_FILE); txtTotalNG.Text = sb.ToString(); AUtil.GetPrivateProfileString("DelTime", "LOG", "30", sb, 5, ASDef._INI_FILE); txtLog.Text = sb.ToString(); AUtil.GetPrivateProfileString("DelTime", "TIME", "11:10", sb, 6, ASDef._INI_FILE); dTDel.Text = sb.ToString(); // 2017.06.08 txtPath.Text = AVisionProBuild.m_strResultPath; }
// 2017.02.12 private string GetAddressFromIni(int nRW, int nAddress) { StringBuilder sb = new StringBuilder(256); string strVal = ""; if (nRW == 0) { // 2017.04.15 32->255 AUtil.GetPrivateProfileString("PLC", "R_Address" + nAddress.ToString(), nAddress.ToString(), sb, 255, ASDef._INI_FILE); strVal = "R:" + sb.ToString(); } else { // 2017.04.15 32->255 AUtil.GetPrivateProfileString("PLC", "W_Address" + nAddress.ToString(), nAddress.ToString(), sb, 255, ASDef._INI_FILE); strVal = "W:" + sb.ToString(); } return(strVal); }
// 2011.06.23 public void ReadIniLimit(int nCount) { try { // 2011.05.24 StringBuilder sb = new StringBuilder(32); // 2012.02.08 AUtil.GetPrivateProfileString(Name, "Limit" + nCount.ToString() + "_Low_X", "-100", sb, 32, ASDef._INI_FILE); m_pstLimitLow[nCount].dX = Convert.ToDouble(sb.ToString()); AUtil.GetPrivateProfileString(Name, "Limit" + nCount.ToString() + "_Low_Y", "-100", sb, 32, ASDef._INI_FILE); m_pstLimitLow[nCount].dY = Convert.ToDouble(sb.ToString()); AUtil.GetPrivateProfileString(Name, "Limit" + nCount.ToString() + "_Low_Z", "-100", sb, 32, ASDef._INI_FILE); m_pstLimitLow[nCount].dZ = Convert.ToDouble(sb.ToString()); AUtil.GetPrivateProfileString(Name, "Limit" + nCount.ToString() + "_Low_AX", "-10", sb, 32, ASDef._INI_FILE); m_pstLimitLow[nCount].dAX = Convert.ToDouble(sb.ToString()); AUtil.GetPrivateProfileString(Name, "Limit" + nCount.ToString() + "_Low_AY", "-10", sb, 32, ASDef._INI_FILE); m_pstLimitLow[nCount].dAY = Convert.ToDouble(sb.ToString()); AUtil.GetPrivateProfileString(Name, "Limit" + nCount.ToString() + "_Low_AZ", "-10", sb, 32, ASDef._INI_FILE); m_pstLimitLow[nCount].dAZ = Convert.ToDouble(sb.ToString()); AUtil.GetPrivateProfileString(Name, "Limit" + nCount.ToString() + "_High_X", "100", sb, 32, ASDef._INI_FILE); m_pstLimitHigh[nCount].dX = Convert.ToDouble(sb.ToString()); AUtil.GetPrivateProfileString(Name, "Limit" + nCount.ToString() + "_High_Y", "100", sb, 32, ASDef._INI_FILE); m_pstLimitHigh[nCount].dY = Convert.ToDouble(sb.ToString()); AUtil.GetPrivateProfileString(Name, "Limit" + nCount.ToString() + "_High_Z", "100", sb, 32, ASDef._INI_FILE); m_pstLimitHigh[nCount].dZ = Convert.ToDouble(sb.ToString()); AUtil.GetPrivateProfileString(Name, "Limit" + nCount.ToString() + "_High_AX", "10", sb, 32, ASDef._INI_FILE); m_pstLimitHigh[nCount].dAX = Convert.ToDouble(sb.ToString()); AUtil.GetPrivateProfileString(Name, "Limit" + nCount.ToString() + "_High_AY", "10", sb, 32, ASDef._INI_FILE); m_pstLimitHigh[nCount].dAY = Convert.ToDouble(sb.ToString()); AUtil.GetPrivateProfileString(Name, "Limit" + nCount.ToString() + "_High_AZ", "10", sb, 32, ASDef._INI_FILE); m_pstLimitHigh[nCount].dAZ = Convert.ToDouble(sb.ToString()); } catch { } }
public void ReadIniOffset(int nCount) { try { // 2011.05.24 StringBuilder sb = new StringBuilder(32); AUtil.GetPrivateProfileString(Name, "Offset" + nCount.ToString() + "_X", "0", sb, 32, ASDef._INI_FILE); m_pstOffset[nCount].dX = Convert.ToDouble(sb.ToString()); AUtil.GetPrivateProfileString(Name, "Offset" + nCount.ToString() + "_Y", "0", sb, 32, ASDef._INI_FILE); m_pstOffset[nCount].dY = Convert.ToDouble(sb.ToString()); AUtil.GetPrivateProfileString(Name, "Offset" + nCount.ToString() + "_Z", "0", sb, 32, ASDef._INI_FILE); m_pstOffset[nCount].dZ = Convert.ToDouble(sb.ToString()); AUtil.GetPrivateProfileString(Name, "Offset" + nCount.ToString() + "_AX", "0", sb, 32, ASDef._INI_FILE); m_pstOffset[nCount].dAX = Convert.ToDouble(sb.ToString()); AUtil.GetPrivateProfileString(Name, "Offset" + nCount.ToString() + "_AY", "0", sb, 32, ASDef._INI_FILE); m_pstOffset[nCount].dAY = Convert.ToDouble(sb.ToString()); AUtil.GetPrivateProfileString(Name, "Offset" + nCount.ToString() + "_AZ", "0", sb, 32, ASDef._INI_FILE); m_pstOffset[nCount].dAZ = Convert.ToDouble(sb.ToString()); } catch { } }
public void Init(bool bNew) { // 2011.06.23 m_pstLimitLow = new ASDef._stRobotShift[ASDef._LIMIT_COUNT]; m_pstLimitHigh = new ASDef._stRobotShift[ASDef._LIMIT_COUNT]; m_pstOffset = new ASDef._stRobotShift[ASDef._OFFSET_COUNT]; StringBuilder sb = new StringBuilder(256); int i; for (i = 0; i < m_nPointCount; ++i) { if (bNew) { // 2018.01.18 by kdi APoint aPoint = new APoint("Point" + i.ToString(), false); m_lstAPoint.Add(aPoint); m_cogtgType.Tools.Add(aPoint.GetToolGroupPoint() as ICogTool); // 2016.06.20 //#if !_USE_1Camera #if (!_USE_BASLER_PYLON && !_USE_IMAGING_CONTROL && !_USE_FLIR && !_USE_1Camera) // 2015.10.02 by kdi. APoint aPoint_Acq = new APoint("Point" + i.ToString(), true); m_cogtgType_Acq.Tools.Add(aPoint_Acq.GetToolGroupPoint() as ICogTool); aPoint.SetAcqFifo(m_cogtgType_Acq.Tools[i] as CogToolGroup); #endif // 2013.02.03 AUtil.GetPrivateProfileString(m_cogtgType.Name, "Point" + i.ToString() + "_FlipRotation", "0", sb, 10, ASDef._INI_FILE); aPoint.m_nFlipRotation = Convert.ToInt32(sb.ToString()); AUtil.WritePrivateProfileString(m_cogtgType.Name, "Point" + i.ToString() + "_FlipRotation", aPoint.m_nFlipRotation.ToString(), ASDef._INI_FILE); // 2018.01.18 by kdi #if _USE_BASLER_PYLON // 2012.01.02 AUtil.GetPrivateProfileString(m_cogtgType.Name, "Dev_Point" + i.ToString(), aPoint.Name, sb, 255, ASDef._INI_FILE); aPoint.m_strDevName = sb.ToString(); //AUtil.WritePrivateProfileString(m_cogtgType.Name, "Dev_Point" + i.ToString(), aPoint.m_strDevName, ASDef._INI_FILE); // 2018.01.18 by kdi #endif } else { APoint aPoint = new APoint(m_cogtgType.Tools[i] as CogToolGroup); // 2016.06.20 //#if !_USE_1Camera #if (!_USE_BASLER_PYLON && !_USE_IMAGING_CONTROL && !_USE_FLIR && !_USE_1Camera) // 2015.10.06 if (m_cogtgType_Acq.Tools.Count > i) { // 2015.10.02 by kdi aPoint.SetAcqFifo(m_cogtgType_Acq.Tools[i] as CogToolGroup); } else { APoint aPoint_Acq = new APoint("Point" + i.ToString(), true); m_cogtgType_Acq.Tools.Add(aPoint_Acq.GetToolGroupPoint() as ICogTool); aPoint.SetAcqFifo(m_cogtgType_Acq.Tools[i] as CogToolGroup); } #endif m_lstAPoint.Add(aPoint); // 2013.02.03 AUtil.GetPrivateProfileString(m_cogtgType.Name, "Point" + i.ToString() + "_FlipRotation", "0", sb, 10, ASDef._INI_FILE); aPoint.m_nFlipRotation = Convert.ToInt32(sb.ToString()); AUtil.WritePrivateProfileString(m_cogtgType.Name, "Point" + i.ToString() + "_FlipRotation", aPoint.m_nFlipRotation.ToString(), ASDef._INI_FILE); /* 2013.04.12 * // 2012.04.24 #if (!_USE_BASLER_PYLON && !_USE_IMAGING_CONTROL) * AAcqFifo aAcqFifo = aPoint.GetTool("AcqFifo", 0) as AAcqFifo; * if (aAcqFifo != null) * { * // 2012.05.08 * if (aAcqFifo.AcqFifoTool.Operator != null) * { * if (aAcqFifo.GetFrameGrabberName().Contains("acA2500")) * { * AIniExposure aIniExposure = new AIniExposure(m_cogtgType.Name, i); * aIniExposure.Read(); * aAcqFifo.Exposure = Convert.ToDouble(aIniExposure.m_nExposure); * } * } * } * #elif _USE_BASLER_PYLON */ // 2018.01.18 by kdi #if _USE_BASLER_PYLON // 2012.01.02 //AUtil.GetPrivateProfileString(m_cogtgType.Name, "Dev_" + aPoint.Name, aPoint.Name, sb, 255, ASDef._INI_FILE); AUtil.GetPrivateProfileString(m_cogtgType.Name, "Dev_Point" + i.ToString(), aPoint.Name, sb, 255, ASDef._INI_FILE); aPoint.m_strDevName = sb.ToString(); //AUtil.WritePrivateProfileString(m_cogtgType.Name, "Dev_" + aPoint.Name, aPoint.m_strDevName, ASDef._INI_FILE); // 2016.09.30 by kdi AUtil.GetPrivateProfileString(m_cogtgType.Name, "Point" + i.ToString() + "_PixelFormat", "Mono 8", sb, 100, ASDef._INI_FILE); aPoint.m_strPixelFormat = sb.ToString(); // 2018.01.18 by kdi #endif } } for (i = 0; i < ASDef._OFFSET_COUNT; ++i) { ReadIniOffset(i); } // 2011.06.23 for (i = 0; i < ASDef._LIMIT_COUNT; ++i) { ReadIniLimit(i); } ReadIniPlcToPc(); // 2014.11.04 ReadIniUse(); }
public void Read() { StringBuilder sb = new StringBuilder(32); string strKeyName; for (int i = 0; i < ASDef._3D_POSITION_COUNT; i++) { strKeyName = "PartOffset_HoleX_P" + (i + 1).ToString() + "L"; AUtil.GetPrivateProfileString(m_strType, strKeyName, "0", sb, 32, ASDef._INI_FILE); m_ppstHoleXY[i, 0].dX = Convert.ToDouble(sb.ToString()); strKeyName = "PartOffset_HoleX_P" + (i + 1).ToString() + "R"; AUtil.GetPrivateProfileString(m_strType, strKeyName, "0", sb, 32, ASDef._INI_FILE); m_ppstHoleXY[i, 1].dX = Convert.ToDouble(sb.ToString()); strKeyName = "PartOffset_HoleY_P" + (i + 1).ToString() + "L"; AUtil.GetPrivateProfileString(m_strType, strKeyName, "0", sb, 32, ASDef._INI_FILE); m_ppstHoleXY[i, 0].dY = Convert.ToDouble(sb.ToString()); strKeyName = "PartOffset_HoleY_P" + (i + 1).ToString() + "R"; AUtil.GetPrivateProfileString(m_strType, strKeyName, "0", sb, 32, ASDef._INI_FILE); m_ppstHoleXY[i, 1].dY = Convert.ToDouble(sb.ToString()); // 2011.07.29--------------- strKeyName = "PartOffset_CalibX"; AUtil.GetPrivateProfileString("P" + (i + 1).ToString(), strKeyName, "0", sb, 32, ASDef._INI_FILE); m_pstCalibXYZ[i].dX = Convert.ToDouble(sb.ToString()); strKeyName = "PartOffset_CalibY"; AUtil.GetPrivateProfileString("P" + (i + 1).ToString(), strKeyName, "0", sb, 32, ASDef._INI_FILE); m_pstCalibXYZ[i].dY = Convert.ToDouble(sb.ToString()); strKeyName = "PartOffset_CalibZ"; AUtil.GetPrivateProfileString("P" + (i + 1).ToString(), strKeyName, "0", sb, 32, ASDef._INI_FILE); m_pstCalibXYZ[i].dZ = Convert.ToDouble(sb.ToString()); //-------------------------- strKeyName = "PartOffset_X_P" + (i + 1).ToString(); AUtil.GetPrivateProfileString(m_strType, strKeyName, "0", sb, 32, ASDef._INI_FILE); m_pstXYZ[i].dX = Convert.ToDouble(sb.ToString()); strKeyName = "PartOffset_Y_P" + (i + 1).ToString(); AUtil.GetPrivateProfileString(m_strType, strKeyName, "0", sb, 32, ASDef._INI_FILE); m_pstXYZ[i].dY = Convert.ToDouble(sb.ToString()); strKeyName = "PartOffset_Z_P" + (i + 1).ToString(); AUtil.GetPrivateProfileString(m_strType, strKeyName, "0", sb, 32, ASDef._INI_FILE); m_pstXYZ[i].dZ = Convert.ToDouble(sb.ToString()); // 2011.08.15--------------- strKeyName = "CalibSubX_P" + (i + 1).ToString(); AUtil.GetPrivateProfileString(m_strType, strKeyName, "0", sb, 32, ASDef._INI_FILE); m_pstCalibSubXYZ[i].dX = Convert.ToDouble(sb.ToString()); strKeyName = "CalibSubY_P" + (i + 1).ToString(); AUtil.GetPrivateProfileString(m_strType, strKeyName, "0", sb, 32, ASDef._INI_FILE); m_pstCalibSubXYZ[i].dY = Convert.ToDouble(sb.ToString()); strKeyName = "CalibSubZ_P" + (i + 1).ToString(); AUtil.GetPrivateProfileString(m_strType, strKeyName, "0", sb, 32, ASDef._INI_FILE); m_pstCalibSubXYZ[i].dZ = Convert.ToDouble(sb.ToString()); //--------------------------- } }