:error ; too many arguments in

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello all,
I'm new to AutoLISP but this is a piece of code I wrote to do some auto dimensioning on polylines
I think I'm doing this correctly, but I get ab error called ":error ; too many arguments" in the command line
Please let me know if I'm missing something-
(defun C:dimensioner (/ pl )
(and (setq pl (ssget '((0 . "LWPOLYLINE"))))
(foreach itm
(setq ptlist (mapcar 'cdr (vl-remove-if-not '(lambda(x)(=(car x) 10))(entget (ssname pl 0)))))
)
)
(setq len (1+ (vl-list-length (cdr ptlist)))) ;retuns the number of co-ordiante pairs in the list called ptlist
(setq p1 (nth 0 ptlist)) ;gets the ith co-ordinate in the list called ptlist
(setq p2 (nth 1 ptlist)) ;gets the jth co-ordinate in the list called ptlist
(setq x1 (nth 0 p1))
(setq x2 (nth 0 p2))
(setq y1 (nth 1 p1))
(setq y2 (nth 1 p2))
(if (= y1 y2)
(
prompt "\nHorizontal dimensioning needed"
(if (< x1 x2)
(
(setq x1 (-2.5+ x1)
x2 (2.5+ x2)
x3 (0.5*(x1+x2))
y1 (5+ y1)
y2 (5+ y2)
y3 (0.5*(y1+y2))
p1 (list (x1 y1))
p2 (list (x2 y2))
p3 (list (x3 y3))); setq ended
(command "dimlinear" p1 p2 p3)
)
(
;do something similar to previous if block
)
(princ))
)
(
prompt "\nVertical dimensioning needed"
)
)
(princ)
)