Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

routine for attaching multiple instances of xrefs 1

Status
Not open for further replies.

vbcad

Technical User
Jul 12, 2002
159
0
0
US
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
 
i fixed it. enjoy.
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*)
  	)
	(setq ref (getfiled "Select Drawing to Attach as Xref..." "p:/jobs/" "dwg" 16))
	(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
	(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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top