Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18

Thread: Need a Lisp

  1. #11
    All AUGI, all the time
    Join Date
    2010-06
    Posts
    962
    Login to Give a bone
    0

    Default Re: Need a Lisp

    Hi,

    Add your list of layer names as indicated in the following routine and let me know how this works:

    Code:
    (defun c:frz (/ sel ref pfx lay frz get)
      ;; Tharwat - date: 28.Jun.2018	;;
      (and (princ "\nPick on Xref to freeze layers :")
           (setq sel (ssget "_+.:S:E" '((0 . "INSERT"))))
           (or (/= ""
                   (setq ref
                          (cdr
                            (assoc 1
                                   (entget (tblobjname
                                             "BLOCK"
                                             (cdr (assoc 2 (entget (ssname sel 0))))
                                           )
                                   )
                            )
                          )
                   )
               )
               (alert "Pick object is not an Xref <!>")
           )
           (setq pfx (vl-filename-base ref))
           (foreach lst '("Layer1" "Layer2" "Layer3") ;; Add your list of layer names here.
             (and (tblsearch "LAYER" (setq lay (strcat pfx "|" lst)))
                  (not (= 1
                          (logand 1
                                  (setq frz
                                         (cdr
                                           (assoc 70
                                                  (setq get (entget (tblobjname "LAYER" lay)))
                                           )
                                         )
                                  )
                          )
                       )
                  )
                  (entmod (subst (cons 70 (+ frz 1)) (assoc 70 get) get))
             )
           )
      )
      (princ)
    )

  2. #12
    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 a Lisp

    Tharwat,

    Thanks once again for your help it works on the xref in the opened file but can it have an option to drill down and also freeze the layers with the same name that are in a file that is xref'd as an attachment in that xref file that I'm using the lisp program in?

    Regards,

  3. #13
    All AUGI, all the time
    Join Date
    2010-06
    Posts
    962
    Login to Give a bone
    0

    Default Re: Need a Lisp

    Quote Originally Posted by cadd4la View Post
    Tharwat,

    Thanks once again for your help it works on the xref in the opened file but can it have an option to drill down and also freeze the layers with the same name that are in a file that is xref'd as an attachment in that xref file that I'm using the lisp program in?

    Regards,
    Sorry, I did not get your point that clearly.

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

    Default Re: Need a Lisp

    If you want to freeze the same layer names for ALL present xrefs, why couldn't you use a wildcard in your layer names list, instead of picking an xref?

    Code:
    ......
    (command "-layer" "freeze" "*|layer1" "")
    Just a thought,
    Tharwat's code is WAY over my head to attempt to modify it

  5. #15
    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 a Lisp

    Quote Originally Posted by Tharwat View Post
    Sorry, I did not get your point that clearly.
    Tharwat,

    I have a file that has for an example a layer named xclip plus a few more and then another file that also has a layer named xclip plus a few more. Both files are in the output file that is plotted with one of the files being xref'd into the other as an attachment and then that file is then xref'd into the output file so both are in the output file. What I have done in the past is use the layer manager and go to each one of the xrefs and freeze the layers one at a time. The code you gave me will freeze the layers from the list but will not freeze the same layer names on a file that is xref'd into the master xref file.

    Hope this helps you understand.

    Thanks,

  6. #16
    All AUGI, all the time
    Join Date
    2010-06
    Posts
    962
    Login to Give a bone
    0

    Default Re: Need a Lisp

    Quote Originally Posted by tedg View Post
    Just a thought,
    Tharwat's code is WAY over my head to attempt to modify it
    Please ask if you would like me to explain anything about the codes for you.

    Quote Originally Posted by cadd4la View Post
    Tharwat,

    I have a file that has for an example a layer named xclip plus a few more and then another file that also has a layer named xclip plus a few more. Both files are in the output file that is plotted with one of the files being xref'd into the other as an attachment and then that file is then xref'd into the output file so both are in the output file. What I have done in the past is use the layer manager and go to each one of the xrefs and freeze the layers one at a time. The code you gave me will freeze the layers from the list but will not freeze the same layer names on a file that is xref'd into the master xref file.

    Hope this helps you understand.

    Thanks,
    Hi,

    Something like this?
    Code:
     (defun c:frz (/ nxt lay frz get)
      ;; Tharwat - Date: 29.Jun.2018	;;
      (while (setq nxt (tblnext "LAYER" (not nxt)))
        (and (vl-some '(lambda (chk)
                         (wcmatch (setq lay (cdr (assoc 2 nxt)))
                                  (strcat "*" chk "*")
                         )
                       )
                      '("Layer1" "Layer2" "Layer3") ;; Add your list of layer names here.
             )
            (not (= 1
                          (logand 1
                                  (setq frz
                                         (cdr
                                           (assoc 70
                                                  (setq get (entget (tblobjname "LAYER" lay)))
                                           )
                                         )
                                  )
                          )
                       )
                  )
                  (entmod (subst (cons 70 (1+ frz)) (assoc 70 get) get))
        )
      )
      (princ)
    ) (vl-load-com)
    @MODERATORS, lately I don't receive emails when users reply to one of the threads that I ready contributed with to my inbox nor to spam folder.

  7. #17
    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 a Lisp

    Tharwat,

    The code works great, thank you for all your hard work.

    Cadd4la

  8. #18
    All AUGI, all the time
    Join Date
    2010-06
    Posts
    962
    Login to Give a bone
    0

    Default Re: Need a Lisp

    Quote Originally Posted by cadd4la View Post
    Tharwat,

    The code works great, thank you for all your hard work.

    Cadd4la
    Excellent. You are welcome anytime.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Help with autolisp (2 lisp programs in one lisp execution)
    By javier-perez1956746375 in forum AutoLISP
    Replies: 1
    Last Post: 2017-06-15, 07:40 PM
  2. Replies: 13
    Last Post: 2014-01-20, 06:14 PM
  3. Replies: 3
    Last Post: 2012-05-07, 08:16 PM
  4. Replies: 9
    Last Post: 2012-01-21, 07:58 AM

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
  •