TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Kerry on June 28, 2005, 06:09:28 AM

Title: ActiveX stuff to check ...
Post by: Kerry on June 28, 2005, 06:09:28 AM
I've been cleaning up some old code and found a procedures/statement that is a NO-NO. I had removed all references to the Variable, but left the useless definition for some reason ....

Code: [Select]

;;; THIS IS A NO-NO. The PaperSpace Object changes depending on the Layout Active. ... So it SHOULDN'T be a global variable
;;;  IAcadPaperSpace Object
       (or g:paperspace
           (setq g:paperspace (vla-get-paperspace g:activedoc))
       )

These are still Valid :
Code: [Select]
;;
;;; IAcadApplication Object
;;
 (or g:acadapp (setq g:acadapp (vlax-get-acad-object)))
;;
;;;; IAcadDocument Object
;;
 (or g:activedoc (setq g:activedoc (vla-get-activedocument g:acadapp)))
;;
;;;; IAcadModelSpace Object
;;
 (or g:modelspace (setq g:modelspace (vla-get-modelspace g:activedoc)))
;;
;;;; IAcadUtility Object
;;
 (or g:utility (setq g:utility (vla-get-utility g:activedoc)))



And while on the topic of Paperspace
.. This is invalid :
Code: [Select]
(setq
  CurSpace-NONO (if
                  (= acmodelspace (vla-get-activespace g:activedoc))
                   g:modelspace
                   (vla-get-paperspace g:activedoc)
                )
)

These are Fine :
Code: [Select]
(setq CurSpacex (if (or (= acmodelspace (vla-get-activespace g:activedoc))
                        (= :vlax-true (vla-get-mspace g:activedoc))
                    )
                  g:modelspace
                  (vla-get-paperspace g:activedoc)
                )
)

(setq CurSpaceg (if (or (= (getvar "TILEMODE") 1) (> (getvar "CVPORT") 1))
                  g:modelspace
                  (vla-get-paperspace g:activedoc)
                )
)


If you're not sure why, :- try to run the first one when in a Paperspace layout with Modelspace Active.