Example #1
0
        public void MeasurePart(string partId)
        {
            _currentPartId = partId;
            string prgFile = FindProgFile(partId); // 返回带扩展名的零件程序

            // 正常情况下不会返回空值
            Debug.Assert(string.IsNullOrEmpty(prgFile));

            _bladeMeasAssist      = new BladeMeasAssist();
            _bladeMeasAssist.Part = PartConfigManager.Instance.GetPartConfig(partId);
            // 创建blade.txt文件
            _bladeMeasAssist.CreateBladeTxtFromNominal();

            try
            {
                _partPrograms.CloseAll();
                _pcdApp.Maximize();
                _pcdApp.SetActive();
                _partProgram = _partPrograms.Open(prgFile, _pcdApp.DefaultMachineName /*"CMM1"*/);
                _partProgram.OnExecuteDialogErrorMsg += _partProgram_OnExecuteDialogErrorMsg;
                //  获取程序中测尖直径
                PCDLRN.OldBasic ob = _partProgram.OldBasic;
                _bladeMeasAssist.ProbeDiam = 2 * ob.GetProbeRadius();
                _bladeMeasAssist.RtfFileName /*_outputFileName*/ = FindOutputFileName();
                // 异步执行
                _partProgram.AsyncExecute();
            }
            catch (Exception ex)
            {
            }
            _IsMeasured = true; // 是否需要
        }
Example #2
0
 /// <summary>
 /// 打开PCDMIS测量程序
 /// </summary>
 /// <param name="prgFile">测量程序全路径名</param>
 public void OpenPartProgram(string prgFile)
 {
     _pcdProgramManager.CloseAll();
     while (_pcdProgramManager.Count != 0)
     {
         ;                                   // 等待程序关闭
     }
     _partProgram = null;
     _ExeOK       = false;
     //_pcdApplication.SetActive();
     //_pcdApplication.Maximize();
     _partProgram = _pcdProgramManager.Open(prgFile, _pcdApplication.DefaultMachineName /*"CMM1"*/);
     _IsOpened    = true;
 }