From: Sapyra
Subject: VARIABLE-PROBLEMS WITH AUTOLISP
Date: 
Message-ID: <4fr15f$t5v@rc1.vub.ac.be>
Hi 

I'm writing a program in Autolisp. This part is meant to eliminate 
(erase) all selected horizontal lines.
I use some variables, which I set to nil in the beginning. With SSGET 
these variables get their values:
	(setq Selec (ssget "x" (list (cons 0 "line")(cons 8 "constr"))))
Now, even when these variables are set to nil, the second time I run the 
program the values are added instead of new values. So unless I restart 
Acad, the values never get to nil again.
One of these variables is Lyst (see below).

A second problem is the following: later in the routine a horizontal line 
is selected and is meant to be added in a list (to erase later).
It's the adding that doesn't work ! Does anyone see the problem??
Here's a part of the program:

    (setq Lyst (ssget "X" (list (cons 0 "line")(cons 8 "constr")))
          Numbr 0
          Badlst (ssadd)
    )
    (setq SetEnt (ssname Lyst Numbr ))
    (while SetEnt
	(setq LineX (entget SetEnt))
	(if (= (cadddr (assoc 10 LineX));; z-co the same ?
	       (cadddr (assoc 11 LineX)) 
	    )
            ;; the following line is causing a cancel 
	    (setq BadLst (ssadd LineX BadLst))
	)
	;; next line
	(setq Numbr (+ Numbr 1))
	(setq SetEnt (ssname Lyst Numbr))
    )
    (if (/= (sslength BadLst) 0)
	(command "erase" BadLst)
    )

I hope to hear from you soon. 
Thanks in advance !!

Sapyra

Email to ·······@vub.ac.be