brandalf_the_semiGray 1 Posted November 26 (edited) I have been just starting to delve into the world of autoLISP, and have seen snippets of code that have, for example defun c: I was able to find out that this makes it so that the user is able to run the function from the command line. Now, the part where I get confused is when I see things like defun rh: What does this line do? I've seen variants in Lee Mac's code that have LM: Is the ':' some sort of a namespace, or scope resolution operator? Can someone point me in the direction of where I can learn more about its use? Thanks in advance! Edited November 26 by brandalf_the_semiGray Quote Share this post Link to post Share on other sites
rkmcswain 71 Posted November 26 [SEE COLON] simply means that the function name following can be used at the command line, like a core function (i.e.: Line, Circle, Pline). If you omit the prefix, or use your own like KW:Fun, then you have to include that part when you call the function name, along with enclosing it in parenthesis (KW:Fun) Some authors do this to their functions for identification purposes. 1 Quote Share this post Link to post Share on other sites
dlanorh 153 Posted November 26 In addition to @rkmcswain excellent answer above, look at these two functions, and spot the differences (defun function_name (passed vars / local_vars) expressions ) (defun C:function_name ( / local_vars) expressions ) 2 Quote Share this post Link to post Share on other sites
Lee Mac 259 Posted November 26 You may wish to refer to my explanation here. 1 1 Quote Share this post Link to post Share on other sites
Lee Mac 259 Posted November 26 3 hours ago, dlanorh said: In addition to @rkmcswain excellent answer above, look at these two functions, and spot the differences (defun function_name (passed vars / local_vars) expressions ) (defun C:function_name ( / local_vars) expressions ) Note that the "c:" prefix has no bearing on whether or not the function may accept arguments - _$ (defun c:foo ( x ) (+ x 2)) C:FOO _$ (c:foo 2) 4 The "c:" prefix is solely use to make a function available as a command which may be executed directly at the AutoCAD command line. Of course, evaluating a function which requires arguments as a command directly at the command line will result in a "too few arguments" error, but these two properties of a function are not related. 1 Quote Share this post Link to post Share on other sites
brandalf_the_semiGray 1 Posted November 26 (edited) 3 hours ago, dlanorh said: In addition to @rkmcswain excellent answer above, look at these two functions, and spot the differences (defun function_name (passed vars / local_vars) expressions ) (defun C:function_name ( / local_vars) expressions ) The differences that catch my eye are the c : prefix to allow command line invocation, as well as one of the functions having passed variables. 25 minutes ago, Lee Mac said: You may wish to refer to my explanation here. This was precisely what I was looking for. Thank you very much to all three of you. Edited November 26 by brandalf_the_semiGray 1 Quote Share this post Link to post Share on other sites
BIGAL 220 Posted November 27 (edited) You can call c : defuns or plain defuns in code I often add run code on a (load "mylisp") to run straight away 1st time. (c:function_name) put this as last line of code also (moblk) as last runs my move block code which is wrapped in a defun called moblk but no need for keyboard input use when really only want to run once. (function_name 12 22) normal function call check to see if lisp is loaded looks for the defun (if (not AH:getvalsm)(load "Multi Getvals.lsp")) (setq ans (AH:getvalsm (list "This is heading" "Line 1" 5 4 "11" "Line2" 8 7 "22" "Line3" 8 7 "33" "Line4" 8 7 "4"))) in a menu these are the same ^c^c(load "mover") mover ^c^c(load "mover")(c:mover) Edited November 27 by BIGAL Quote Share this post Link to post Share on other sites