Below is a routine for attaching xrefs. works but have one problem. With every activation of a new layout tab the open dialog appears. i would like to have the dialog apper only once and attach the same xref across the layout tabs. any help would be good.
Code:
;insert all layouts
(defun insert_all_layouts (/ lay layouts *acad* *doc* )
(COMMAND "FILEDIA" "0")
(vl-load-com)
(setq *acad* (vlax-get-acad-object)
*doc* (vla-get-activedocument *acad*)
layouts (vla-get-layouts *doc*)
)
(vlax-for lay layouts ; step through layouts
(vla-put-activelayout *doc* lay) ; activate layout
(if (= (vla-get-activespace *doc*) 0) ; If in paperspace
(if (= (vla-get-mspace *doc*) :vlax-true); in mspace viewport
(vla-put-mspace *doc* :vlax-false) ; inactivate vp
) ; endif
) ;endif
(setq ref (getfiled "Select Drawing to Attach as Xref..." "p:/jobs/" "dwg" 16))
(COMMAND "-XREF" "ATTACH" ref "0,0" "1" "1" "0")
;(vla-PSPACE *acad*)
)
)
(defun c:Ial ()
(insert_all_layouts)
;(COMMAND "PDMODE" "1")
(COMMAND "TILEMODE" "0")
(COMMAND "FILEDIA" "1")
)
;END OF insert ALL LAYOUTS