error: malformed list on input

error: malformed list on input

Anonymous
Not applicable
2,512 Views
4 Replies
Message 1 of 5

error: malformed list on input

Anonymous
Not applicable

I am currently new to AutoLISP and am struggling to find the error in my code. The error that I am receiving when trying to load the application is "malformed list on input."

 

(defun c:lbox ()

(setvar "cmdecho"0)
(setq sblip (getvar "blipmode"))
(setq sosmd (getvar "osmode"))
(setq scmde (getvar "cmdecho")
(setvar "blipmode" 1)
(setvar "osmode" 0)
(setvar 3dos "3dosmode" 0)
(setvar DDUCS "UCSDETECT" 0)

(setq pt1 (getpoint "\nLocate pt1"))
(setq pt2 (getpoint "\nLocate pt2"))
(setq H (getreal "\n Input height of part "))
(setq D (getreal "\nInput Diameter of hole"))
(setq pt3 (list (car pt1) (cadr pt1) (- H)))
(setq A (- (car pt2) (car pt1))
(setq pt4 (list (car pt2) (cadr pt2) (- A H)))
(setq pt5 (list (+ (car pt) H) (cadr pt1) (caddr pt3)))
(setq pt6 (list (car pt1) (/ (+ (cadrpt1) (cadr pt2))2)) (/ (+ (caddrpt1) (caddr pt4) 2)
(setq pt7 (car pt2) (-(cadr pt6) (caddr pt6)))

(command "color" "red")
(command "box" pt2 pt3)
(setq e1 (entlast))
(command "box" pt4 pt5)
(command "Union" e1 "l" "")
(setq p2 (entlast))
(command "color" "green")
(command "cylinder" pt6 (/ D 2) "A" pt7)
(command "subtract" e2 "" "l" "")

(command "color" "Blue")
(command "UCS" 3 pt3 pt5 pt1)
(command "text" ".5" "Zachary Manners")
(command "UCS" "W")
(command "vpoint" (list 1 -1 1))
(command "hide")

(setvar "blipmode" sblip)
(setvar "cmdecho" scmde)
(setvar "osmode" snp)
(setvar "3dosmode" snp)
(setvar "UCSDETECT" sucs)

)

 

Anyone think they know what I am doing wrong?

0 Likes
2,513 Views
4 Replies
Replies (4)
Message 2 of 5

Ranjit_Singh
Advisor
Advisor

Launch VLIDE and check for matching parenthesis. I just looked and see one parenthesis missing after (setq scmde (getvar 'cmdecho)You may find more checking in VLIDE

0 Likes
Message 3 of 5

SeeMSixty7
Advisor
Advisor
here are a few lines with missing parens This line needed some help (setq scmde (getvar "cmdecho")) This one too (setq A (- (car pt2) (car pt1))) This line was a little messed up too (setq pt6 (list (car pt1) (/ (+ (cadrpt1) (cadr pt2))2) (/ (+ (caddrpt1) (caddr pt4) 2))))
0 Likes
Message 4 of 5

marko_ribar
Advisor
Advisor

I've never seen this before :

 

(setvar 3dos "3dosmode" 0)
(setvar DDUCS "UCSDETECT" 0)

 

Shouldn't it be :

 

(setvar "3dosmode" 0)
(setvar "UCSDETECT" 0)

Marko Ribar, d.i.a. (graduated engineer of architecture)
0 Likes
Message 5 of 5

marko_ribar
Advisor
Advisor

Where are "snp" "sucs" variables defined ?

 

Don't you think you should have a good habit to make your variables localized to avoid conflicts with eventual running routine that is different but uses the same variable names ?

Marko Ribar, d.i.a. (graduated engineer of architecture)