TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: daron on December 12, 2003, 06:03:57 PM

Title: ActiveX methods to retrieve xref path info?
Post by: daron on December 12, 2003, 06:03:57 PM
Anybody know of a way? If not, is it possible with AutoLisp?
Title: ActiveX methods to retrieve xref path info?
Post by: Mark on December 12, 2003, 06:05:44 PM
Code: [Select]
;;; FUNCTION
;;; returns an association list of xref name and path
;;; for all xrefs in Modelspace
;;; i.e. (("TOC-PAV" . "D:\\DRAWINGS_TEMP\\TOC-PAV.dwg"))
;;;
;;; ARGUMENTS
;;;
;;; USAGE
;;; (setq xrefpath (MST-GetXrefPath))
;;;
;;; PLATFORMS
;;; 2000+
;;;
;;; AUTHOR
;;; Copyright© 2003 Mark S. Thomas
;;; mark.thomas@theswamp.org
;;;
;;; VERSION
;;; 1.0 Sun May 04, 2003
(defun MST-GetXrefPath (/ ms xref-path)
  (vl-load-com)
  (setq ms
        (vla-get-modelspace
          (vla-get-activedocument
            (vlax-get-acad-object)
            )
          )
        )

  (vlax-for x ms
            (if
              (= (vla-get-objectname x) "AcDbBlockReference")
              (if
                (vlax-property-available-p x 'Path)
                (setq xref-path
                      (cons
                        (cons
                          (vla-get-name x)
                          (vla-get-path x)
                          )
                        xref-path
                        )
                      )
                ); if
              ); if
            (vlax-release-object x)
            )
  xref-path
  )

;;; Last change: 2003 Sep 12
;;; Timestamp: <MST-GetXrefPath.lsp Fri 2003/09/12 20:22:41  NED>
;;; vim:tw=78:ts=4:
Title: ActiveX methods to retrieve xref path info?
Post by: daron on December 12, 2003, 06:37:49 PM
Thanks Mark. I was trying to access them through the blocks collection. Oops.