Author Topic: ActiveX stuff to check ...  (Read 806 times)

0 Members and 1 Guest are viewing this topic.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
ActiveX stuff to check ...
« 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.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

--> Donate to theSwamp<--