Function Syntax (LM:ActiveSpace <*doc> <*spc>)
Current Version 1.0
Symbol Type Description
*doc Symbol (Output) Quoted symbol (other than *doc)
*spc Symbol (Output) Quoted symbol (other than *spc)

Function Description

This function points the symbols bound to the arguments *doc & *spc to the Active Document VLA-Object and Active Space (Container) VLA-Object.

The symbol arguments supplied to the subfunction cannot be identically either *doc or *spc, else these symbols will lose their values following evaluation of the function due to the parameter symbols being local to the function.

Select all
;; Active Space  -  Lee Mac
;; Retrieves pointers to the Active Document and Space.
;; *doc - quoted symbol (other than *doc)
;; *spc - quoted symbol (other than *spc)

(defun LM:activespace ( *doc *spc )
    (set *doc (vla-get-activedocument (vlax-get-acad-object)))
    (set *spc (vlax-get-property (eval *doc) (if (= 1 (getvar 'cvport)) 'paperspace 'modelspace)))

Example Calling Function

Select all
(defun c:test ( / doc spc p1 p2 )
    (LM:activespace 'doc 'spc)
            (setq p1 (getpoint "\nSpecify 1st Point: "))
            (setq p2 (getpoint "\nSpecify 2nd Point: " p1))
        (vla-addline spc
            (vlax-3D-point (trans p1 1 0))
            (vlax-3D-point (trans p2 1 0))
(vl-load-com) (princ)


increase · reset · decrease

Designed & Created by Lee Mac © 2010