Jump to content

Defun uses f insted of c why????


highrez2

Recommended Posts

working with some old code that I'm not to familiar with, the original writter used a different defun methood that I don't understand.

 

Example

(defun f:SC_GETINSPTS (

 

I can't run the lisp unless I change the "f" to a "c". Why is this? how can I run it without changing the code?

Link to comment
Share on other sites

can you exicute a function?

 

Sure , some of functions need a number of arguments and some of them don't need and that's all related to the person who's programming it .

 

Read THIS

Link to comment
Share on other sites

working with some old code that I'm not to familiar with, the original writter used a different defun methood that I don't understand.

 

Example

(defun f:SC_GETINSPTS (

 

I can't run the lisp unless I change the "f" to a "c". Why is this? how can I run it without changing the code?

The confusion is probably due to the colon. When AutoLISP began using C: to indicate a command, this did not prevent folks from imitating that sort of naming for other functions. The "C:" does indeed indicate the routine can be used as a command on the command line. But other functions, even those with an embedded colon, are handled within parentheses, just as in a LISP routine. So, to run it from the command line as is, put it in parentheses; but note that you must provide whatever variables (arguments) are expected, just as you would in a standard LISP function. That is, any arguments before the forward slash have to have values passed to them.
Link to comment
Share on other sites

If this function does not have any variables or arguments before the backslash, then you can just call it by putting its name in parentheses, e.g.,

(f:SC_GETINSPTS) 

However, if it does require arguments, you will have to supply those at the same time, e.g., if you need to supply a prompt, it will expect a string...

(f:SC_GETINSPTS "Pick some points: ") 

Link to comment
Share on other sites

 

So "c" is for commands

Correct .

 

and "f" is for functions what is "g"

 

Wrong , did you read the link that I brought in the first post ?

Link to comment
Share on other sites


(defun sym ([arguments] [/ variables...]) expr...)

 

 

 

sym

A symbol naming the  function.

 

f and g or whatever is the function name?

Link to comment
Share on other sites

Thanks,

 

So "c" is for commands and "f" is for functions what is "g"

Yes, C: prefix is defined that way. But there is no other such : prefix that I'm aware of. There is at least one AutoLISP function that has :: in it. A programmer could use other such : prefixes for his own purposes, as someone did here, but it's strictly for his own purposes, not AutoCAD defined.

 

Do you know or care anything about LISP, or are you just wanting to get this routine going? If the latter, then you've got more than enough info. If the former, then you've got some links to read.:) If you do need more help, you need to post the code in its entirety and ask questions specifically related. As it is, you gave minimal info.

Link to comment
Share on other sites

f and g or whatever is the function name?
Yes, whatever the function's name is. It could be something straightforward like "GetSomePoints" (don't actually use quotes), or something more cryptic. It's just the name of the function. You could simply use F or G, but that's pretty lame for making sense of the code, and it's much more likely that someone else's code will interfere with your own if you use names that are too simple.
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...