Custom change properties lisp

Custom change properties lisp

kenneth.smithV6QLC
Enthusiast Enthusiast
894 Views
2 Replies
Message 1 of 3

Custom change properties lisp

kenneth.smithV6QLC
Enthusiast
Enthusiast

After running the code below, I get a message saying "The object is the paper space viewport." My question is: What in the code below is causing this message to occur? I've tested each portion individually with no such message, but when I run the code in whole, the message occurs. Needing a hand to understand why please.

 

(defun *error* (errmsg)
	(if (not   (wcmatch errmsg "Function cancelled,quit / exit abort,console break"))
		(princ (strcat "\nError: " errmsg))
	) ; end if
	(command-s "._Undo" "E") ; corrects the UNDO init if the code is interrupted
	(vl-bt) ; backtrace
) ; end defun
(defun C:ReloadSTEAMROLLER () ;; seperate command to reload the file during testing
  	(load "Geometry - LineweightByLayer(STEAMROLLER).lsp")
  	(load "Geometry - LineweightByLayer(STEAMROLLER).lsp") ; reload the code twice
  (princ "\nLoaded! Try the code out!") ; Visual confirmation
  (princ)
 )

(defun SR:Mute ()
(setvar "CMDECHO" 0)
(setvar "NOMUTT" 1)
)

(defun SR:Unmute ()
(setvar "NOMUTT" 0)
(setvar "CMDECHO" 1)
)

(defun SR:Single (/ ss)
(command "change" "c" (getvar 'extmax) (getvar 'extmin) "" "p" "lw" "bylayer" "")
)

(defun SR:Multiple ()
  (foreach layout (layoutlist)
    (setvar "ctab" layout)
    (SR:Single)
    );foreach
  (princ)
  );defun

(defun c:STEAMROLLER (/ ans)
	(initget 1 "Everything Sheet")
	(setq ans (getkword "\nFix everything or just this sheet? [Everything/Sheet]"))
	(cond
		((eq ans "Sheet")
			(SR:Mute)
			(command "zoom" "e")
			(SR:Single)
			(SR:Unmute)
		)
		((eq ans "Everything")
			(SR:Mute)
			(command "zoom" "e")
			(SR:Multiple)
			(SR:Unmute)
		)
	);cond
(prompt "Okay, the Lineweights are set to <ByLayer>!")
(princ)
);defun

 

Please be kind, rewind your exploding. Do not explode hatching, dimensions or text. Think of your fellow drafters! 🙂

https://www.youracclaim.com/badges/9aa4a1d5-0d02-4888-be6f-ed8f0653d8ad/public_url
0 Likes
Accepted solutions (1)
895 Views
2 Replies
Replies (2)
Message 2 of 3

pbejse
Mentor
Mentor

@kenneth.smithV6QLC wrote:

? I've tested each portion individually with no such message,

 


Tempororily comment the ;(SR:Mute) to see what triggered the message @kenneth.smithV6QLC 

 

0 Likes
Message 3 of 3

CADaSchtroumpf
Advisor
Advisor
Accepted solution

I think the problem is in the SR: Single function
The change command uses the capture selection so it can select viewport.
You cannot change the properties of a viewport.

You must make a filtered selection (ssget) that you can call ss (besides the declared variable ss is not used)