Display full version of the post: Lisp - Need Help with a Command List Lisp

CadMonkey7038
10.12.2013, 23:30
Hello,I currently work with a 10-key program called Launchpad, it most definitely made me much faster at cad, one hand on mouse and one on ten key = much less typing.  I don't want to be dependent on the software so I kind of duplicated a simple command list lisp routine that will do pretty much the same thing.  I am not a programmer so I am definitely not good at writing lisp routines.Any help would be appreciated, here is the list currently with what commands are working and which are not. Anyone who is good with lisps could probably fix the non-working ones in no time.  The osnaps are the most important function IMO.;;;LIMITS - DRAWING LIMITS WORKING(DEFUN C:06 () (COMMAND "_LIMITS"));;;UNDO WORKING(DEFUN C:09 () (COMMAND "_U"));;;LAYER - CHANGE TO CURRENT LAYER WORKING(DEFUN C:10 () (COMMAND "_LAYCUR"));;;LINETYPE WORKING(DEFUN C:11 () (COMMAND "_LINETYPE"));;;TEXT EDIT WORKING(DEFUN C:12 () (COMMAND "_DDEDIT"));;;LAYER OFF WORKING(DEFUN C:16 () (COMMAND "_LAYOFF"));;;POLYLINE MAKER NOT WORKING(DEFUN C:17 () (COMMAND "_PM"));;;COPY WITH BASEPOINT WORKING(DEFUN C:19 () (COMMAND "_COPYBASE"));;;PASTE WORKING(DEFUN C:20 () (COMMAND "_PASTECLIP"));;;ERASE WORKING(DEFUN C:21 () (COMMAND "_ERASE"));;;COPY WORKS BUT ONLY 1 COPY NOT MULTIPLE(DEFUN C:24 () (COMMAND "_COPY"));;;LTSCALE WORKING(DEFUN C:26 () (COMMAND "LTSCALE"));;;MOVE WORKING(DEFUN C:27 () (COMMAND "_MOVE"));;;LAYER, LAYER LOCK WORKING(DEFUN C:28 () (COMMAND "LAYLCK"));;;CONSTRUCTION LINE WORKING(DEFUN C:29 () (COMMAND "_XLINE"));;;RECTANGLE WORKING(DEFUN C:31 () (COMMAND "_RECTANGLE"));;;SINGLE LINE TEXT WORKING(DEFUN C:32 () (COMMAND "_DTEXT"));;;CANCEL NOT WORKING, DON'T KNOW (DEFUN C:33 () (COMMAND "_CANCEL"));;;HATCH WORKING(DEFUN C:34 () (COMMAND "_BHATCH"));;;HATCH WORKING(DEFUN C:35 () (COMMAND "_LIST"));;;REGEN ALL NOT WORKING(DEFUN C:37 () (COMMAND "_REA"));;;LAYER MANAGER NOT WORKING(DEFUN C:38 () (COMMAND "_LMAN"));;;XREF NOT WORKING(DEFUN C:39 () (COMMAND "_XREF"));;;SAVE WORKING(DEFUN C:40 () (COMMAND "QSAVE"));;;EXPLODE WORKING(DEFUN C:41 () (COMMAND "EXPLODE"));;;DISTANCE WORKING(DEFUN C:42 () (COMMAND "DIST"));;;CIRCLE WORKING(DEFUN C:43 () (COMMAND "CIRCLE"));;;EXTEND WORKING(DEFUN C:44 () (COMMAND "EXTEND"));;;MULTIPLE EXTEND NOT WORKING(DEFUN C:45 () (COMMAND "_ME"));;;GLUE NOT WORKING(DEFUN C:46 () (COMMAND "GLUE"));;;STRETCH WORKING(DEFUN C:47 () (COMMAND "STRETCH"));;;MULTIPLE TRIM NOT WORKING(DEFUN C:48 () (COMMAND "MT"));;;TRIM WORKING(DEFUN C:49 () (COMMAND "TRIM"));;;BREAK AT POINT WORKING(DEFUN C:50 () (COMMAND "BREAK"));;;FILLET NOT WORKING(DEFUN C:51 () (COMMAND "_FILLET"));;;REVCLOUD WORKING(DEFUN C:52 () (COMMAND "_REVCLOUD"));;;DIVIDE WORKING(DEFUN C:53 () (COMMAND "_DIVIDE"));;;FILLET RADIUS NOT WORKING(DEFUN C:54 () (COMMAND "FILLET"));;;LINE WORKING(DEFUN C:55 () (COMMAND "_LINE"));;;OFFSET WORKING(DEFUN C:56 () (COMMAND "_OFFSET"));;;MIRROR WORKING(DEFUN C:57 () (COMMAND "_MIRROR"));;;POLYGON WORKING(DEFUN C:58 () (COMMAND "_POLYGON"));;;CHAMFER NOT WORKING(DEFUN C:60 () (COMMAND "_CHAMFER"));;;POLYLINE EDIT NOT WORKING(DEFUN C:61 () (COMMAND "_PEDIT"));;;POLYLINE NOT WORKING(DEFUN C:62 () (COMMAND "PL"));;;ARRAY WORKING(DEFUN C:63 () (COMMAND "_ARRAY"));;;SCALE WORKING(DEFUN C:64 () (COMMAND "_SCALE"));;;ARC, 3 POINTS WORKING(DEFUN C:66 () (COMMAND "_ARC"));;;ROTATE WORKING(DEFUN C:67 () (COMMAND "_ROTATE"));;;PROPERTIES NOT WORKING(DEFUN C:70 () (COMMAND "_PROPERTIES"));;;SNAP, INSERT NOT WORKING(DEFUN C:71 () (COMMAND "_INS"));;;SNAP, QUADRANT NOT WORKING(DEFUN C:72 () (COMMAND "_QUA"));;;SNAP, NODE NOT WORKING(DEFUN C:73 () (COMMAND "_NOD"));;;SNAP, PERPENDICULAR NOT WORKING(DEFUN C:74 () (COMMAND "_PER"));;;SNAP, CENTER NOT WORKING(DEFUN C:75 () (COMMAND "_CEN"));;;SNAP, ENDPOINT NOT WORKING(DEFUN C:76 () (COMMAND "_ENDP"));;;SNAP, NEAREST NOT WORKING(DEFUN C:77 () (COMMAND "_NEA"));;;SNAP, MIDPOINT NOT WORKING(DEFUN C:78 () (COMMAND "_MID"));;;SNAP, INTERSECTION NOT WORKING(DEFUN C:79 () (COMMAND "_INT"));;;EndAny help would be much appreciated, anyone who is good with lisps could probably fix the non-working ones in no time.  The osnaps are the most important function IMO.Thanks

