I'm trying to write a simple Defun code that will start the fillet command and select the Radius option - then go from there.
This is what I have, but it will not work, what am I doing wrong???
(DEFUN C:FR() (COMMAND "FILLET" "RADIUS"))
Solved! Go to Solution.
Try this:
(DEFUN C:TEST39 ( ) (COMMAND ".FILLET" "RADIUS" PAUSE ".FILLET"))
Depending on what about it doesn't work, it could be that you have an undefined/redefined Fillet command [Architectural Desktop does that], in which case (command "fillet" ...) will say it doesn't know that command name. If that's the issue, force it to use the native AutoCAD command, with the decimal/period prefix to the command name:
(DEFUN C:FR () (COMMAND ".FILLET" "RADIUS"))
And if you want people with all different language versions of AutoCAD to be able to use it, add the underscore prefix to the command name and the option word:
(defun C:FR () (command "_.fillet" "_radius"))
What are the exact issues with your original code? When I tried it on my machine it exited the fillet after accepting the radius which is why I suggested simply recalling the fillet after you give it the radius. It seemed to work on my machine.
Zoot, it works on my old autocad, just as he stated.
You may not be loading it properly.
The following string, with no spaces after the last parens, )),
can be copied and pasted into the command line.
(DEFUN C:FR () (COMMAND ".FILLET" "RADIUS"))
A common addition is provide a default value for the radius.
A comment on command naming: use a full command name (e.g. FILLETRAD rather than an abbreviated one (FR). If you decide to use FR for something else later on you need to go through the PGP, LISP files, and so on to find it. Given the limited number of two letter combinations its possible to run into naming conflicts as well, where another C:FR defun will replace this one. Use the PGP the same as you would with any other built-in command to associate FR with the full command name.
@dgorsman wrote:
... use a full command name (e.g. FILLETRAD rather than an abbreviated one (FR). ....
[But in this case, don't use FILLETRAD specifically -- that's a System Variable name, and therefore also already a "command" name, since System Variable names can be used like commands, to set their values. Use FILRAD, or FILLETR, or (for quicker left-hand-only typing) FRAD, or FFR, or something.]