Lisp Routine inside another Lisp

Lisp Routine inside another Lisp

Anonymous
Not applicable
901 Views
2 Replies
Message 1 of 3

Lisp Routine inside another Lisp

Anonymous
Not applicable

Hey Fellows!

 

I'm having an issue when I try to call a Lisp already set in the autocad into the new program I'm writing.

Here's what's happening:

 

RTSV routine: changes color to those texts non-standardized (this one works perfectly)

 

AZG routine: Changes color on layer 0, then creates a rectangle, then it should perform the RTSV command in ALL texts on drawing

 

--------------------------------------------------------------------------

(defun C:RTSV (/ names txtss n txt)
(setq
names '("A/V RM"
"AUDITORIUM"
"BEVERAGE"
"SERVER & EQUIPMENT RM"
"STORAGE"
"WKST"
"WORK RM");
txtss (ssget '((0 . "*TEXT")))
); setq
(repeat (setq n (sslength txtss))
(setq txt (vlax-ename->vla-object (ssname txtss (setq n (1- n)))))
(if (not (member (vla-get-TextString txt) names))
(vla-put-Color txt 2); then
); if
); repeat
); defun

---------------------------------------------------

(defun c:AZG ()
(command "_.Layer" "_Make" "0" "_Color" "11" "" "LType" "Continuous" "" "")
(command "rectangle" "0,0" "@250,250")
(defun c:RTSV "ALL")
(princ)
)

 

-----BOTTOM LINE------

 

could anyone tell me why the RTSV is not working combined with the AZG routine??

 

thanks!

 

0 Likes
Accepted solutions (1)
902 Views
2 Replies
Replies (2)
Message 2 of 3

rkmcswain
Mentor
Mentor
Accepted solution

One thing, your RSTV function is not defined to accept arguments [it would have to be defined like (defun RSTV (arg / .....) ], and you are calling it from AZG with an argument.

 

Something like this perhaps (this is untested).

 

(defun RTSV-sub (arg / names txtss n txt)
  (setq
    names '( "A/V RM"
             "AUDITORIUM"
             "BEVERAGE"
             "SERVER & EQUIPMENT RM"
             "STORAGE"
             "WKST"
             "WORK RM"  ;
           )
        
  )  ; setq
  (repeat (setq n (sslength arg))
    (setq txt (vlax-ename->vla-object (ssname arg (setq n (1- n)))))
    (if (not (member (vla-get-TextString txt) names))
      (vla-put-Color txt 2)  ; then
    )  ; if
  )    ; repeat
)      ; defun

---------------------------------------------------

(defun c:AZG ()
  (command "_.Layer" "_Make" "0" "_Color" "11" "" "LType" "Continuous" "" "")
  (command "rectangle" "0,0" "@250,250")
  (setq txtss (ssget "_X" '((0 . "*TEXT"))))
  (RTSV-sub txtss)
  (princ)
)

(defun C:RTSV ()
  (setq txtss (ssget '((0 . "*TEXT"))))
  (rtsv-sub txtss)
)  
                     
        
R.K. McSwain     | CADpanacea | on twitter
Message 3 of 3

Anonymous
Not applicable

It is working amazing!! thanks so much!

0 Likes