lido Posted April 12, 2018 Share Posted April 12, 2018 Hello all! I have an AutoLISP code that goes to the client along with drawings. The code contains a sequence for attribute editing with either EATTEDIT built-in command or an AutoLISP snippet. On this stage, I don't know if the EATTEDIT built-in command is implemented under the client CAD platform, so that I must check the availability of the command. Is there any possibility to obtain via AutoLISP a complete list of AutoCAD internal (built-in) commands? Thank you in advance. Quote Link to comment Share on other sites More sharing options...
rlx Posted April 12, 2018 Share Posted April 12, 2018 http://www.cadtutor.net/forum/showthread.php?67454-List-all-defined-functions.&highlight=atoms-family Quote Link to comment Share on other sites More sharing options...
lido Posted April 12, 2018 Author Share Posted April 12, 2018 Sorry, but atoms-family function don't return the built-in command names. Please try it. Quote Link to comment Share on other sites More sharing options...
rkmcswain Posted April 12, 2018 Share Posted April 12, 2018 Is there any possibility to obtain via AutoLISP a complete list of AutoCAD internal (built-in) commands? ARX command, "C" option. Here is an entire thread on this topic, including some good lisp routines. Quote Link to comment Share on other sites More sharing options...
rlx Posted April 12, 2018 Share Posted April 12, 2018 Sorry, but atoms-family function don't return the built-in command names. Please try it. oh darn... hope other reply does better... maybe vl-cmdf can offer a quick test because it first tests if a command can be successful before it executes it else just check autocad version Quote Link to comment Share on other sites More sharing options...
lido Posted April 12, 2018 Author Share Posted April 12, 2018 I know the trick with ARX, option "C". EATTEDIT still missing from the list (AutoCAD 2015). Please give it a try. Quote Link to comment Share on other sites More sharing options...
ronjonp Posted April 12, 2018 Share Posted April 12, 2018 (edited) Not a full list .. but here's a quick check: ... Edited April 12, 2018 by ronjonp *removed code suggestion does not work DOH! Quote Link to comment Share on other sites More sharing options...
Roy_043 Posted April 12, 2018 Share Posted April 12, 2018 How about?: (getcname "_eattedit") Quote Link to comment Share on other sites More sharing options...
lido Posted April 12, 2018 Author Share Posted April 12, 2018 (vl-cmdf "abcde") return: Unknown command "abcde". Press F1 for help. T (command "abcde") return: Unknown command "abcde". Press F1 for help. nil Finally, always vl-cmdf function return T and command function return nil. How could I manage an error like "Unknow command" without an error code?? Testing the AutoCAD version may be a path... But if the client uses an other CAD platform? First test the platform (PROGRAM system variable). Then test the version (VERNUM system variable) and decide if EATTEDIT is implemented or not by reading specific CAD manuals. No, please... Quote Link to comment Share on other sites More sharing options...
ronjonp Posted April 12, 2018 Share Posted April 12, 2018 Use Roy's suggestion .. or better yet get rid of command calls in your code. Quote Link to comment Share on other sites More sharing options...
rlx Posted April 12, 2018 Share Posted April 12, 2018 (vl-cmdf "abcde") return: Unknown command "abcde". Press F1 for help. T(command "abcde") return: Unknown command "abcde". Press F1 for help. nil Finally, always vl-cmdf function return T and command function return nil. How could I manage an error like "Unknow command" without an error code?? Testing the AutoCAD version may be a path... But if the client uses an other CAD platform? First test the platform (PROGRAM system variable). Then test the version (VERNUM system variable) and decide if EATTEDIT is implemented or not by reading specific CAD manuals. No, please... mabe app needs rewrite or better error catching (setq test (vl-catch-all-apply 'command-s (list "eattedit"))) vs (setq test (vl-catch-all-apply 'command-s (list "lido-edit"))) but if client uses other CAD platform you're even further from a solution. but doesn't (Roy's) getcname work? Quote Link to comment Share on other sites More sharing options...
lido Posted April 12, 2018 Author Share Posted April 12, 2018 I tried these functions before posting on this forum! Under AutoCAD 2015: (getcname "_eattedit") return nil (getcname "eattedit") return nil (= (type 'eattedit) 'sym) return T (= (type 'abcde) 'sym) return T Quote Link to comment Share on other sites More sharing options...
ronjonp Posted April 12, 2018 Share Posted April 12, 2018 I tried these functions before posting on this forum!... Then learn to ask a better question. "Describe the diagnostic steps you took to try and pin down the problem yourself before you asked the question." Quote Link to comment Share on other sites More sharing options...
lido Posted April 12, 2018 Author Share Posted April 12, 2018 Catching error with vl-catch-all-apply and vl-catch-all-error-p functions are OK but don't solve the problem entirely. Because of command-s function. Using command or vl-cmdf functions, fails. Unfortunately, the command-s function is not implemented under older AutoCAD releases (e.g. AutoCAD 2000) or under some CAD platforms (e.g. ZWCAD). So, in my opinion, the only way to solve the problem is by getting that damn list of all built-in AutoCAD commands. It is possible or not? Quote Link to comment Share on other sites More sharing options...
lido Posted April 12, 2018 Author Share Posted April 12, 2018 Sorry mr. ronjonp for wasting your time. Aggression cannot, under any circumstances, solve none problem! Quote Link to comment Share on other sites More sharing options...
rlx Posted April 12, 2018 Share Posted April 12, 2018 Maybe a certain L(ist) M(anipulator) has some bright idea or knows of a undocumented command. But I am curious ,if and when you know eattedit is not available , what are you gonna do with this knowledge. Just display a message with sorry command not available or do you have a backup routine? I think there are more than enough people on this site able and willing to help you to rewrite your routine or just the part you need. Just 'be kind & rewind' ... Quote Link to comment Share on other sites More sharing options...
Roy_043 Posted April 12, 2018 Share Posted April 12, 2018 To my knowledge there is no way to obtain a list of command names via Lisp code. For _eattedit and other commands that require user input something like this should work (on most CAD platforms I believe): (defun CommandAvailable_P (cmd / ret) (setvar 'cmdecho 0) (command cmd) (setq ret (if (zerop (getvar 'cmdactive)) (progn (princ "\r") ; Remove: 'Unable to recognize command "ABC". Please try again.' prompt. nil ) (progn (command nil) T ) ) ) (setvar 'cmdecho 1) ret ) Quote Link to comment Share on other sites More sharing options...
Roy_043 Posted April 12, 2018 Share Posted April 12, 2018 FYI: getcname works fine in BricsCAD: (getcname "_eattedit") => "EATTEDIT" (getcname "_doesnotexist") => nil Quote Link to comment Share on other sites More sharing options...
lido Posted April 12, 2018 Author Share Posted April 12, 2018 Thank you very much Roy_043. Using the system variable CMDACTIVE is the key! I never think about this approach. Brilliant. Thank you one more time. Quote Link to comment Share on other sites More sharing options...
hanhphuc Posted April 12, 2018 Share Posted April 12, 2018 (edited) Just test only.. [color="green"];At this level we can list out [/color] ([color="blue"]vl-registry-descendents[/color] (strcat "HKEY_LOCAL_MACHINE\\" (vlax-product-key) "\\Applications\\") ) [color="green"];but why this level doesn't work ???[/color] ([color="blue"]vl-registry-descendents[/color] (strcat "HKEY_LOCAL_MACHINE\\" (vlax-product-key) "\\Applications\\" "AcEAttEdit" [color="red"]"\\Commands"[/color] ) ) another approach (defun foo (app ac cmd) (and (setq app (findfile app)) (vl-registry-read (strcat "HKEY_LOCAL_MACHINE\\" (vlax-product-key) "\\Applications\\" ac "\\Commands") (strcase cmd ) ) ) ) _$ (foo "AcEAttEdit.arx" "AcEAttEdit" "EATTEDIT") T _$ (foo "AcTable.arx" "AcadTable" "EATTEDIT") nil _$ (foo "AcTable.arx" "AcadTable" "TINSERT") T Edited November 1, 2018 by hanhphuc added ac Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.