Jump to content

Recommended Posts

Posted

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

Posted

The program works fine for me in 2004.

Load it in the visual lisp editor and debug it so you can see where it is crashing.

In AutoCAD go to tools then autolisp then visual lisp editor

In the editor go to file then open file and navigate to the lisp file in question and load it.

Place you cursor before the open parentheses of the line that says (setvar "cmdecho" 0)

Then hit the F9 key to make a break point. The open parentheses should turn red.

Then go to tools and select “load in text editor”

Change to AutoCAD and type in ARC-PARK and hit enter

This will flip back to the editor

Now use the F8 key to go line by line. This will flip back to acad when you need to answer a prompt then back to the editor.

The program should stop when it gets an error. Then you will know where the error is occurring and be able to fix it or explain what is happening.

Posted

It works fine from my end.

I suggest you type VLIDE to open up the visual lisp editor.

Then use the de bug ger, to see where it stops.

 

edit...see above......

....JohnM beat me to it.

Posted

it is crashing at this line

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

 

at the (abs (-S-ANG E-ANG)))

Posted

Also in mine is going fine .

 

It better to test your selection set if it's matching your entity requirements and after all going ahead with the command .

 

(setq ENT (entsel "\nSelect ARC: "))
(if (eq (cdr (assoc 0 (entget (car ENT)))) "ARC")
 (progn ...........

 

Good luck

Posted

it is crashing at this line

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

 

at the (abs (-S-ANG E-ANG)))

It is probably because your input numbers are too large or small for the code (there's no error trapping).

When it stops check to see what the values are in the watch window (the icon with a pair of reading glasses)

Start by checking to see what the values are for S-ANG and E-ANG.

 

If you still can not work it out what's happening - give an example of your input numbers.

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...