Results 1 to 4 of 4

Thread: Need to freeze layers in a xref file

  1. #1
    I could stop if I wanted to cadd4la's Avatar
    Join Date
    2001-12
    Location
    Newport Beach, CA
    Posts
    399
    Login to Give a bone
    0

    Default Need to freeze layers in a xref file

    Hello,

    I need a code that will freeze a group of layers that are xref into the main drawing, not by name but by color 200. There will be a number of xrefs in this drawing so I need it to do this by a wildcard, not by drawing name, and I also need it to skip one drawing which is named 24_CD.dwg.

    Thank you.

    KC

  2. #2
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: Need to freeze layers in a xref file

    Untested:
    Code:
    (vl-load-com)
    
    (defun c:FrzXR200 ( / )
      (vlax-for layer (vla-get-Layers (vla-get-ActiveDocument (vlax-get-acad-object)))
        (if (and (wcmatch (vla-get-Name layer) "*|*") ;Is xref layer
                 (wcmatch (strcase (vla-get-Name layer)) "~24_CD|*") ;Not the 24_CD xref's layers
                 (= (vla-get-Color layer) 200)) ;Only layers with colour set to 200
          (vla-put-Freeze layer :vlax-true)))
      (princ))

  3. #3
    I could stop if I wanted to cadd4la's Avatar
    Join Date
    2001-12
    Location
    Newport Beach, CA
    Posts
    399
    Login to Give a bone
    0

    Default Re: Need to freeze layers in a xref file

    Thank you, the code works great.

  4. #4
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: Need to freeze layers in a xref file

    Glad to help. Hope you can figure out what's happening in my code - that way you could modify it if you have other options to check for

Similar Threads

  1. I Freeze Layers on the Sheet but wont Save what I Freeze
    By jrosario in forum AutoCAD General
    Replies: 3
    Last Post: 2008-02-15, 11:48 AM
  2. Lisp to freeze all layers in an nested unloaded xref?
    By ilovemyjeep88 in forum AutoLISP
    Replies: 3
    Last Post: 2007-08-16, 08:00 PM
  3. Replies: 3
    Last Post: 2006-09-22, 08:22 PM
  4. Replies: 3
    Last Post: 2006-07-19, 06:11 PM
  5. Freeze Xref layers
    By jbenway in forum AutoCAD General
    Replies: 5
    Last Post: 2005-02-01, 07:24 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
  •