rcb007 Posted May 9 Share Posted May 9 Is it possible to use the (command "_.xattach" ) without the dialog box? Is there a way to activate the command and the user selects the files to be xref'd and automatically brings them in 0,0 with an overlay. Thank you for the help. Quote Link to comment Share on other sites More sharing options...
ronjonp Posted May 9 Share Posted May 9 (edited) 51 minutes ago, rcb007 said: Is it possible to use the (command "_.xattach" ) without the dialog box? Set FILEDIA to 0. Edited May 9 by ronjonp Quote Link to comment Share on other sites More sharing options...
mhupp Posted May 9 Share Posted May 9 Modified from here https://forums.augi.com/showthread.php?116226-routine-to-insert-Xref-s (defun c:overlay (/ f) (if (setq f (getfiled "Select Reference File:" (getvar 'dwgprefix) "dwg" 2)) (progn (command "_.-XREF" "_Overlay" f "_None" '(0.0 0.0 0.0)) (while (> (getvar "CMDACTIVE") 0) (command "")) ) ) ) Quote Link to comment Share on other sites More sharing options...
rcb007 Posted May 9 Author Share Posted May 9 I need to edit my original post. How about for selecting multiple dwgs at once? Sorry about that. Quote Link to comment Share on other sites More sharing options...
mhupp Posted May 9 Share Posted May 9 (edited) 1 hour ago, rcb007 said: How about for selecting multiple dwgs at once? Untested Lightly Tested. (defun C:Multi-OVERLAY (/ path fp lst Reflst ref) (setq path (strcat (getvar 'DWGPREFIX) "\\Pick List to import") fp (getfiled "Reference File List:" path "" 33) path (vl-filename-directory fp) lst (vl-directory-files path "*.dwg" 1) ;lst (append lst (vl-directory-files path "*.dxf" 1)) ;if you want to see other types of files lst (vl-sort lst '<) ) (if (setq Reflst (AT:ListSelect (strcat (itoa (length lst)) " Reference(s) in Folder") "Pick Reference(s) to Insert Into Drawing" 30 60 "true" lst)) (foreach ref Reflst (command "_.-XREF" "_Overlay" (strcat path "\\" ref) "_non" '(0.0 0.0 0.0) "" "" "") ) ) (princ) ) ;; List Select Dialog (Temp DCL list box selection, based on provided list) ;; title - list box title ;; label - label for list box ;; height - height of box ;; width - width of box ;; multi - selection method ["true": multiple, "false": single] ;; lst - list of strings to place in list box ;; Alan J. Thompson, 09.23.08 / 05.17.10 (rewrite) (defun AT:ListSelect (title label height width multi lst / fn fo d f) (setq fo (open (setq fn (vl-filename-mktemp "" "" ".dcl")) "w")) (foreach x (list (strcat "list_select : dialog { label = \"" title "\"; spacer;") (strcat ": list_box { label = \"" label "\";" "key = \"lst\";") (strcat "allow_accept = true; height = " (vl-princ-to-string height) ";") (strcat "width = " (vl-princ-to-string width) ";") (strcat "multiple_select = " multi "; } spacer; ok_cancel; }") ) (write-line x fo) ) (close fo) (new_dialog "list_select" (setq d (load_dialog fn))) (start_list "lst") (mapcar (function add_list) lst) (end_list) (setq item (set_tile "lst" "0")) (action_tile "lst" "(setq item $value)") (setq f (start_dialog)) (unload_dialog d) (vl-file-delete fn) (if (= f 1) ((lambda (s / i s l) (while (setq i (vl-string-search " " s)) (setq l (cons (nth (atoi (substr s 1 i)) lst) l)) (setq s (substr s (+ 2 i))) ) (reverse (cons (nth (atoi s) lst) l)) ) item ) ) ) Edited May 9 by mhupp Quote Link to comment Share on other sites More sharing options...
ronjonp Posted May 9 Share Posted May 9 Why do you need a lisp to do this? XATTACH will let you attach multiple files at once in a directory, and if you set XREFTYPE to 1 it will default to an overlay. All you're left with is the insertion point which defaults to '(0 0 0). Quote Link to comment Share on other sites More sharing options...
rcb007 Posted May 9 Author Share Posted May 9 Yes you are right. I did not know if you could bypass the attach external reference dialog box, to where once you select the files, it just come in. Quote Link to comment Share on other sites More sharing options...
pkenewell Posted Thursday at 03:08 PM Share Posted Thursday at 03:08 PM On 5/9/2022 at 12:03 PM, ronjonp said: Set FILEDIA to 0. Note. I just tested this: if you call XATTACH within a command subr i.e. (command "._XATTACH" ...) you do not need to set FILDIA to 0. 1 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.