증상: 운전화면 페이지 이동 후에도 SeqScoutNormal이 이전 페이지(보통 0)의 스카우트 필드로 동작. 원인: LoadScoutField()가 GUI 캐시 selectedIndexNo 의존 — WinForms 티칭 콤보에서만 갱신되어 운전화면/자동운전 경로에선 stale. - SeqScoutNormal_InitParam에 PageIndex 추가, 실행 시점 라이브 페이지 (GetCurrentPageIndex)를 호출부(Recipe/Test VM)에서 명시 주입 - MainPage: LoadScoutField(int) 오버로드 + GetCurrentPageIndex() 추가 - 폴백: 페이지 없으면 selectedIndexNo 로드, 그래도 null이면 빈 리스트(NRE 방지) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
532 lines
21 KiB
C#
532 lines
21 KiB
C#
using Aurora;
|
|
using Aurora.Api;
|
|
using Aurora.View;
|
|
using AuroraIO;
|
|
using AuroraLaser;
|
|
using AuroraLaserScanner;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Linq;
|
|
using System.Reactive.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using System.Windows.Input;
|
|
using System.Windows.Threading;
|
|
using VisionCommon;
|
|
using WeldingCommon;
|
|
using WeldingCommon.Devices.Laser;
|
|
using WeldingCommon.Models;
|
|
using WeldingCommon.Sequences;
|
|
using WeldingCommon.Settings;
|
|
using WeldingCommon.Utils;
|
|
using static AuroraLaser.Ekspla.NL202;
|
|
using static WeldingCommon.Devices.Laser.PAIX_PrismaticScanner;
|
|
|
|
namespace WeldingCommon.Views
|
|
{
|
|
public class UCScannerObjectTeachingControlBoxViewModel : NotifyPropertyChangedBase
|
|
{
|
|
private readonly Logger Log = new Logger("UCScannerObjectTeachingControlBoxViewModel");
|
|
|
|
public ICommand CMD_VisibleChanged { get; }
|
|
|
|
public ICommand CMD_RunScoutNormal { get; }
|
|
public ICommand CMD_StopScoutNormal { get; }
|
|
|
|
public ICommand CMD_RunScoutFlyingVision { get; }
|
|
public ICommand CMD_StopScoutFlyingVision { get; }
|
|
|
|
public ICommand CMD_RunTeachingRun { get; }
|
|
public ICommand CMD_StopTeachingRun { get; }
|
|
|
|
public ICommand CMD_LaserGuideBeam { get; }
|
|
public ICommand CMD_LaserReadyCheck { get; }
|
|
public ICommand CMD_ImportObjectFromDXF { get; }
|
|
|
|
private readonly IAuroraEnvironment _Aurora;
|
|
private SystemParameter _SystemParameter;
|
|
//private readonly EquipmentInfo _EquipmentInfo;
|
|
|
|
private readonly Scanner _Scanner;
|
|
private readonly Laser _Laser;
|
|
private readonly LaserConfig _LaserConfig;
|
|
private IODevice _IODevice;
|
|
|
|
|
|
private ISequence _SeqScoutNormal;
|
|
private bool _IsSequenceRunning_ScoutNormal;
|
|
public bool IsSequenceRunning_ScoutNormal { get => _IsSequenceRunning_ScoutNormal; set => SetProperty(ref _IsSequenceRunning_ScoutNormal, value); }
|
|
|
|
private ISequence _SeqScoutFlyingVision;
|
|
private bool _IsSequenceRunning_ScoutFlyingVision;
|
|
public bool IsSequenceRunning_ScoutFlyingVision { get => _IsSequenceRunning_ScoutFlyingVision; set => SetProperty(ref _IsSequenceRunning_ScoutFlyingVision, value); }
|
|
|
|
private ISequence _SeqTeachingRun;
|
|
|
|
private bool _IsSequenceRunning_TeachingRun;
|
|
public bool IsSequenceRunning_TeachingRun { get => _IsSequenceRunning_TeachingRun; set => SetProperty(ref _IsSequenceRunning_TeachingRun, value); }
|
|
|
|
private bool _IsSelectedScoutNormal;
|
|
public bool IsSelectedScoutNormal { get => _IsSelectedScoutNormal; set => SetProperty(ref _IsSelectedScoutNormal, value); }
|
|
|
|
private bool _IsGuidBeam;
|
|
public bool IsGuidBeam { get => _IsGuidBeam; set => SetProperty(ref _IsGuidBeam, value); }
|
|
private bool _IsLaserReady;
|
|
public bool IsLaserReady { get => _IsLaserReady; set => SetProperty(ref _IsLaserReady, value); }
|
|
|
|
// Object Select Type
|
|
private bool _IsObjectSelectAll;
|
|
public bool IsObjectSelectAll { get => _IsObjectSelectAll; set => SetProperty(ref _IsObjectSelectAll, value); }
|
|
|
|
// ScoutNormal 행 전환 sleep 분리 (같은 행 / 행 전환)
|
|
private int _ScoutSameRowSleepMs;
|
|
public int ScoutSameRowSleepMs
|
|
{
|
|
get => _ScoutSameRowSleepMs;
|
|
set { SetProperty(ref _ScoutSameRowSleepMs, value); _SystemParameter.ScoutSameRowSleepMs = value; SaveScoutSleep(); }
|
|
}
|
|
private int _ScoutRowChangeSleepMs;
|
|
public int ScoutRowChangeSleepMs
|
|
{
|
|
get => _ScoutRowChangeSleepMs;
|
|
set { SetProperty(ref _ScoutRowChangeSleepMs, value); _SystemParameter.ScoutRowChangeSleepMs = value; SaveScoutSleep(); }
|
|
}
|
|
private void SaveScoutSleep()
|
|
{
|
|
_Aurora.SettingEntry.Save(CommonSettingIds.SystemParameter, _SystemParameter, "ScoutSleep");
|
|
}
|
|
|
|
private readonly DispatcherTimer _MonitorTimer;
|
|
|
|
private SequenceDialog _SequenceDialog;
|
|
|
|
private WinSequenceDiagram _WinSequenceDiagramScoutNormal;
|
|
private WinSequenceDiagram _WinSequenceDiagramScoutFlyingVision;
|
|
private WinSequenceDiagram _WinSequenceDiagramTeachingRun;
|
|
private WinSequenceDiagram _WinSequenceDiagramComponentTeachingRun;
|
|
public bool toggleIO = true;
|
|
public UCScannerObjectTeachingControlBoxViewModel(IAuroraEnvironment aurora)
|
|
{
|
|
_Aurora = aurora;
|
|
|
|
_SystemParameter = aurora.SettingEntry[CommonSettingIds.SystemParameter] as SystemParameter;
|
|
_ScoutSameRowSleepMs = _SystemParameter.ScoutSameRowSleepMs;
|
|
_ScoutRowChangeSleepMs = _SystemParameter.ScoutRowChangeSleepMs;
|
|
|
|
_SeqScoutNormal = _Aurora.SequenceEntry[CommonSequenceIds.SeqScoutNormal];
|
|
_SeqScoutFlyingVision = _Aurora.SequenceEntry[CommonSequenceIds.SeqScoutFlyingVision];
|
|
|
|
_Scanner = _Aurora.DeviceManager[CommonDeviceIds.Scanner] as Scanner;
|
|
_Laser = _Aurora.DeviceManager[CommonDeviceIds.Laser] as Laser;
|
|
_IODevice = _Aurora.DeviceManager[CommonDeviceIds.IODevice] as IODevice;
|
|
// Trumpf 레이저인 경우에는 ComponentTeachingRun 실행
|
|
_LaserConfig = _Aurora.DeviceManager.GetDeviceConfig(CommonDeviceIds.Laser) as LaserConfig;
|
|
_SeqTeachingRun = _Aurora.SequenceEntry[CommonSequenceIds.SeqComponentTeachingRun];
|
|
|
|
InitVariable();
|
|
|
|
CMD_VisibleChanged = new DelegateCommand(VisibleChanged);
|
|
|
|
CMD_RunScoutNormal = new DelegateCommand(PerformCmdRunScoutNormal);
|
|
CMD_StopScoutNormal = new DelegateCommand(PerformCmdStopScoutNormal);
|
|
CMD_RunScoutFlyingVision = new DelegateCommand(PerformCmdRunScoutFlyingVision);
|
|
CMD_StopScoutFlyingVision = new DelegateCommand(PerformCmdStopScoutFlyingVision);
|
|
CMD_RunTeachingRun = new DelegateCommand(PerformCmdRunTeachingRun);
|
|
CMD_StopTeachingRun = new DelegateCommand(PerformCmdStopTeachingRun);
|
|
|
|
CMD_LaserGuideBeam = new DelegateCommand(PerformCmdLaserGuideBeam);
|
|
CMD_LaserReadyCheck = new DelegateCommand(PerformCmdLaserReadyCheck);
|
|
CMD_ImportObjectFromDXF = new DelegateCommand(PerformCmdImportObjectFromDXF);
|
|
|
|
_Aurora.EventObservable.AsObservable(AuroraSysEvent.SYS_SETTING_CHANGED)
|
|
.ObserveOnDispatcher()
|
|
.Subscribe(OnSettingReloaded);
|
|
|
|
_MonitorTimer = new DispatcherTimer();
|
|
_MonitorTimer.Tick += OnMonitoring;
|
|
_MonitorTimer.Interval = TimeSpan.FromMilliseconds(100);
|
|
|
|
}
|
|
|
|
private void InitVariable()
|
|
{
|
|
if (_SystemParameter.ScoutType == eScoutType.Normal) {
|
|
IsSelectedScoutNormal = true;
|
|
} else {
|
|
IsSelectedScoutNormal = false;
|
|
}
|
|
|
|
IsSequenceRunning_ScoutNormal = false;
|
|
IsSequenceRunning_ScoutFlyingVision = false;
|
|
IsSequenceRunning_TeachingRun = false;
|
|
|
|
IsGuidBeam = false;
|
|
IsLaserReady = false;
|
|
|
|
IsObjectSelectAll = true;
|
|
}
|
|
|
|
private void VisibleChanged(object obj)
|
|
{
|
|
bool visible = (bool)obj;
|
|
if (visible) {
|
|
_MonitorTimer.Start();
|
|
} else {
|
|
_MonitorTimer.Stop();
|
|
}
|
|
}
|
|
|
|
private void OnSettingReloaded(object obj)
|
|
{
|
|
_SystemParameter = _Aurora.SettingEntry[CommonSettingIds.SystemParameter] as SystemParameter;
|
|
if (_SystemParameter.ScoutType == eScoutType.Normal) {
|
|
IsSelectedScoutNormal = true;
|
|
} else {
|
|
IsSelectedScoutNormal = false;
|
|
}
|
|
}
|
|
|
|
private void OnMonitoring(object sender, EventArgs e)
|
|
{
|
|
|
|
// [기존 소스 보존] Laser 디바이스 기반 Pilot 상태 (DO 3=GuideLaserEnable) — 일부 Laser 미구현 시 항상 false
|
|
//if (_Laser.GetPilotLaserStatus()) {
|
|
// IsGuidBeam = true;
|
|
//} else {
|
|
// IsGuidBeam = false;
|
|
//}
|
|
try
|
|
{
|
|
// Guide Beam: DI 결선 없음 → 가이드빔 제어 DO 17 명령 비트를 그대로 표시
|
|
// (현장 가이드빔 제어선은 DO 17). IO 미연결 시 ReadDO 예외 → 아래 catch 에서 처리(앱 종료 방지)
|
|
IsGuidBeam = _IODevice.ReadDO(17);
|
|
|
|
// 시뮬 아님 + IO보드 없음 → _iOUnit == null → ReadDI에서 NRE로 꺼짐. - 현장PC 아닌 경우 개발PC에서 주석 해제 (시뮬안하고 레시피 들어갔을 때 프로그램 종료 방지)
|
|
// IsConnected()가 _iOUnit null/미연결을 체크하므로, 미연결이면 폴링 스킵(꺼짐 방지).
|
|
//if (_IODevice == null || !_IODevice.IsConnected())
|
|
//{
|
|
// IsLaserReady = false;
|
|
//}
|
|
// 변경 후 (260618: IO 결선 변경 12&24 → 11&15)
|
|
if (_IODevice.ReadDI(11) && _IODevice.ReadDI(15))
|
|
{
|
|
IsLaserReady = true;
|
|
}
|
|
else
|
|
{
|
|
IsLaserReady = false;
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Log.E($"[OnMonitoring] DI 읽기 실패: {ex.Message}");
|
|
IsLaserReady = false;
|
|
IsGuidBeam = false;
|
|
}
|
|
|
|
// TODO: PRIBAT_L1, PRIBAT_L2 는 Blow 의 상태 check 가 들어 있음. 장비 한정이므로 이를 check 하는 것을 modelItem 이나 setting 으로 빼서 진행되도록 함.
|
|
}
|
|
|
|
private void PerformCmdRunScoutNormal(object obj)
|
|
{
|
|
var result = MessageUtil.ShowYesNoMessageDialog("Scanner Scout", "Start Scanner Scout Normal Sequence?");
|
|
if (result == false) {
|
|
return;
|
|
}
|
|
|
|
if (VisionRecipeManager.GetFovInfos().Count == 0) {
|
|
MessageUtil.ShowWarningToast(string.Format("Please check the Vision Recipe of the currently active Recipe."));
|
|
return;
|
|
}
|
|
|
|
if (_SeqScoutNormal.RunState == SequenceRunState.Running) {
|
|
MessageUtil.ShowWarningToast(string.Format("이미 시퀀스가 Start 상태입니다.", "SeqScoutNormal"), Log);
|
|
return;
|
|
}
|
|
|
|
var scoutSeqParams = new ScoutSeqParams(VisionRecipeManager.GetFovInfos()[0], eDisplayType.Machine_B);
|
|
var param = new SeqScoutNormal_InitParam() {
|
|
IsRealTimeScout = false,
|
|
ScoutSeqParams = scoutSeqParams,
|
|
// [추가 2026-06-19] 현재 표시 중인 페이지의 스카우트 필드를 사용하도록 명시 주입
|
|
PageIndex = CommonHelper.GetMainPage().GetCurrentPageIndex(),
|
|
};
|
|
|
|
PopupSequenceDiagram(ref _WinSequenceDiagramScoutNormal, CommonSequenceIds.SeqScoutNormal, param);
|
|
|
|
IsSequenceRunning_ScoutNormal = true;
|
|
_SeqScoutNormal.Start(param, OnCompleteScoutNormal);
|
|
|
|
}
|
|
|
|
private void OnCompleteScoutNormal(SequenceActionResult res)
|
|
{
|
|
if (res != null) {
|
|
if (res.Param is SeqScoutNormal_OutParam result && result.Success == true) {
|
|
IsSequenceRunning_ScoutNormal = false;
|
|
MessageUtil.ShowSuccessToast(string.Format("Success SeqScoutNormal"));
|
|
|
|
CloseSequenceDiagram(_WinSequenceDiagramScoutNormal);
|
|
return;
|
|
}
|
|
}
|
|
|
|
if (_Laser.GetLaserReady()) {
|
|
_Laser.LaserOff();
|
|
}
|
|
|
|
IsSequenceRunning_ScoutNormal = false;
|
|
MessageUtil.ShowWarningToast(string.Format("Fail SeqScoutNormal"));
|
|
}
|
|
|
|
private void PerformCmdStopScoutNormal(object obj)
|
|
{
|
|
if (_SeqScoutNormal.RunState == SequenceRunState.Idle) {
|
|
return;
|
|
}
|
|
|
|
IsSequenceRunning_ScoutNormal = false;
|
|
_SeqScoutNormal.Stop();
|
|
}
|
|
|
|
private void PerformCmdRunScoutFlyingVision(object obj)
|
|
{
|
|
var result = MessageUtil.ShowYesNoMessageDialog("Flying Vision", "Start Scanner Scout Flying Vision Sequence?");
|
|
if (result == false) {
|
|
return;
|
|
}
|
|
|
|
if (VisionRecipeManager.GetFovInfos().Count == 0) {
|
|
MessageUtil.ShowWarningToast(string.Format("Please check the Vision Recipe of the currently active Recipe."));
|
|
return;
|
|
}
|
|
|
|
if (_SeqScoutFlyingVision.RunState == SequenceRunState.Running) {
|
|
MessageUtil.ShowWarningToast(string.Format("이미 시퀀스가 Start 상태입니다.", "SeqScoutFlyingVision"), Log);
|
|
return;
|
|
}
|
|
|
|
var scoutSeqParams = new ScoutSeqParams(VisionRecipeManager.GetFovInfos()[0], eDisplayType.Machine_B);
|
|
var param = new SeqScoutFlyingVision_InitParam() {
|
|
IsRealTimeScout = false,
|
|
ScoutSeqParams = scoutSeqParams,
|
|
SequenceAutoRunCount = 0,
|
|
WeldingScannerListNo = eListNo.LIST2,
|
|
};
|
|
|
|
PopupSequenceDiagram(ref _WinSequenceDiagramScoutFlyingVision, CommonSequenceIds.SeqScoutFlyingVision, param);
|
|
|
|
IsSequenceRunning_ScoutFlyingVision = true;
|
|
_SeqScoutFlyingVision.Start(param, OnCompleteScoutFlyingVision);
|
|
|
|
}
|
|
|
|
private void OnCompleteScoutFlyingVision(SequenceActionResult res)
|
|
{
|
|
if (res != null) {
|
|
if (res.Param is SeqScoutFlyingVision_OutParam result && result.Success == true) {
|
|
IsSequenceRunning_ScoutFlyingVision = false;
|
|
MessageUtil.ShowSuccessToast(string.Format("Success SeqScoutFlyingVision"));
|
|
|
|
CloseSequenceDiagram(_WinSequenceDiagramScoutFlyingVision);
|
|
return;
|
|
}
|
|
}
|
|
|
|
if (_Laser.GetLaserReady()) {
|
|
_Laser.LaserOff();
|
|
}
|
|
|
|
IsSequenceRunning_ScoutFlyingVision = false;
|
|
MessageUtil.ShowWarningToast(string.Format("Fail SeqScoutFlyingVision"));
|
|
}
|
|
|
|
private void PerformCmdStopScoutFlyingVision(object obj)
|
|
{
|
|
if (_SeqScoutFlyingVision.RunState == SequenceRunState.Idle) {
|
|
return;
|
|
}
|
|
|
|
IsSequenceRunning_ScoutFlyingVision = false;
|
|
_SeqScoutFlyingVision.Stop();
|
|
}
|
|
|
|
private void PerformCmdRunTeachingRun(object obj)
|
|
{
|
|
var result = MessageUtil.ShowYesNoMessageDialog("Teaching Run", "Start TeachingRun Sequence?");
|
|
if (result == false) {
|
|
return;
|
|
}
|
|
|
|
if (IsLaserReady == false) {
|
|
MessageUtil.ShowWarningToast(string.Format("Please check Laser Ready."));
|
|
return;
|
|
}
|
|
|
|
// TODO: PRIBAT_L1, PRIBAT_L2 에서 Suction 과 CLAMP 상태 등에 따라 Laser 가 나가지 않도록 해야 함.
|
|
// TODO: 이 부분은, Delegate 를 사용해서, Interlock 을 각 장비별로 설정할 수 있도록 해주는게 좋겠음.
|
|
|
|
if (_SeqTeachingRun.RunState == SequenceRunState.Running) {
|
|
MessageUtil.ShowWarningToast(string.Format("이미 시퀀스가 Start 상태입니다.", "SeqTeachingRun"), Log);
|
|
return;
|
|
}
|
|
|
|
// TODO: NeedSetLaserTiming 는 트럼프 레이저 를 사용할 때, UploadWeldingList Sequence 에서 LaserTiming Set 을 해야 할때 사용함.
|
|
// TODO: SMW 와 LHS 는 트럼프 레이저를 사용하지 않으므로 false, PRIBAT_L1 과 PRIBAT_L2 할때 LaserType 을 읽어서 설정하는 것으로 추가하자
|
|
|
|
var currentModelInfo = EquipmentSpecificModelUtil.GetCurrentRecipeEquipmentSpecificModel();
|
|
if (currentModelInfo.equipmentSpecificModel == null) {
|
|
MessageUtil.ShowWarningToast(string.Format("선택된 model 이 없습니다.", "SeqTeachingRun"));
|
|
return;
|
|
}
|
|
|
|
var intervalTimeBlowOn = 0;
|
|
var intervalTimeBlowOff = 0;
|
|
|
|
if (currentModelInfo.equipmentSpecificModel.UseBlow) {
|
|
intervalTimeBlowOn = currentModelInfo.equipmentSpecificModel.IntervalTimeBlowOn;
|
|
intervalTimeBlowOff = currentModelInfo.equipmentSpecificModel.IntervalTimeBlowOff;
|
|
}
|
|
|
|
var param = new SeqTeachingRun_InitParam() {
|
|
IsObjectSelectAll = IsObjectSelectAll,
|
|
|
|
//UseStream = _EquipmentInfo.UseStream,
|
|
UseStream = currentModelInfo.equipmentSpecificModel.UseStream,
|
|
|
|
UseBlow = currentModelInfo.equipmentSpecificModel.UseBlow,
|
|
IntervalTimeBlowOn = intervalTimeBlowOn,
|
|
IntervalTimeBlowOff = intervalTimeBlowOff,
|
|
|
|
NeedSetLaserTiming = false,
|
|
};
|
|
|
|
//PopupSequenceDiagram(ref _WinSequenceDiagramTeachingRun, CommonSequenceIds.SeqComponentTeachingRun, param);
|
|
|
|
IsSequenceRunning_TeachingRun = true;
|
|
_SeqTeachingRun.Start(param, OnCompleteTeachingRun);
|
|
|
|
}
|
|
|
|
private void OnCompleteTeachingRun(SequenceActionResult res)
|
|
{
|
|
|
|
//if (res != null) {
|
|
// if (res.Param is SeqTeachingRun_OutParam result && result.Success == true) {
|
|
// IsSequenceRunning_TeachingRun = false;
|
|
// MessageUtil.ShowSuccessToast(string.Format("Success SeqTeachingRun"));
|
|
|
|
// CloseSequenceDiagram(_WinSequenceDiagramTeachingRun);
|
|
// return;
|
|
// }
|
|
//}
|
|
|
|
if (_Laser.GetLaserReady()) {
|
|
_Laser.LaserOff();
|
|
}
|
|
|
|
IsSequenceRunning_TeachingRun = false;
|
|
//MessageUtil.ShowWarningToast(string.Format("Fail SeqTeachingRun"));
|
|
}
|
|
|
|
private void PerformCmdStopTeachingRun(object obj)
|
|
{
|
|
IsSequenceRunning_TeachingRun = false;
|
|
if (_SeqTeachingRun.RunState == SequenceRunState.Idle) {
|
|
return;
|
|
}
|
|
|
|
_SeqTeachingRun.Stop();
|
|
}
|
|
|
|
|
|
private void PopupSequenceDiagram(ref WinSequenceDiagram winSequenceDiagram, string seqId, object param)
|
|
{
|
|
if (winSequenceDiagram == null) {
|
|
winSequenceDiagram = new WinSequenceDiagram(seqId);
|
|
winSequenceDiagram.Closing += ClosingEvent;
|
|
winSequenceDiagram.SetParam(new SeqDrawerParam() {
|
|
SequenceId = seqId,
|
|
DiagramType = eDiagramType.Tree,
|
|
LineType = eLineType.Straight,
|
|
IsShowSubSequence = false,
|
|
VisibleKeys = new List<string>()
|
|
});
|
|
|
|
winSequenceDiagram.Owner = Application.Current.MainWindow;
|
|
winSequenceDiagram.Width = 600;
|
|
winSequenceDiagram.SequenceParam = param;
|
|
winSequenceDiagram.Show();
|
|
} else {
|
|
winSequenceDiagram.SequenceParam = param;
|
|
winSequenceDiagram.WindowState = WindowState.Normal;
|
|
winSequenceDiagram.Show();
|
|
}
|
|
}
|
|
private void CloseSequenceDiagram(WinSequenceDiagram winSequenceDiagram)
|
|
{
|
|
Application.Current.Dispatcher.Invoke(() => {
|
|
if (winSequenceDiagram != null) {
|
|
winSequenceDiagram.Close();
|
|
}
|
|
});
|
|
}
|
|
private void ClosingEvent(object sender, CancelEventArgs e)
|
|
{
|
|
e.Cancel = true;
|
|
(sender as Window).Hide();
|
|
}
|
|
|
|
private void PerformCmdLaserGuideBeam(object obj)
|
|
{
|
|
// Guide Beam DO 17 토글 — 모니터링도 같은 DO 17 을 읽어 표시
|
|
// IO 미연결 가드는 현장PC에서 동작 안 해 주석 (개발PC에서 주석 해제)
|
|
//if (_IODevice == null || !_IODevice.IsConnected()) {
|
|
// return;
|
|
//}
|
|
bool cur = _IODevice.ReadDO(17);
|
|
_IODevice._iOUnit.WriteDoBit(17, !cur);
|
|
|
|
// [기존 소스 보존] Laser 디바이스 기반 Pilot On/Off 토글 (DO 3=GuideLaserEnable)
|
|
//if (!_Laser.GetPilotLaserSetBitStatus()) {
|
|
// _Laser.PilotLaserOn();
|
|
//} else {
|
|
// _Laser.PilotLaserOff();
|
|
//}
|
|
}
|
|
|
|
private void PerformCmdLaserReadyCheck(object obj)
|
|
{
|
|
// 추후 Write bit 파라미터화 해야함
|
|
if(toggleIO)
|
|
{
|
|
_IODevice._iOUnit.WriteDoBit(9, true);
|
|
_IODevice._iOUnit.WriteDoBit(13, true);
|
|
toggleIO = false;
|
|
}
|
|
else
|
|
{
|
|
_IODevice._iOUnit.WriteDoBit(9, false);
|
|
_IODevice._iOUnit.WriteDoBit(13, false);
|
|
toggleIO = true;
|
|
}
|
|
}
|
|
|
|
private void PerformCmdImportObjectFromDXF(object obj)
|
|
{
|
|
System.Windows.Forms.FileDialog dlg = new System.Windows.Forms.OpenFileDialog();
|
|
dlg.InitialDirectory = @"D:\share\jungwoo.jin\모바일글라스도면 외 (3) 파일_20241028";
|
|
dlg.DefaultExt = "dxf";
|
|
dlg.Filter = "DXF 도면 파일 (*.dxf)|*.dxf";
|
|
dlg.Title = "DXF 도면 열기";
|
|
|
|
if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
|
|
CommonHelper.GetMainPage().DxfParser(dlg.FileName);
|
|
}
|
|
}
|
|
}
|
|
}
|