batch xref insertion

Discussion in 'AutoCAD' started by The real JD, Apr 14, 2004.

  1. The real JD

    The real JD Guest

    Anybody have or know a lisp to select multiple drawings and have them all
    xref at the same scale, rotation and insertion point? TIA

    A2ki
    Wink pro Sp4

    Posting here as per Anne Brown's suggestion.
    I posted this in 2000general too. I don't know why i didn't post here
    originally.
     
    The real JD, Apr 14, 2004
    #1
  2. Here is a program I wrote years ago.
    It assumes you have DosLib loaded to get the list of drawings in the current
    folder.

    ;--dialog box--------------------------------------------------------------
    Xr : dialog {
    label = "Insert Xref";
    : row {
    : column {
    label = "Select Xref Drawing to Insert";
    : text {
    label = "Hold <CTRL> key to select multiple drawings to Xref";
    }
    : list_box {
    key = "XREF";
    multiple_select = true;
    fixed_height = true;
    fixed_width = false;
    width = 50;
    height = 40;
    }
    }
    }
    ok_cancel;
    }

    ;--program----------------------------------------------------------------
    (defun C:XR ( / XREF VALUES_OK CLOSE_OK CANCEL_OK LIT DCL_ID DCL_EXIT XREF
    LXREF)

    (defun close_ok ()
    (setq XREF (get_tile "XREF"))
    (setq VALUES_OK T)
    (done_dialog 1)
    )
    (defun cancel_ok ()
    (setq VALUES_OK T)
    (done_dialog 0)
    )
    (setq LIT (acad_strlsort (dos_dir (strcat (getvar "DWGPREFIX") "*.dwg"))))
    (setq VALUES_OK nil)
    (while (not VALUES_OK)
    (setq DCL_ID (load_dialog "Xr.dcl"))
    (if (not (new_dialog "Xr" DCL_ID))
    (exit)
    (progn
    (start_list "XREF")
    (mapcar 'add_list LIT)
    (end_list)

    (action_tile "accept" "(close_ok)")
    (action_tile "cancel" "(cancel_ok)")

    (setq DCL_EXIT (start_dialog))
    )
    )
    (unload_dialog DCL_ID)
    )
    (if (= DCL_EXIT 1)
    (progn
    (command "LAYER" "T" "0" "S" "0" "")
    (setq LXREF (GETTEXTLIST XREF " "))
    (foreach XNAME LXREF
    (setq TXREF (nth (atoi XNAME) LIT))
    (if (tblsearch "BLOCK" (substr TXREF 1 (- (strlen TXREF) 4)))
    (princ (strcat "\n" TXREF " allready XREF in drawing."))
    (progn
    (princ (strcat "\nXREF drawing..." TXREF))
    (command "_XREF" "A" TXREF "0,0" "" "" "")
    )
    )
    )
    (princ "\nFinished Xref'ing drawings.")
    (princ)
    )
    (princ "\nInsert Xref' Cancelled..")
    )
    (princ)
    )
    (princ)
     
    Alan Henderson, Apr 15, 2004
    #2
  3. The real JD

    The real JD Guest

    Thank you!
    I'll give it a try!
     
    The real JD, Apr 15, 2004
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.