Results 1 to 4 of 4

Thread: Lisp to freeze all layers in an nested unloaded xref?

  1. #1
    Member
    Join Date
    2007-08
    Location
    Alberta, Canada
    Posts
    4
    Login to Give a bone
    0

    Default Lisp to freeze all layers in an nested unloaded xref?

    I'm trying to add this function to my lisp. Currently my lisp does this Detach all unloaded xrefs/audit the dwg/bind dwg/ purge all. The problem I have here is when my dwg has nested xrefs, it will not bind. Can some help me out with a code that will do this:

    If xref is nested and unloaded, then reload xref, and freeze all layers in xref.

    Here's my code so far. I'm new to lisp.

    Code:
    (defun c:SENT (/ *error* oldBnType);
    
      (defun *error*(msg)
        (setvar "modemacro" ".")
        (setvar "bindtype" oldBnType)
        (setvar "cmdecho" 1)
        (princ "\n...Detach/Audit/Bind/PurgeAll terminated!!! :( ")
        (princ)
        ); end of *error*
      
      (setq oldBnType(getvar "bindtype"))
      (setvar "modemacro" "Detach/Audit/Bind/PurgeAll processing......please wait......")
      (prompt "\n---Detach unloaded Xref, Audit, Bind, PurgeAll---")
      (prompt "\nDetaching...")
      (vlax-for block (vla-get-blocks
        (vla-get-activedocument
        (vlax-get-acad-object)))
          (if (and (= :vlax-true (vla-get-isxref block))
          (= 0 (vla-get-count block))
            )
          (vla-detach block)
          )
      )
      (setvar "cmdecho" 0)
      (prompt "...done")
      (prompt "\nAuditing...")(terpri)
      (command "_audit" "y")
      (prompt "\nBinding all Xrefs...")
      (setvar "bindtype" 0)
      (command "-xref" "b" "*")
      (prompt "...done")(terpri)
      (prompt "\nPurging #1")(terpri)
      (command "-purge" "a" "*" "N")
      (prompt "\nPurging #2")(terpri)
      (command "-purge" "a" "*" "N")
      (prompt "\nPurging #3")(terpri)
      (command "-purge" "a" "*" "N")
      (prompt "\n---Detach, Audit, Bind, PurgeAll completed!---")
      (setvar "modemacro" ".")
      (setvar "cmdecho" 1)
      (princ)
    ); end of c:sent

  2. #2
    Member
    Join Date
    2007-08
    Location
    Alberta, Canada
    Posts
    4
    Login to Give a bone
    0

    Default Re: Lisp to freeze all layers in an nested unloaded xref?

    No one? I guess it's harder than I thought.

  3. #3
    AUGI Addict
    Join Date
    2005-08
    Posts
    1,043
    Login to Give a bone
    0

    Default Re: Lisp to freeze all layers in an nested unloaded xref?

    It's not that hard, just time consuming. What you do is search the block collections for all the xrefs, then find out which ones are unloaded, then you have to search each one of those xref definitions and see if any of the blocks are really xrefs, and then freeze all those layers.

  4. #4
    AUGI Addict
    Join Date
    2005-08
    Posts
    1,043
    Login to Give a bone
    0

    Default Re: Lisp to freeze all layers in an nested unloaded xref?

    Could be even easier. If you just want to see what xrefs are nested, look at the dxf code of the block reference. In particular code 330.

    Never mind what is said in the post, it doesn't work. Go with the first way I said.
    Last edited by T.Willey; 2007-08-16 at 10:55 PM.

Similar Threads

  1. Need to freeze layers in a xref file
    By cadd4la in forum AutoLISP
    Replies: 3
    Last Post: 2012-04-30, 08:19 AM
  2. Replies: 17
    Last Post: 2011-11-29, 08:54 PM
  3. Replies: 3
    Last Post: 2009-09-06, 04:37 AM
  4. 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
  5. Freeze Xref layers
    By jbenway in forum AutoCAD General
    Replies: 5
    Last Post: 2005-02-01, 07:24 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
  •