Lisp routine to load / unload all xrefs ignoring current ones unloaded?

Lisp routine to load / unload all xrefs ignoring current ones unloaded?

ME42L
Enthusiast Enthusiast
174 Views
3 Replies
Message 1 of 4

Lisp routine to load / unload all xrefs ignoring current ones unloaded?

ME42L
Enthusiast
Enthusiast

I'm working with drawings that contain numerous Xrefs, and some of them are intentionally unloaded. I currently use a LISP routine that unloads/reloads all Xrefs, but it's time-consuming and challenging to keep track of which ones should remain unloaded after running the lisp.

 

Can the LISP routine be modified to load and unload all Xrefs while preserving the original unload status, so that it only reloads those that were previously loaded and leaves the intentionally unloaded ones untouched

0 Likes
Accepted solutions (1)
175 Views
3 Replies
Replies (3)
Message 2 of 4

BlackBox_
Advisor
Advisor
Accepted solution

Here's one... I'll let you do the other, if you feel it's necessary (unloading all inherently only unloads those that are loaded): 

 

(vl-load-com)

(defun c:XRR (/ rewind loadedXrefs)

  (setq rewind t)
  (while (setq blockData (tblnext "block" rewind))
    (setq rewind nil)
    (if (and (= 4 (logand 4 (cdr (assoc 70 blockData))))
             (= 32 (logand 32 (cdr (assoc 70 blockData))))
        )
      (setq loadedXrefs (cons (cdr (assoc 2 blockData)) loadedXrefs))
    )
  )

  (if loadedXrefs
    (command
      "-xref"
      "r"
      (vl-string-right-trim
        ","
        (apply
          'strcat
          (mapcar
            (function
              (lambda (x) (strcat x ","))
            )
            loadedXrefs
          )
        )
      )
    )
    (prompt "\n ** No loaded XREFs found ** \n")
  )

  (princ)
)


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

Sincpac C3D ~ Autodesk Exchange Apps

Message 3 of 4

ME42L
Enthusiast
Enthusiast

Could you write the other? its been a while and it to work!

0 Likes
Message 4 of 4

BlackBox_
Advisor
Advisor

@ME42L wrote:

Could you write the other? its been a while and it to work!


Your original XRU.lsp is perfectly fine: 

 

(defun c:XRU (/ )
  (command "._-xref" "_u" "*")
  (princ)
)

 

Cheers


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

Sincpac C3D ~ Autodesk Exchange Apps

0 Likes