See the top rated post in this thread. Click here

Results 1 to 2 of 2

Thread: Automatically setting the layer the XRef goes to

  1. #1
    Join Date
    Login to Give a bone

    Default Automatically setting the layer the XRef goes to

    I have some code to put the Xref on the right layer it works for all commands part from when I use the attachments window and use Attach DWG..., I am working on Bricscad and on the command line the command is ._-XREF however when I add that command to my .lsp it does not seem to work.

    Please see code below.

    ;;Command Reactor for Xref layer
    ;;D.C. Broad 2012
    (if (null myxr-react)
    (setq myxr-react (vlr-command-reactor nil '((:vlr-commandwillstart . myxr-swaplayer)
    (:vlr-commandended . myxr-restorelayer)
    (:vlr-commandcancelled . myxr-restorelayer))))

    (defun setormakelayer (layn doc)
    (if (null (tblsearch "layer" layn))
    (vla-add (vla-get-layers doc) layn))
    (setvar "clayer" layn)

    ;;commandwillstart callback (reactor commandlist)
    (defun myxr-swaplayer (r cl / doc)
    (if (member (car cl) '("XATTACH" "XREF" "._-XREF" "_.XATTACH"));allowance for other commands
    (setq doc (vlr-document r))
    (vlr-data-set r (getvar "clayer"))
    (= 1 (vla-get-activespace doc))
    (setormakelayer "z_xref" doc)
    (setormakelayer "z_xref" doc)

    ;;commandended callback (reactor commandlist)
    (defun myxr-restorelayer (r cl)
    (if (and (member (car cl) '("XREF" "XATTACH"))
    (vlr-data r))
    (setvar "clayer" (vlr-data r))
    (vlr-data-set r nil)

  2. #2
    All AUGI, all the time Tharwat's Avatar
    Join Date
    Login to Give a bone

    Default Re: Automatically setting the layer the XRef goes to

    Try to replace member function with wcmatch.
    (wcmatch (strcase (car cl)) "*XATTACH*,*XREF*")

Similar Threads

  1. I want to relinquish things automatically just as I own things automatically
    By Wish List System in forum Revit Architecture - Wish List
    Replies: 2
    Last Post: 2012-06-25, 06:44 PM
  2. Replies: 0
    Last Post: 2009-05-01, 03:25 PM
  3. 2008 SCALE 1:100 xref xref xref xref- scale list issues
    By Apsis0215 in forum AutoCAD Customization
    Replies: 2
    Last Post: 2008-11-21, 08:17 PM
  4. Polar snap setting occasionally goes off a strange angle
    By Doodlemusmaximus in forum AutoCAD General
    Replies: 3
    Last Post: 2007-02-22, 08:54 PM
  5. Replies: 5
    Last Post: 2006-08-17, 05:55 PM

Tags for this Thread

Posting Permissions

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