scripting in AutoCAD is very interesting!
Let me show you the basic level scripting that animate the 2D gears.
First get your gears done in 2D AutoCAD.
Use "g" in command prompt to create group
Put each gear in separate group, name each group "1" & "2"
now open notepad and write down following script
NOTE: here, we are ordering our beloved autocad to rotate the group 1 with 1 speed about (x,y) axis(co-ordinates).... same withe the group 2, rotate the group 2 with -1 speed about (p,q) axis(co-ordinates)
Use "ID" command to locate the center-point of gear.
now save your notepad file with [.scr] extension
your file name can be any thing.
mine is "gear.scr"
now type "scr" in your autocad command prompt, hit enter, browse to the "XYZ.scr" file you just created.. and you've done!!!!