You need to localize the variable in the c:tl function.
https://www.theswamp.org/index.php?topic=55680.0
sorry i made code some
but still error
ps : this code work process code
pls understand me ~~
problem :
1. slow
2. error: bad argument type: lselsetp nil ( if i select many boundray rectangle )
pls can you modify some ~
that is my limit
modified code
(defun C:ask( / k objset obj oyr ss i text-list th-list entall )
(vl-load-com)
(setvar "osmode" 33)
(setq k 0)
(setq objset (ssget (list '(0 . "*polyline") (cons 410 (getvar 'ctab)))))
(repeat (sslength objset)
(setq obj (ssname objset k))
(setq oyr (vlax-ename->vla-object obj))
(setvar "osmode" 0)
(vla-getboundingbox oyr 'minpt 'maxpt)
(setq minpt (vlax-safearray->list minpt)
maxpt (vlax-safearray->list maxpt)
)
(setq ss (ssget "_w" minpt maxpt (list (cons 0 "text"))))
(setq i 0 )
(repeat (sslength ss)
(setq en (ssname ss i)
text-list (append text-list (list en))
i (1+ i))
)
(setq th-list nil)
(mapcar '(lambda (x) (setq th-list (append th-list (list (cdr (assoc 40 (entget x))))))) text-list)
(setq MaxText (nth (car (vl-sort-i th-list '>)) text-list))
(setq pltn (cdr(assoc 1 (entget MaxText))))
(setq allsee (ssget "_X" '((60 . 0)(0 . "~VIEWPORT"))))
(setq sd (ssget "x" (list '(0 . "hatch") (cons 410 (getvar "ctab")))))
(setq tsd (ssget "x" (list '(0 . "*TEXT") (cons 410 (getvar "ctab")))))
(off sd)
(off tsd)
(setq entall (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object))))
(vlax-map-collection entall '(lambda(x) (vla-put-visible x -1)))
(setq sd (ssget "x" (list '(0 . "hatch") )))
(seiso allsee sd )
(setq sd (ssget "x" (list '(0 . "*TEXT") )))
(seiso allsee sd )
(setq entall (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object))))
(vlax-map-collection entall '(lambda(x) (vla-put-visible x -1)))
(setq k ( 1+ k ) )
)
)
(defun seiso (seAll seon / idx)
(setq idx 0)
(repeat (sslength seAll)
(vlax-put-property (vlax-ename->vla-object (ssname seAll idx)) 'Visible :vlax-false)
(setq idx (1+ idx))
);end repeat
(setq idx 0)
(repeat (sslength seOn)
(vlax-put-property (vlax-ename->vla-object (ssname seOn idx)) 'Visible :vlax-true)
(setq idx (1+ idx))
);end repeat
)
(defun OFF(OL / OBJNUM SSOBJ OBJECT OBJLIST)
(setq OBJNUM 0)
(repeat (sslength OL)
(setq SSOBJ (entget (ssname OL OBJNUM))
OBJNUM (+ OBJNUM 1)
OBJECT (append SSOBJ (list (cons 60 1)))
)
(if (= (cdr (assoc 0 SSOBJ)) "VIEWPORT")
(princ "\nViewports cannot be turned off.")
(entmod OBJECT)
)
)
)