Too few arguements

Too few arguements

Anonymous
Not applicable
876 Views
4 Replies
Message 1 of 5

Too few arguements

Anonymous
Not applicable

I have a slate of pre-defined colors that I use to programmatically control layers.

I am writing a routine to draw a chart showing the color number, a solid showing the specified color as a square, and below that the name of the variable that contains the color.  My problem is that when I call (drawmark), it will not even run. It reports "Too few arguments".  Does anyone else get this error? What is causing it?

 

;define the color variables

(setq CLR-RED1 241 CLR-RED2 230 CLR-RED3 1 CLR-RED4 242 CLR-RED5 244)

 

;get the start point and calculate all required points (easier to debug)
(defun MARKPOINTS (/ PT P1 P2 P3 P4 BDRPTS& CNUMTXPT CLRSQPTS& CNAMTXPT C)
   (setq PT (getpoint "\nPick upper left point"))
  (setq P1 PT P2 (polar P1 0 20) P3 (polar P2 (* PI 1.5) 30) P4 (polar P1 (* PI 1.5) 30))
  (setq BDRPTS& (list P1 P2 P3 P4))
  (setq C (polar PT 0 10))
  (setq C (polar C (* PI 1.5) 8))
  (setq CNUMTXPT C)
  (setq C (polar C (* PI 1.5) 2))
  (setq P1 (polar C PI 5) P2 (polar C 0 5) P3 (polar P2 (* PI 1.5) 10) P4 (polar P1 (* PI 1.5) 10))
  (setq CLRSQPTS& (list P1 P2 P4 P3))
  (setq C (polar C (* PI 1.5) 18))
  (setq CNAMTXPT C)
  (list BDRPTS& CNUMTXPT CLRSQPTS& CNAMTXPT)
)

 

;draw the mark and label it
(defun DRAWMARK (\ PTS& OSM CLR)
  (setq PTS& (markpoints))
  (command "_.PLINE") (foreach F_PT (car PTS&)(command F_PT)) (command "c")
  (command "_.TEXT" "J" "C" (cadr PTS&) "6" "0" CLR "")
  (command "_.SOLID") (foreach F_PT (caddr PTS&)(command F_PT)) (command "")
  (setq CLR (itoa (eval (read VARNAM))))
  (command "_.CHPROP" "L" "" "C" CLR "")
  (command "_.TEXT" "J" "C" (cadddr PTS&) "6" "0" (substr VARNAM 5) "")
  (prin1)
)

 

(setq VARNAM "CLR-RED1") ;set a global variable with the name of the variable

(drawmark)      ;call the routine

0 Likes
Accepted solutions (1)
877 Views
4 Replies
Replies (4)
Message 2 of 5

Ranjit_Singh
Advisor
Advisor

Try changing this line
(defun DRAWMARK (\ PTS& OSM CLR)

to
(defun DRAWMARK ( / PTS& OSM CLR)

I am not on the computer right now and cannot check the code. Maybe someone else can test.

 

0 Likes
Message 3 of 5

john.uhden
Mentor
Mentor
The problem is in:
(defun DRAWMARK (\ PTS& OSM CLR)

The backslash should be a forward slash, "/"

AutoCAD is interpreting your backslash as an argument symbol name.
If you were to call the function with 4 arguments, it would work accordingly...

(drawmark "A" "B" "C" "D)
would read \ as "A", and PTS& as "B", etc.

Changing the backslash to a foreslash would treat PTS&, OSM. and CLR as locals, which I think you intended.

John F. Uhden

0 Likes
Message 4 of 5

Anonymous
Not applicable
Accepted solution

That fixed it.  Couldn't see the forest with all the trees in the way.  Thanks

0 Likes
Message 5 of 5

john.uhden
Mentor
Mentor
Learning is what keeps us young (said the old fart.)

John F. Uhden

0 Likes