I am trying to partially automate one of my programs, but I cant figure out how to pass the selection set to the program. when standard AutoCAD commands are called, you can just enter ss in the command but I cant seem to figure it out. This is my code, I havent defined all the local variables yet because I am still in testing phase.
Code:
(defun c:aremove (/ ss counter ent entdata)
(setq ss (ssget "_X"
(list '(-4 . "<and")
'(0 . "TEXT")
'(8 . "Offset Notes")
'(62 . 256)
(cons 410 (getvar "ctab"))
'(-4 . "and>")
)
) ;_ end of ssget
counter 0
ss2 (ssadd)
ss3 (ssadd)
) ;_ end of setq
(while (setq ent (ssname ss counter))
(setq entdata (entget ent)
obj (cdr (assoc 1 entdata)))
(cond
((wcmatch (cdr (assoc 1 entdata)) "*#\" @*")
(setq text1 (vl-string-left-trim "1234567890`+\" " obj)
text2 (vl-string-left-trim "ABCDEFGHIJKLMNOPQRSTUVWXYZ " text1)
text3 (vl-string-right-trim "`'" text2)
text4 (atof text3)
) ;_ end of setq
(if (<= text4 26.0)
(setq ss2 (ssadd ent ss2))
) ;_ end of if
)
((wcmatch (cdr (assoc 1 entdata))
"*POWER POLE*,*TELE RISER BOX*,*GUY WIRE*"
) ;_ end of wcmatch
(setq text1 (vl-string-left-trim "1234567890+\" " obj)
text2 (vl-string-left-trim "ABCDEFGHIJKLMNOPQRSTUVWXYZ " text1)
text3 (vl-string-right-trim "`'" text2)
text4 (atof text3)
) ;_ end of setq
(if (<= text4 26.0)
(setq ss3 (ssadd ent ss3))
) ;_ end of if
)
) ;_ end of cond
(setq counter (1+ counter))
) ;_ end of while
(C:REM);use selection set ss2
(C:RBO);use selection set ss3
; (setq ss2 nil)
; (setq ss3 nil)
(gc)
) ;_ end of defun
I can post the lisp that contains C:REM and C:RBO if necessary, but I think that the question is general enough that it wont be required.