Results 1 to 2 of 2

Thread: Add function to Lisp to make new layer "No Plot"

  1. #1
    Member caddjockey2000's Avatar
    Join Date
    2004-05
    Location
    Denver
    Posts
    38
    Login to Give a bone
    0

    Default Add function to Lisp to make new layer "No Plot"

    I have a DEMO lisp that will take objects you select and create a new layer of the same name but with a DEMO extension at the end, and place the selected object on the new DEMO layers. I would like to add another function making the new demo layer NO PLOT as well. Below is the Lisp code I am currently using:

    Code:
    (defun c:demo ( / i l n s x )
        (if (setq s (ssget "_:L" '((8 . "~*-DEMO"))))
            (repeat (setq i (sslength s))
                (setq x (vlax-ename->vla-object (ssname s (setq i (1- i))))
                      l (vla-get-layer x)
                      n (strcat l "-DEMO")
                )
                (if (checkmakelayer l n) (vla-put-layer x n))
            )
        )
        (princ)
    )
    (defun checkmakelayer ( a b )
        (cond
            (   (tblsearch "layer" b))
            (   (setq a (tblobjname "layer" a))
                (setq a (entget a))
                (entmake
                    (subst (cons 2 b) (assoc 2 a)
                        (subst '(62 . 204) (assoc 62 a)
                            (vl-remove-if '(lambda ( x ) (or (= 'ename (type (cdr x))) (= 102 (car x)))) a)
                        )
                    )
                )
            )
        )
    )
    (vl-load-com) (princ)
    Last edited by BlackBox; 2017-10-05 at 08:37 PM. Reason: Please use [CODE] Tags

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

    Default Re: Add function to Lisp to make new layer "No Plot"

    Hi,
    Add the following highlighted codes into your sub-function to force the new created Layer to be Not Plot.

    Code:
    (subst (cons 2 b) (assoc 2 a)
       (subst '(290 . 0) (assoc 290 a)
         (subst '(62 . 204) (assoc 62 a)
             (vl-remove-if '(lambda ( x ) (or (= 'ename (type (cdr x))) (= 102 (car x)))) a)
         )
      )
    )

Similar Threads

  1. Replies: 2
    Last Post: 2016-12-22, 01:02 PM
  2. importing layer states via "layerstate-import" function
    By kmayhew936033 in forum AutoLISP
    Replies: 10
    Last Post: 2011-09-30, 08:02 AM
  3. S::Startup ignores lisp "command" function
    By sshively.230498 in forum CAD Management - General
    Replies: 2
    Last Post: 2010-04-20, 12:09 PM
  4. Please explain how LISP function "cond" works
    By ccowgill in forum AutoLISP
    Replies: 11
    Last Post: 2006-11-18, 08:31 PM
  5. Replies: 13
    Last Post: 2006-11-06, 09:38 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
  •