Allegro SKILL Tutorial | Forms
In the previous post we saw how to draw a line between two coordinates (10,10) and (100, 100) using command line . We will noe extend this example so that we put everything inside an il file. Also we will have a pop up window which will ask for coordinates of start and end of the line. Copy the following code in a file called line.il
axlCmdRegister( "line1" `line1)
; -----------------------------------------------------------------
procedure( line1()
;les4_form = axlFormCreate( (gensym) "line.form" nil 'les4_form_Action t)
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()
start = list(axlFormGetField( les4_form "x1") axlFormGetField( les4_form "y1"))
end = list(axlFormGetField( les4_form "x2") axlFormGetField( les4_form "y2"))
l_vertices =list(start end)
axlDBCreateLine(l_vertices 10 "Package Geometry/Silkscreen_Top")
); end of procedure
; -----------------------------------------------------------------
For the form portion of this action we will put the following in a file called les4.form
FILE_TYPE=FORM_DEFN VERSION=2
FORM
FIXED
PORT 40 40
HEADER "Draw Dotted Line"
#=== must define popup before using
POPUP "Yes" "Yes" , "No" "No" .
TILE
#========== using INTFILLIN
TEXT "x1 : "
FLOC 1 1
ENDTEXT
FIELD x1
FLOC 5 1
INTFILLIN 15 20
ENDFIELD
TEXT "y1 : "
FLOC 1 5
ENDTEXT
FIELD y1
FLOC 5 5
INTFILLIN 15 5
ENDFIELD
TEXT "x2 : "
FLOC 1 10
ENDTEXT
FIELD x2
FLOC 5 10
INTFILLIN 15 20
ENDFIELD
TEXT "y2 : "
FLOC 1 15
ENDTEXT
FIELD y2
FLOC 5 15
INTFILLIN 15 5
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
To run it give the command line1 and it will pop up a window where you can enter the start and the end coordinates. .
Here is the youtube for this demonstration.