Below is a piece of code that function fine, however i would like to make it better(of course). The code lets me select a directory to use for the current folder and the opens another dialog to prompt for the actual reference name, it them renames the xref using the "wcmatch" statement. What I would like to do is do away with the dialog boxes. I need to select the current directory and then select the drawing I would like to use as an xref using wildcards. Area that needs revising is in red. Help please!
Code:
;START NEW ATTACH
(COMMAND "CLAYER" "XREF-NEW")
[red](setq dir
(vl-filename-directory
(getfiled "Select Drawing in directory desired..." "" "DWG" 4)
)
)
(setq ref (getfiled "Select A1 plan..." dir "DWG" 16))
(COMMAND "-XREF" "ATTACH" ref "0,0" "1" "1" "0")[/red]
(vlax-for blk (vla-get-Blocks (vla-get-ActiveDocument (vlax-get-Acad-Object)))
(if
(and
(equal (vla-get-IsXref blk) :vlax-true)
(wcmatch (setq OldName (vla-get-Name blk)) "*a1")
)
(vla-put-Name blk "NEW"))
)
;END NEW ATTACH