Allegro SKILL Tutorial | Forms
So far we have dealt with simple form that has only one or two elements of form. We will now created a little bit of complicated form, which will have preactically anything that goes in the form. Once you run this skill, it will pop up a form and and with different fields. You need to fill up the form and press Run. At this stage it will gather all the inputs of the form and will put them in an output file.
Copy the following code in a file advanceform.il and save it in the directory C:/cadence/setup/skill (or the directory that allegro.ilinit points to).
axlCmdRegister( "advanceform" `advanceform)
; -----------------------------------------------------------------
procedure( advanceform()
les4_form = axlFormCreate( (gensym) "les4.form" nil 'les4_form_Action t)
axlFormDisplay(les4_form)
); end of procedure
; -----------------------------------------------------------------
procedure( les4_form_Action(les4_form)
case( les4_form->curField
("Close_button"
axlFormClose( les4_form )
axlCancelEnterFun( )
); --------------------------
("Run_button"
les4_form_run()
); --------------------------
); end case
); end of procedure
; -----------------------------------------------------------------
procedure( les4_form_run()
; Create output file to write report
cl_file = outfile("check_list.rpt" "w")
; ------ Print Header
fprintf(cl_file "**********************\n")
fprintf(cl_file " Check List Report\n")
fprintf(cl_file "**********************\n\n")
axlUIWPrint(les4_form getCurrentTime())
; ------ Print CurrentTime
fprintf(cl_file "CurrentTime : %s \n" getCurrentTime())
; ------ Print Designer Name
fprintf(cl_file "PCB Designer Name : %s \n" axlFormGetField( les4_form "name"))
; ------ Print Design Name
fprintf(cl_file "Design Name : %s \n" axlCurrentDesign())
; ------ Print value of check box
if( axlFormGetField(les4_form "check1") then check = "YES" else check = "NO" ); end if
fprintf(cl_file "Do you check DRC? : %s \n" check)
; ------ Print value of popup
fprintf(cl_file "Exist SMD in this project : %s \n" axlFormGetField( les4_form "pop1"))
; ------ Print value of slidebar
fprintf(cl_file "Layers number : %d \n" axlFormGetField( les4_form "slidebar1"))
; ------ Print value of group
if( axlFormGetField(les4_form "both") then
silk_side = "Both"
else
if( axlFormGetField(les4_form "top") then silk_side = "Top" else silk_side = "Bottom" ); end if
); end if
fprintf(cl_file "Silk exist on : %s \n" silk_side)
; ------
close(cl_file)
); end of procedure
; -----------------------------------------------------------------
Now creat another file called les4.form with the following content
FILE_TYPE=FORM_DEFN VERSION=2
FORM
FIXED
PORT 40 40
HEADER "Check List Report"
#=== must define popup before using
POPUP "Yes" "Yes" , "No" "No" .
TILE
#========== using STRFILLIN
TEXT "PCB Designer Name"
FLOC 1 1
ENDTEXT
FIELD name
FLOC 20 1
STRFILLIN 15 20
ENDFIELD
#========== using CHECKLIST
TEXT "Do you checked DRC?"
FLOC 1 5
ENDTEXT
FIELD check1
FLOC 20 5
CHECKLIST "Yes"
ENDFIELD
#========== using POPUP
TEXT "Exist SMD in this project"
FLOC 1 10
ENDTEXT
FIELD pop1
FLOC 20 10
ENUMSET 6
POP "pop1"
ENDFIELD
#========== using INTSLIDEBAR
TEXT "Layers number"
FLOC 1 15
ENDTEXT
FIELD slidebar1
FLOC 20 15
INTSLIDEBAR 2 2
MIN 2
MAX 30
ENDFIELD
#========== using GROUP
TEXT "Silk exist on"
FLOC 1 20
ENDTEXT
GROUP ""
GLOC 18 18
GSIZE 22 5
ENDGROUP
FIELD top
FLOC 19 20
CHECKLIST"Top" "grp"
ENDFIELD
FIELD bottom
FLOC 25 20
CHECKLIST "Bottom" "grp"
ENDFIELD
FIELD both
FLOC 33 20
CHECKLIST "Both" "grp"
ENDFIELD
#========== using MENUBUTTON
FIELD Run_button
FLOC 2 27
MENUBUTTON "Run" 7 3
ENDFIELD
FIELD Close_button
FLOC 11 27
MENUBUTTON "Close" 7 3
ENDFIELD
#======================
ENDTILE
ENDFORM
Save the file in the same directory as you brd file. Assuming everything is right you can just type hello form at the Command and it will pop up a form.

If you fill the form as indicated, it will generate a file called check_list.rpt with the following contents
**********************
Check List Report
**********************
CurrentTime : Feb 10 10:32:20 2013
PCB Designer Name : Refernce Designer
Design Name : KBox_TCxI3_RevB_08_temp
Do you check DRC? : YES
Exist SMD in this project : Yes
Layers number : 4
Silk exist on : Top
Exercise
1. Change the form soo that the test - "Do you checked DRC ?" changes to "Did you check DRC ?".
We have not done any PCB related function, but you may have got the taste of it. You can embed the actions as we will learn later on.