Results 1 to 2 of 2

Thread: Default XREF Layer

  1. #1
    Wish List Administration
    Join Date
    2011-08
    Posts
    4,581
    Login to Give a bone
    0

    Default Default XREF Layer

    Summary: Be able to use a SETVAR to preset a Layer for XREFs

    Description: Be able to use a SETVAR to preset a Layer for XREFs (Like layer Xref).
    [] would use the current layer, but if a layer name was supplied, they would go to a default layer. you could still manually change them to any layer you wish, but it would help keep things organized - especially in a larger organization. If it was a SETVAR it could work in the Project Navigator, as well as vanilla AutoCAD.

    Product and Feature: AutoCAD Architecture - Project Navigator

    Submitted By: Mark Bauer on 02/16/2015


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

    Default Re: Default XREF Layer

    Quote Originally Posted by Wish List System View Post
    Summary: Be able to use a SETVAR to preset a Layer for XREFs

    Description: Be able to use a SETVAR to preset a Layer for XREFs (Like layer Xref).
    [] would use the current layer, but if a layer name was supplied, they would go to a default layer. you could still manually change them to any layer you wish, but it would help keep things organized - especially in a larger organization. If it was a SETVAR it could work in the Project Navigator, as well as vanilla AutoCAD.

    Product and Feature: AutoCAD Architecture - Project Navigator

    Submitted By: Mark Bauer on 02/16/2015
    Just use a Command reactor to store the current layer, set the desired layer current (i.e., "XREF"), and then restore original layer when done:

    Code:
    (vl-load-com)
    
    (defun XrefReactorSample ()
      (or
        *XrefReactor*
        (setq *XrefReactor*
               (vlr-command-reactor
                 "My Xref Reactor"
                 '(
                   (:vlr-commandcancelled . XrefCallback:CommandEnded)
                   (:vlr-commandended . XrefCallback:CommandEnded)
                   (:vlr-commandfailed . XrefCallback:CommandEnded)
                   (:vlr-commandwillstart . XrefCallback:CommandWillStart)
                  )
               )
        )
      )
      (prompt "\nXREF reactor loaded. ")
      (princ)
    )
    
    (defun XrefCallback:CommandEnded (rea cmd)
      (if (and (wcmatch (strcase (car cmd)) "*XATTACH,*XCLIP,*XREF")
               *XrefLayer*
          )
        (setvar 'clayer *XrefLayer*)
      )
    )
    
    (defun XrefCallback:CommandWillStart (rea cmd)
      (if (wcmatch (strcase (car cmd)) "*XATTACH,*XCLIP,*XREF")
        (progn
          (setq *XrefLayer* (getvar 'clayer))
          (vla-add
            (vla-get-layers (vla-get-activedocument (vlax-get-acad-object)))
            "XREF"
          )
          ;;<-- set other layer properties here
          (setvar 'clayer "XREF")
        )
      )
    )
    
    (defun c:StopXrefReactor ()
      (if *XrefReactor*
        (progn
          (vlr-remove *XrefReactor*)
          (setq *XrefReactor* nil)
        )
      )
      (prompt "\n** XREF reactor stopped ** ")
      (princ)
    )
    
    (XrefReactorSample)
    (prompt "\nInvoke \"STOPXREFREACTOR\" command to stop. ")
    "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. AEC - default style - default layer - strange lines
    By chopsuey in forum ACA General
    Replies: 2
    Last Post: 2011-08-20, 01:21 AM
  2. 3D Layer Setting Default to 2D Layer Settings
    By civil3d.wishlist1941 in forum Civil 3D Wish List
    Replies: 0
    Last Post: 2008-05-22, 10:01 PM
  3. Replies: 6
    Last Post: 2007-05-30, 05:45 PM
  4. Ability to Update an XREF Layer from the Layer Properties Manager
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2007-05-08, 12:50 PM
  5. Ignore XREF portion of layer name upon restoring layer state
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2006-11-08, 12:30 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
  •