GETVAR for all layout tabs

GETVAR for all layout tabs

murmanator
Advocate Advocate
685 Views
3 Replies
Message 1 of 4

GETVAR for all layout tabs

murmanator
Advocate
Advocate

Hello, in the program below, I am using GETVAR 'CTAB to switch a Mleader style based on whether Im in model space or paper space. Is there a way to change the part where it lists the layout tab names to instead work for ALL paper space tabs no matter the name? It works like this except if the tab has a different name than what is listed. Thank you

 

(defun c:redline (/ refltr)
(IF (EQ (GETVAR 'CTAB) "Model") (SETVAR 'CMLEADERSTYLE "Redline Model")

(IF (OR (EQ (GETVAR 'CTAB) "LANDSCAPE D 8")
(EQ (GETVAR 'CTAB) "LANDSCAPE D 10")
(EQ (GETVAR 'CTAB) "POOL B 8")
(EQ (GETVAR 'CTAB) "POOL C 8")
(EQ (GETVAR 'CTAB) "POOL D 8")
(EQ (GETVAR 'CTAB) "DETAILS B 8")
(EQ (GETVAR 'CTAB) "LANDSCAPE B 8")
(EQ (GETVAR 'CTAB) "LANDSCAPE C 8")
(EQ (GETVAR 'CTAB) "DEMO"))

(SETVAR 'CMLEADERSTYLE "Redline Paper")))
(vl-cmdf "_.mleader" pause pause (setq refltr (getstring T "\n\t =>> Enter note : ")))
(princ)
)

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

pbejse
Mentor
Mentor

Look into (layoutlist) 

0 Likes
Message 3 of 4

ronjonp
Advisor
Advisor
Accepted solution

@murmanator 

Try this .. no need to check for layout names if there are only two conditions ( modelspace and paperspace ).

 

(setvar	'cmleaderstyle
	(if (= (getvar 'cvport) 1)
	  "Redline Paper"
	  "Redline Model"
	)
)

This assumes that the two mleader styles exist in the drawing.

 

 

Message 4 of 4

murmanator
Advocate
Advocate

That's it, thank you ronjonp! I have another program that checks for the styles and loads them if not present. Thank you again.

0 Likes