why crash on switch layout?

why crash on switch layout?

xinxirong
Enthusiast Enthusiast
699 Views
1 Reply
Message 1 of 2

why crash on switch layout?

xinxirong
Enthusiast
Enthusiast

(vl-load-com)
(defun LM:ss->vla ( ss / i l )
(if ss
(repeat (setq i (sslength ss))
(setq l (cons (vlax-ename->vla-object (ssname ss (setq i (1- i)))) l))
)
)
)

(vlr-miscellaneous-reactor nil '((:vlr-layoutSwitched . ctab_willchange)))
(defun ctab_willchange (calling-reactor Info / obj)
  (foreach obj (LM:ss->vla (ssget "x" '((0 . "viewport"))))
     (VL-CATCH-ALL-APPLY 'vla-put-ViewportOn (list obj :vlax-false))
  )
)

 

Maybe it has switched ,so I can not put the viewport off.But I use this reactor,also crash

(vlr-editor-reactor nil '((:vlr-sysVarWillChange . ctab_willchange )))

(defun ctab_willchange (calling-reactor Info / obj)

  (if (or (= (strcase (car Info)) "CTAB") (= (strcase (car Info)) "TILEMODE"))

         (foreach obj (LM:ss->vla (ssget "x" '((0 . "viewport"))))
           (VL-CATCH-ALL-APPLY 'vla-put-ViewportOn (list obj :vlax-false))
         )

  )

)

0 Likes
Accepted solutions (1)
700 Views
1 Reply
Reply (1)
Message 2 of 2

Moshe-A
Mentor
Mentor
Accepted solution

@xinxirong  hi,

 

This call (ssget "x" '((0 . "viewport"))) also return the layout viewport (the outside one) which you are not allow to modify. before you turn the viewport display to Off check the viewport id and if is 1, skip it 😀

 

Moshe

 

 

0 Likes