See the top rated post in this thread. Click here

Results 1 to 5 of 5

Thread: Routine that Toggle XREFs On/Off

  1. #1
    Member
    Join Date
    2013-02
    Posts
    49
    Login to Give a bone
    0

    Default Routine that Toggle XREFs On/Off

    Hi Everyone

    Could anyone help me create a Routine that Toggle XREFs instead of Loading/unloading it or turning the Xrefs Layer On/Off.

    I Already have the Reference Manager Toggle Routine.

    Thank you in advance.
    Last edited by ELIANDEFI; 2021-09-22 at 03:36 PM. Reason: Wrong Text

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

    Default Re: Routine that Toggle XREFs On/Off

    You can roll your own LISP for this, but have you tried the HIDEOBJECTS Command?

    It's basically the reverse of ISOLATEOBJECTS.

    To show the hidden objects again, simply use the UNHIDE Command (which is really the UNISOLATEOBJECTS Command).

    Another benefit to this, is unlike using LISP to set Visible Property to False, the hidden objects will still appear unhidden automagically after a drawing is saved (with them hidden), closed and reopened.

    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

  3. #3
    Certifiable AUGI Addict tedg's Avatar
    Join Date
    2005-06
    Location
    in the upper right corner
    Posts
    3,505
    Login to Give a bone
    0

    Default Re: Routine that Toggle XREFs On/Off

    I use a routine that freezes or thaws the xref layer(s) (the layers that the xref is on)
    I know you mentioned you didn't want that but I use this all the time.
    (example of standard NCS-named xref layer)
    Code:
    ;;thaws layer named "G-ANNO-REFR"
    (defun c:TXR () (command "layer" "thaw" "G-ANNO-REFR""")(princ)
    )
    ;;freezes layer named "G-ANNO-REFR"
    (defun c:FXR () (command "layer" "thaw" "0" "set" "0" "freeze" "G-ANNO-REFR""")(princ)
    )
    I also have other layers for different disciplines, like the arch floor plan on an arch xref layer to freeze/thaw separately from other xrefs:
    Code:
    ;;thaws layer named "A-ANNO-REFR"
    (defun c:TAXR () (command "layer" "thaw" "A-ANNO-REFR""")(princ)
    )
    ;;freezes layer named "A-ANNO-REFR"
    (defun c:FAXR () (command "layer" "thaw" "0" "set" "0" "freeze" "A-ANNO-REFR""")(princ)
    )
    These are basic routines,
    Just a suggestion.

  4. #4
    I could stop if I wanted to
    Join Date
    2002-08
    Posts
    231
    Login to Give a bone
    0

    Default Re: Routine that Toggle XREFs On/Off

    One of my routines from 2006, see if it can still do the job.
    Code:
    (defun c:layer_xref_on-off ( / a name name_dir name_lay)
    	(setvar "cmdecho" 0)
    	(setq a (tblnext "block" t))
    	(while a
    		(if (= (logand (cdr (assoc 70 a)) 4) 4)
    			(progn
    				(setq name (cdr (assoc 1 a)))
    				(setq name_dir (strcat (vl-filename-directory name) "\\"))
    				(setq name_lay (strcat (vl-string-right-trim ".dwg" (vl-string-subst "" name_dir name)) "|*"))
    				(command "_.-layer" (if (zerop (getvar "USERI1")) "_off" "_on") name_lay "")
    			)
    		)
    		(setq a (tblnext "block"))
    	)
    	(if (zerop (getvar "USERI1")) (setvar "USERI1" 1) (setvar "USERI1" 0))
    	(setvar "cmdecho" 1)
    	(princ)
    )

  5. #5
    Member
    Join Date
    2013-02
    Posts
    49
    Login to Give a bone
    0

    Default Re: Routine that Toggle XREFs On/Off

    @Bruno.Valsecchi this routine is exactly what I needed! Thank you so much!

    Thank you all for your time!
    You are all awesome!

Similar Threads

  1. Replies: 3
    Last Post: 2019-05-07, 05:19 PM
  2. Replies: 11
    Last Post: 2010-04-08, 09:03 PM
  3. Project Navigator - xrefs? what xrefs?
    By rodg in forum CAD Management - General
    Replies: 0
    Last Post: 2008-11-04, 08:21 AM
  4. Project Navigator - xrefs? what xrefs?
    By rodg in forum CAD Management - General
    Replies: 0
    Last Post: 2008-11-04, 08:20 AM
  5. XREFS - MSG not xrefs "Not Found"
    By spencer.67965 in forum VBA/COM Interop
    Replies: 0
    Last Post: 2005-01-18, 03:45 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
  •