2단계가 글이 길어져서 gui 환경을 생각한 만큼 꾸미지 못했는데 나머지 check 하고 싶은 metal layer 선정을 위해 CyclicField를 만들어 보고 메인 run button과 procedure를 만들어서 2,3 단계에서 만든 각 field 들의 동작을 print 함수를 써서 확인해 보도록 하자. 실제로 코드 작성할 때 이런 식으로 처음부터 gui를 다 꾸미고 시작하는 경우는 많지 않고, 대부분은 완성된 후 옵션들이 하나씩 추가되는 형태일 것이다. 역시 첫 단추를 잘 꿰매어야 한다. script에 대한 완성된 결과를 image로 올리질 못해서 갑갑하기는 하지만 코드만 복붙 해도 어느 정도는 실행 가능할 것이므로 계속 진도를 나가 봅시다.
# 3단계) cyclicField 추가, cyclicField 는 여러가지 값 중에 선택해야 하는 경우에 사용하기 편합니다.
# 2단계에서 추가한 cal_net_file_button 다음에 아래와 같이 추가해 보자.
cal_top_layer_CF = hiCreateCyclicField(
?name 'cal_top_layer_CF
?choices list("m0" "m1" "m2" "m3" "m4" "m5" "m6" "m7" "m8" "m9" "m10" "m11" "TM0" "TM1") ; -- (1)
?prompt "CHECK TOP LAYER"
?value "m11"
)
cal_bot_layer_CF = hiCreateCyclicField(
?name 'cal_bot_layer_CF
?choices list("m0" "m1" "m2" "m3" "m4" "m5" "m6" "m7" "m8" "m9" "m10" "m11" "TM0" "TM1")
?prompt "CHECK BOT LAYER"
?value "m1"
)
# 주석
# (1) : 딱 봐도 알 수 있듯 선택할 수 있는 항목들의 list 이다.
# 각 metal layer 를 적어 주었다. 현재 사용중인 공정에 맞게 수정해 주면 된다.
#
# 역시나 calculatorID 쪽도 수정해서 CyclicField를 추가해준다.
calculatorID = hiCreateAppForm(
?name 'calculator
?buttonLayout 'Empty
?formTitle "Layer Area Calculator"
?field list(
list(cal_cellName_SF 040:020 280:030 70)
list(cal_cur_button 315:020 100:040)
list(cal_net_file_SF 040:060 380:030 70)
list(cal_net_file_button 415:060 040:040)
list(cal_top_layer_CF 060:100 040:040 120)
list(cal_bot_layer_CF 060:130 040:040 120)
list(cal_Label 040:190 280:030 14)
);end of list
?initialSize list(500 250)
?minSize list(500 250)
) ;end of calculatorID
reload 해보면 LAYER 선택할 수 있는 두 개의 cyclic Field 가 생성된 걸 확인할 수 있다. DB가 클 경우 run time과 직결되니 특정 Layer 만 계산하도록 작성할 예정이다. 자신의 공정에 맞게 바꿔주도록 하자. 그리고 일단 마지막으로 run button을 추가로 gui 쪽 작업을 끝내보자. button 은 앞에서 몇 번 다뤘으므로
# 3-2단계) run button 추가와 main procedure 연결
cal_run_button = hiCreateButton(
?name 'cal_run_button
?buttonText "Calculate Area"
?callback "calculate_area()"
) ;end of cal_run_button
calculatorID = hiCreateAppForm(
?name 'calculator
?buttonLayout 'Empty
?formTitle "Layer Area Calculator"
?field list(
list(cal_cellName_SF 040:020 280:030 70)
list(cal_cur_button 315:020 100:040)
list(cal_net_file_SF 040:060 380:030 70)
list(cal_net_file_button 415:060 040:040)
list(cal_top_layer_CF 060:100 040:040 120)
list(cal_bot_layer_CF 060:130 040:040 120)
list(cal_run_button 265:100 150:60)
list(cal_Label 040:190 280:030 14)
);end of list
?initialSize list(500 250)
?minSize list(500 250)
) ;end of calculatorID
# 그리고 이제 부터 작성할 main procedure 인 calculate_area 를 작성해 보자.
# 지금은 일단 할 게 없으므로 각 변수들이 잘 들어가 있는지 print 만 해보자.
procedure(calculate_area()
prog(()
printf("CellName : %s\n" calculator->cal_cellName_SF->value)
printf("We will reference %s, for Net information.\n" calculator->cal_net_file_SF->value)
printf("Calculate Layer from %s to %s\n" calculator->cal_bot_layer_CF->value calculator->cal_top_layer_CF->value)
);end of prog
);end of procedure calculate_area() -- (2)
# 주석(2) : 각 field 에 있는 값을 한번씩 printf 하도록 구성하였다.
# 이후에 지금 구문은 필요없고 각 함수들에 쓰일 것이다.
역시나 동작확인! 물론 debug 작업은 완벽히 하진 않아서 Top Layer 보다 Bottom Layer 가 위에 있다거나, CellName 이 없다거나 해도 에러를 띄우진 않는다. 여러 유저가 사용하게끔 작성하여 배포하기 전에는 반드시 Error 상황 등을 생각하여 미리 없애거나, Error를 띄우게 하자. 오늘까지 일단 gui는 끝!
# 3단계 완료까지 script
cal_cellName_SF = hiCreateStringField(
?name 'cal_cellName_SF
?prompt "Cell Name"
?defValue ""
?callback ""
) ;end of cal_cellName_SF
cal_cur_button = hiCreateButton(
?name 'cal_cur_button
?buttonText "Current Cell"
?callback "cal_cur_button_CB()"
) ;end of cal_cur_button
procedure(cal_cur_button_CB()
prog(()
calculator->cal_cellName_SF->value = deGetCellView()->cellName
);end of prog
);end of procedure cal_cur_button_CB()
cal_net_file_SF = hiCreateStringField(
?name 'cal_net_file_SF
?prompt "Net File "
?defValue ""
?callback ""
) ;end of cal_net_file_SF
cal_net_file_button = hiCreateButton(
?name 'cal_net_file_button
?buttonText "..."
?callback "ddsFileBrowseCB(calculator 'cal_net_file_SF)"
) ;end cal_net_file_button
cal_top_layer_CF = hiCreateCyclicField(
?name 'cal_top_layer_CF
?choices list("m0" "m1" "m2" "m3" "m4" "m5" "m6" "m7" "m8" "m9" "m10" "m11" "TM0" "TM1")
?prompt "CHECK TOP LAYER"
?value "m11"
) ;end of cal_top_layer_CF
cal_bot_layer_CF = hiCreateCyclicField(
?name 'cal_bot_layer_CF
?choices list("m0" "m1" "m2" "m3" "m4" "m5" "m6" "m7" "m8" "m9" "m10" "m11" "TM0" "TM1")
?prompt "CHECK BOT LAYER"
?value "m1"
) ;end of cal_bot_layer_CF
cal_run_button = hiCreateButton(
?name 'cal_run_button
?buttonText "Calculate Area"
?callback "calculate_area()"
) ;end of cal_cur_button
cal_Label = hiCreateLabel(
?name 'cal_Label
?labelText "skill programming!\nhttp://hodman.tistory.com"
) ;end of cal_Label
calculatorID = hiCreateAppForm(
?name 'calculator
?buttonLayout 'Empty
?formTitle "Layer Area Calculator"
?fields
list(
list(cal_cellName_SF 040:020 280:030 70)
list(cal_cur_button 315:020 100:040)
list(cal_net_file_SF 040:060 380:030 70)
list(cal_net_file_button 415:060 040:040)
list(cal_top_layer_CF 060:100 040:040 120)
list(cal_bot_layer_CF 060:130 040:040 120)
list(cal_run_button 265:100 150:060)
list(cal_Label 040:190 280:030 14)
);end of list
?initialSize list(500 250)
?minSize list(500 250)
);end of calculatorID
procedure(calculator()
prog(()
hiDisplayForm(calculator '(100 100))
);end of prog
);end of procedure calculator()
procedure(reload()
prog(()
if(hiIsFormDisplayed(calculatorID) then
hiFormCancel(calculator)
); end of if
hiRegTimer("load(\"/user/hodman/private/skill/calculator.il\")" 1)
hiRegTimer("calculator()" 10)
);end of prog
);end of procedure reload()
procedure(calculate_area()
prog(()
printf("CellName : %s\n" calculator->cal_cellName_SF->value)
printf("We will reference %s, for Net information.\n" calculator->cal_net_file_SF->value)
printf("Calculate Layer from %s to %s\n" calculator->cal_bot_layer_CF->value calculator->cal_top_layer_CF->value)
);end of prog
);end of procedure calculate_area()
'Programming 언어 > Skill' 카테고리의 다른 글
[SKILL 강좌] calculate_area : 5. calibre rule deck 생성 (0) | 2017.01.19 |
---|---|
[SKILL 강좌] calculate_area : 4. boolean button 과 export gds (0) | 2017.01.12 |
[SKILL 강좌] calculate_area : 2. callback 함수와 browser (2) | 2017.01.11 |
[SKILL 강좌] calculate_area : 1. gui 설정과 reload 함수 (0) | 2017.01.11 |
[SKILL] 원클릭으로 LPE를 추출해보자 (1) | 2017.01.09 |