Originally Posted by
mlb6d9763438
Hi Guys - this LISP does exactly what I want it to, but I can't get it to work unless I APPLOAD it every time I need it. If I type 'arc-length' which I assume is the command, it just says 'unkown command.' I'm no LISP expert, what am I doing wrong?
This lisp didn't have a command function, may have been part of a bigger routine or the author wanted it to run on appload.
Anywho, you still need to appload it per session or add it to your startup suite or acaddoc.lsp, but I added "test" for the command you can change it to whatever you need.
Code:
;;;CADALYST Tips & Tools Weekly 05/08/06 arc-length.lsp (c) 2006 Derek Beals
;File Name: arc-length
;Written By: derek 'maverick' beals
;Version: a
;Date: 9-26-05
;Description: this lisp routine draws an arc at given length & radius
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Non-Standard Lisp Functions
(defun c:test () ;;<-added command defun
(defun rtd (r) ; Radians to Degrees
(/ (* r 180.0) pi))
(defun dtr (d) ; Degrees to Radians
(/ (* d pi) 180.0))
(defun tan (a) ; Tangent of variable (a) in Radians
(/ (sin a) (cos a)))
(defun sqr (a) (* a a)) ; Squares the variable (a)
(defun fixx (realnum) ; Rounds the variable (realnum) to the next highest whole integer (opposite of the "fix" function)
(if (> realnum (+ (fix realnum) 0))
(setq realnum (1+ (fix realnum)))
(setq realnum (fix realnum))
)
realnum
)
;(setq variable (ssget)) - allows multiple picks in lisp
;(setq OS (getvar "osmode"))...(setvar "osmode" OS) - gets current O-snap settings @ front of lisp, then reestablishes them at the end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Lisp Programming starts here
(setq LENG (getdist "\nEnter length of arc: ")
RAD (getdist "\nEnter radius of arc: ")
CEN (getpoint "\nPick center point of arc: ")
ANG (/ LENG RAD)
ANG1 (/ (- PI ANG) 2.0)
ANG2 (/ (+ PI ANG) 2.0)
ARC (entmake (list
(cons 0 "ARC")
(cons 10 CEN)
(cons 40 RAD)
(cons 50 ANG1)
(cons 51 ANG2)))
) );;<-added closing parenthesis
(princ)