Jump to content

; error: bad argument type: numberp: nil


jpl

Recommended Posts

am using lisp routine ARC-PARK in 2011 and getting this error. Have seen older posts with same error, but not code savvy. None specifically addressing this lisp.

any help would be greatly appreciated.

 

;Tip1815: ARC-PARK.LSP PARKING ON AN ARC ©2002, Ron Engberg

 

;; This routine allows the user to place parking stalls along an arc.

;;

;; Written by Ron Engberg 12-2000

 

;; Radians to degrees

(defun RTD ® (* (/ R pi) 180))

;; Degrees to Radians

(defun DTR ® (/ (* 2 pi) 360))

 

(defun

C:ARC-PARK (/ ENT ARC-PT1 STALL-W STALL-L ARC-SIDE ARC-DIR

STALL-COUNT ARC_LIST ARC-CPT ARC-DIAM S-ANG E-ANG

ARC-CIRC DELTA ARC-LENGTH STALL-ANGLE-IN STALL-ANGLE-OUT

ARC-BASE ARC-ROT-ANGLE

)

;; Screen echo off

(setvar "cmdecho" 0)

;; Set to World UCS

(command "ucs" "w")

;; Parking stall information

(setq ENT (entsel "\nSelect ARC: "))

(initget 1)

(setq ARC-PT1 (getpoint "\nStarting End of ARC: "))

(initget 7)

(setq STALL-W (getreal "\nStall Width: "))

(initget 7)

(setq STALL-L (getreal "\nStall Length: "))

(setq ARC-SIDE (getstring "\nInside or Outside : "))

(setq

ARC-DIR

(getstring "\nClockwise or Counter Clockwise : ")

) ;_ end of setq

(initget 7)

(setq STALL-COUNT (getint "\nNumber of Stalls: "))

;; Arc information

(setq ARC_LIST (entget (car ENT)))

(setq ARC-CPT (cdr (assoc 10 ARC_LIST))) ;center point

(setq ARC-DIAM (* (cdr (assoc 40 ARC_LIST)) 2)) ;arc diameter

(if (or (= ARC-SIDE "I") (= ARC-SIDE "i"))

(setq ARC-DIAM (- ARC-DIAM (* 2 STALL-L)))

) ;_ end of if

(setq

S-ANG

(cdr (assoc 50 ARC_LIST)) ;start angle

E-ANG

(cdr (assoc 51 ARC_LIST)) ;end angle

ARC-CIRC

(* pi ARC-DIAM) ;arc circumference

;arc length

) ; end arc info

;; Test for delta angle

(if (> S_ANG E_ANG)

(setq DELTA (+ (- 6.2831853 S-ANG) E-ANG))

(setq DELTA (abs (- S-ANG E-ANG)))

) ; end if

(setq ARC-LENGTH (* (cdr (assoc 40 ARC_LIST)) DELTA))

;; Angle for starter line

(setq

STALL-ANGLE-IN

(angle ARC-PT1 ARC-CPT) ;stalls inside arc

STALL-ANGLE-OUT

(angle ARC-CPT ARC-PT1) ;stalls outside arc

) ; end set group

;; Rotation info

(setq

ARC-BASE

(/ ARC-CIRC 360.0000) ;length per degree

ARC-ROT-ANGLE

(/ STALL-W ARC-BASE) ;degrees per stall

) ; end set group

;; Test for inside or outside

(if (or (= ARC-SIDE "I") (= ARC-SIDE "i")) ;case sensitive ?

(command "line" ARC-PT1 (polar ARC-PT1 STALL-ANGLE-IN STALL-L) "")

;if inside

(command "line" ARC-PT1 (polar ARC-PT1 STALL-ANGLE-OUT STALL-L) "")

;else, outside

) ;end if

;; Test for clockwise or counter clockwise

(if (or (= ARC-DIR "CCW") (= ARC-DIR "ccw")) ;case sensitive ?

(progn

(repeat STALL-COUNT

(command "array" "l" "" "P" ARC-CPT "2" ARC-ROT-ANGLE "Y")

) ;_ end of repeat

) ; if ccw

(progn

(repeat STALL-COUNT

(command

"array"

"l"

""

"P"

ARC-CPT

"2"

(- ARC-ROT-ANGLE (* 2 ARC-ROT-ANGLE))

"Y"

) ;_ end of command

) ;_ end of repeat

) ; else cw

) ; end if

;; Reset UCS

(command "ucs" "p")

(princ)

;; Screen echo on

(setvar "cmdecho" 1)

) ;_ end of defun

Edited by jpl
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...