polar does not recognise stored points / gives too many arguments

polar does not recognise stored points / gives too many arguments

Anonymous
Not applicable
734 Views
1 Reply
Message 1 of 2

polar does not recognise stored points / gives too many arguments

Anonymous
Not applicable

I am trying to write a routine that takes user defined variables (scale, orientation, starting point) and defines points based on the given values.

 

When I load the routine I get the error:

bad variable name in SETQ: (NTH (+ WINCNT 1) WINDEXT)

 

When I try to run the routine I get:

; error: too many arguments

 

(defun c:tmp () ;Define function

;***********************************************************************
;Set and check scale

(setq scl (getstring "\nScale : ")) ;Get scale


(cond
((= scl "1:100") (setq sclnum 1)) ;Values greater than 1:1
((= scl "1:150") (setq sclnum 1.5))
((= scl "1:200") (setq sclnum 2))
((= scl "1:250") (setq sclnum 2.5))
((= scl "1:300") (setq sclnum 3))
((= scl "1:350") (setq sclnum 3.5))
((= scl "1:400") (setq sclnum 4))
((= scl "1:450") (setq sclnum 4.5))
((= scl "1:500") (setq sclnum 5))


((= scl "1:75") (setq sclnum 0.75)) ;values less than 1:1
((= scl "1:50") (setq sclnum 0.5))
(T (alert "\nScale not viable. Abort routine")) ;Display unplanned scale message
) ;cond

 

(setq LLUR (* sclnum 50.655)) ;Set scaled dim from LL(a) to UR(a)
(setq URLL (* sclnum 30.523)) ;Set scaled dim from UR(a) to LL(b)


;***********************************************************************
;Set other variables

(setq ori (getstring "\nOrientation : ")) ;Get orientation
(setq shtn (getint "\nNumber of Sheets : ")) ;Get number of sheets

;***********************************************************************
;Degrees to Radians function

(defun dtr (x) ;Define degrees to radians
(* pi (/ x 180)) ;Divide angle by 180 then multiply by Pi
) ;End function

;***********************************************************************
;Polar calcs for window coords

 

(setq WinCnt 0) ;Set window count to 0


(setq WindExt (list ;Set list to store window values
Pg01LL Pg01UR Pg02LL Pg02UR ;00 01 02 03
Pg03LL Pg03UR Pg04LL Pg04UR ;04 05 06 07
Pg05LL Pg05UR Pg06LL Pg06UR ;08 09 10 11
Pg07LL Pg07UR Pg08LL Pg08UR ;12 13 14 15
Pg09LL Pg09UR Pg10LL Pg10UR ;16 17 18 19
Pg11LL Pg11UR Pg12LL Pg12UR ;20 21 22 23
Pg13LL Pg13UR Pg14LL Pg14UR ;24 25 26 27
Pg15LL Pg15UR Pg16LL Pg16UR ;28 29 30 31
Pg17LL Pg17UR Pg18LL Pg18UR ;32 33 34 35
Pg19LL Pg19UR Pg20LL Pg20UR ;36 37 38 39
Pg21LL Pg21UR Pg22LL Pg22UR ;40 41 42 43
Pg23LL Pg23UR Pg24LL Pg24UR ;44 45 46 47
Pg25LL Pg25UR Pg26LL Pg26UR ;48 49 50 51
Pg27LL Pg27UR Pg28LL Pg28UR ;52 53 54 55
Pg29LL Pg29UR Pg30LL Pg30UR ;56 57 58 59
Pg31LL Pg31UR Pg32LL Pg32UR ;60 61 62 63
Pg33LL Pg33UR Pg34LL Pg34UR ;64 65 66 67
Pg35LL PG35UR Pg36LL Pg36UR ;68 69 70 71
Pg38LL Pg38UR Pg39LL Pg39UR ;72 73 74 75
Pg40LL Pg40UR Pg41LL Pg41UR ;76 77 78 79
Pg42LL Pg42UR Pg43LL Pg43UR ;80 81 82 83
Pg44LL Pg44UR Pg45LL Pg45UR ;84 85 86 87
)) ;End list function

 

(setq Pg01LL (getpoint "\nLower left corner of sheet 1 : ")) ;Get starting coords


(setq (nth (+ WinCnt 1) WindExt) (Polar (nth WinCnt WindExt) 0.965 LLUR)) ;stupid bit that doesn't work


(princ) ;Clean print

) ;End Defun

 

What am i doing wrong / how can I fix this?

 

0 Likes
Accepted solutions (1)
735 Views
1 Reply
Reply (1)
Message 2 of 2

pbejse
Mentor
Mentor
Accepted solution

@Anonymous wrote:

(setq (nth (+ WinCnt 1) WindExt) (Polar (nth WinCnt WindExt) 0.965 LLUR)) ;stupid bit that doesn't work

 

What am i doing wrong / how can I fix this?


 

If you are planning to use elements of  WindExt as a variable name you can do that using this approach.

 

		    (setq WindExt (list	 'Pg01LL    'Pg01UR    'Pg02LL	'Pg02UR))
		     
		    (set (nth (+ WinCnt 1) WindExt)
		     		(Polar (eval (nth WinCnt WindExt)) 0.965 LLUR))

HTH

 

 

 

0 Likes