See the top rated post in this thread. Click here

Results 1 to 5 of 5

Thread: Xref Selection

  1. #1
    100 Club
    Join Date
    2008-09
    Posts
    108
    Login to Give a bone
    0

    Default Xref Selection

    I have a group of xref's that I want to insert into a drawing but autocad only allows me to select them one at a time. Is there a setting which will allow me to select all that I need and load them into my drawing at once? I am using 2010.

  2. #2
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Default Re: Xref Selection

    R.K. McSwain | CAD Panacea |

  3. #3
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,106
    Login to Give a bone
    0

    Default Re: Xref Selection

    Quote Originally Posted by rkmcswain View Post
    The excuse of a reason on that article is quite lame. You mean to tell me they can't figure out how to attach more than one file format at a time?
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  4. #4
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Default Re: Xref Selection

    Who knows if it's even true. I have to question the QA/QC process on these KB articles sometimes.
    R.K. McSwain | CAD Panacea |

  5. #5
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    1

    Default Re: Xref Selection

    I wrote this back in 2010, and has served me well - in short, this will prompt user for multiple drawing selection relative to the active drawing, check/set the desired Layer, reload XREFs that are already attached, and send them to the back:


    *DOSLib required*

    Code:
    (defun c:XX () (c:XrefUnderlay))
    (defun c:XrefUnderlay (/ *error* flag xrefs ss acDoc layerName oLayer
    		       insertionPoint xrefName oXref space layerName
    		      )
      (princ "\rXREFUNDERLAY \n")
    
      (defun *error* (msg)
        (if	acDoc
          (vla-endundomark acDoc)
        )
        (cond ((not msg))							; Normal exit
    	  ((member msg '("Function cancelled" "quit / exit abort")))	; <esc> or (quit)
    	  ((princ (strcat "\n** Error: " msg " ** ")))			; Fatal error, display it
        )
        (princ)
      )
    
      (if (and (setq flag (dos_version))
    	   (setq xrefs
    		  (dos_getfilem
    		    "Select reference file to underlay"
    		    (if	*XrefUnderlay_LastPath*
    		      *XrefUnderlay_LastPath*
    		      (getvar 'dwgprefix)
    		    )
    		    "Drawing files (*.dwg)|*.dwg|All files (*.*)|*.*||"
    		  )
    	   )
    	   (setq *XrefUnderlay_LastPath* (car xrefs))
    	   (setq ss (ssadd))
          )
        (progn
          (vla-startundomark
    	(setq acDoc (vla-get-activeDocument (vlax-get-acad-object)))
          )
    
          ;; layer check, will create layer if it does not already exist
          (setq oLayer (vla-add (vla-get-layers acDoc)
                                (setq layerName "XREF")
    		   )
          )
          (vla-put-color oLayer 8)
          (vla-put-description oLayer "Reference File Attachments ")
          ;;<-- more layer properties here
    
          (setq space
    	     (vlax-get acDoc
    		       (if (= 1 (getvar 'cvport))
    			 'paperspace
    			 'modelspace
    		       )
    	     )
          )
          (setq insertionPoint (vlax-3d-point '(0 0 0)))
          (foreach xref (cdr xrefs)
    	(setq xref (strcat *XrefUnderlay_LastPath* xref))
    	(if (tblsearch "block"
    		       (setq xrefName (vl-filename-base xref))
    	    )
    	  (progn
    	    (prompt "\nReference already exists, reloading... ")
    	    (vl-catch-all-apply
    	      'vla-reload
    	      (list
    		(setq oXref (vla-item (vla-get-blocks acDoc) xrefName))
    	      )
    	    )
    	    (princ "Done. ")
    	  )
    	  (progn
    	    (prompt (strcat "\nAttaching \"" xrefName "\" reference... ")
    	    )
    	    (setq oXref
    		   (vla-attachexternalreference
    		     space xref	xrefName insertionPoint	1. 1. 1. 0.
    		     :vlax-true
    		    )
    	    )
    	    (vla-put-layer oXref layerName)
    	    (ssadd (vlax-vla-object->ename oXref) ss)
    	    (princ "Done. ")
    	  )
    	)
          )
          (sssetfirst nil ss)
          (ai_draworder "_b")
        )
        (cond (flag)
    	  ((prompt "\n** DOSLib must be loaded ** "))
        )
      )
      (*error* nil)
    )


    HTH
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

Similar Threads

  1. 2012: annoying block and xref selection
    By arcitek in forum AutoCAD General
    Replies: 1
    Last Post: 2012-01-16, 12:13 PM
  2. Xref Selection
    By Rnykster in forum AutoLISP
    Replies: 8
    Last Post: 2009-06-03, 05:15 AM
  3. controlling xref without user selection
    By louis.marroquin in forum AutoLISP
    Replies: 8
    Last Post: 2006-11-11, 01:46 AM
  4. Replies: 1
    Last Post: 2006-07-14, 04:40 PM
  5. Unload Xref by selection
    By peter.woodcock in forum AutoCAD General
    Replies: 1
    Last Post: 2005-02-07, 03:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •