- (defun[color="red"] C:[/color]testline (/ a b) [color="#2e8b57"];; add C: to execute the command testline [/color]
- [color="#2e8b57"];; (/ a b) localize your variables[/color]
- ;define the function
- (setq a (getpoint "\nEnter First Point : "))
- ;get the first point [color="#2e8b57"]; everything after the semi colon will be treated as a comment and will not be evaluated[/color]
- [color="#2e8b57"];; move (setq b on the next line[/color]
- (setq b (getpoint "\nEnter Second Point : ")) ;get the second point
- (command "_.Line" "_none" a "_none" b "")
- [color="#2e8b57"];; underscore means to use the english equivalent of the command
- ;; use . or period just in case the command in use has been undefined
- ;; _none is a transparent command setting the snapmode to 0. If you didn't use _none or _non. If variable point a or b is close to an object either or both will snap to that object.
- [/color]
- ;draw the line
- [color="red"](princ)[/color] [color="#2e8b57"];; exit quietly [/color]
- ) ;end defun
|