guitarguy1685 发表于 2022-7-6 11:47:54

What's wrong with this?

The following is just my very first attempt at a lisp to change 5 attribute values in a block.So far I just want to see if I can even find the attribues via DXF codes.

(defun C:Test1 (setq Ename (entlast)) (setq Att1 (entnext Ename)) (setq Att2 (entnext Att1)) (setq Att3 (entnext Att2)) (setq Att4 (entnext Att3)) (setq Att5 (entnext Att4)) (princ Att1) (princ Att2) (princ Att3) (princ Att4) (princ Att5) )
 
This is the error I get
 
however if I paste one line at a time it seems to work.what am I missing? probably something very simple.

CarlB 发表于 2022-7-6 12:04:53

Should start with:
(defun C:Test1 ()

guitarguy1685 发表于 2022-7-6 12:22:32

I Fee Like An Idiot!

flowerrobot 发表于 2022-7-6 12:40:40

From the look of the code, It looks like your trying to explore and see values. Are you aware that in vlide, You can 'Watch" items and look at the value of Varriables?
 
Flower

Lee Mac 发表于 2022-7-6 13:01:38

This may be more use for your learning:
 

(defun C:Test1 (/ Ename Att1 Att2 Att3 Att4 Att5) (setq Ename (entlast)) (setq Att1 (entnext Ename)) (setq Att2 (entnext Att1)) (setq Att3 (entnext Att2)) (setq Att4 (entnext Att3)) (setq Att5 (entnext Att4)) (princ (entget Att1)) (princ (entget Att2)) (princ (entget Att3)) (princ (entget Att4)) (princ (entget Att5)) (princ) )
页: [1]
查看完整版本: What's wrong with this?