XScript 매뉴얼 · Chapter 23
title: "DEVICEMGR — 디바이스 매니저" chapter: 23
DEVICEMGR — 디바이스 매니저
DEVICEMGR 는 컨테이너(라인 노드) 전체를 관리하는 글로벌 객체입니다. 트레이/매거진
처럼 여러 위치에 여러 디바이스 가 있는 경우 Row × Col 맵으로 관리하며,
디바이스의 추가/삭제/이동/조회를 일괄 처리합니다.
기본 예제
int trayRowCount = DEVICEMGR.GetRowCount("Tray");
int trayColCount = DEVICEMGR.GetColCount("Tray");
// 트레이 전체를 Rank 1로 채움
DEVICEMGR.MakeFull("Tray", 1);
if (DEVICEMGR.IsFull("Tray") == true)
{
Log("Tray Is Full. Col = {0}, Row = {1}", trayColCount, trayRowCount);
}
else
{
Log("Tray Is Not Full. Col = {0}, Row = {1}", trayColCount, trayRowCount);
}
int devCount = DEVICEMGR.GetDeviceCount("Tray");
Log("Before Remove, Device Count = {0}", devCount);
DEVICEMGR.RemoveDeviceMap("Tray", 0, 0);
devCount = DEVICEMGR.GetDeviceCount("Tray");
Log("After Remove, Device Count = {0}", devCount);실전 예제 — 유닛 간 이동
// 주문을 다음 유닛으로 이동
DEVICEMGR.MoveDevice(DEVICE_NAME, unitIndex - 1, DEVICE_NAME, unitIndex);
// 마지막 유닛에서 배출
DEVICEMGR.RemoveDevice(DEVICE_NAME, unitIndex);
// 전체 카운트 확인
if (DEVICEMGR.GetDeviceCountAll() > 0)
{
// 아직 라인에 물체가 남음
}메서드
컨테이너 관리
| 시그니처 | 설명 |
|---|---|
bool ClearContainerAll(void) | 전체 초기화 |
bool AddContainer(string name, string sensorName = "", bool log = true) | 컨테이너 추가 |
int GetContainerCount(void) | 컨테이너 수 |
디바이스 추가/삭제
| 시그니처 | 설명 |
|---|---|
bool AddDevice(string container) / AddDevice(string container, int index) | 디바이스 추가 |
bool RemoveDevice(string container) / RemoveDevice(string container, int index) | 디바이스 제거 |
bool RemoveDeviceMap(string container, int col, int row) | 맵 좌표로 제거 |
bool ClearAllDevice(void) | 전체 제거 |
이동 · 복사
| 시그니처 | 설명 |
|---|---|
bool MoveDevice(string name1, int index1, string name2, int index2) | 디바이스 이동 |
bool CopyDevice(...) | 복사 |
조회
| 시그니처 | 설명 |
|---|---|
int GetRowCount(string container) | 행 수 |
int GetColCount(string container) | 열 수 |
int GetDeviceCount(string container) | 해당 컨테이너 디바이스 수 |
int GetDeviceCountAll(void) | 전 컨테이너 디바이스 수 |
bool IsFull(string container) | 가득 찼는지 |
bool IsEmpty(string container) | 비었는지 |
맵 채우기
| 시그니처 | 설명 |
|---|---|
bool MakeFull(string container, int rank) | 지정 Rank 로 채움 |
bool MakeEmpty(string container) | 모두 비움 |
팁
- Tray/Cassette 같은 배열형 컨테이너 는
GetRowCount/GetColCount로 크기 조회 후 2중 for 로 순회. - 단일 인덱스 컨테이너(라인 노드) 는
AddDevice(name, index)로 위치 지정. - 배출 누락 방지를 위해 마지막 유닛에서 반드시
RemoveDevice호출 또는ClearAllDevice로 초기화.