Discussion about the program
At the first line, defun is an auto lisp command, which is used to define a user define function. The word after the letter C: is used to call the function from autocad. Here it is flywheel, so after loading the program, if you type flywheel at the command prompt of autocad, the whole program should be executed. Please note that the defun function starts with “(“at the first line of the program and ends with the “)" at the last line of the program.
Another important command used here is setq, it is used for assigning something to a variable. Say, you want to assign 5 with the variable X, and then you may have to go like:
(setq X 5)
getpoint, getdist and getint are used for getting user inputs in terms of points, distances and integer values respectively.
Command function is used for using autocad commands in auto lisp codes. Observe the individual autocad command behavior carefully before using it with command function.
We have used the loop statement repeat in order to draw multiple circles as per user inputs. Syntax of the repeat is:
(repeat n expr...])
n indicates the number of times the expr.. needs to be repeated. Expr.. Typically are the combinations of auto lisp codes to be executed under repetition cycles. In our case, we have created for holes for bolting the flywheel.
The program discussed here is just an approach to write auto lisp codes for your specific needs and there are many number of combinations of codes are possible to achieve a task.