Vladimir Michl
11.12.2013, 08:59

You should call an existing command in the "(command)" function. E.g. GLUE and PL are no real command names. The _INT, _MID, etc. are osnap modes, should work inside other commands.

Kent Cooper
13.12.2013, 16:17
To elaborate on non-native-AutoCAD commands not being usable inside (command) functions:
If PM is a User-defined command by way of (defun C:PM ...), it should be called this way:

;;;POLYLINE MAKER
(DEFUN C:17 () (C:PM))
 
and similarly with others, though I wonder whether it's any easier to type 17 to get it than just to type PM directly, but I'll leave that to you.
 
In the case of Cancel, there is no such command name [it's not in the Command Reference].  Issuing a (command) function with no arguments will cancel most commands [see the AutoLISP Reference about it]:
 

;;;CANCEL 
(DEFUN C:33 () (COMMAND))
 
In some cases, maybe you have an overlay program that has redefined some commands, including undefining the native command name, in which case (command) won't recognize it.  If you precede all actual AutoCAD command names with a period/decimal [or an underscore and a period/decimal], it will force it to use the native command definition instead of the redefinition, for example:
 

;;;FILLET
(DEFUN C:51 () (COMMAND "_.FILLET"))

CadMonkey7038
13.12.2013, 19:54
Thanks for the help thus far guys.Vladimir, I don't know how to write it in to be an existing commands, will i have to come up with the verbage and than insert it into every command to enable it?Kent, I will definitely try the _."command" I just noticed the "." yesterday.  As far as easier to do, I don't use the keyboard unless I am typing in text or numerical distances typically, speeds up performance tremendously IMO.