Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Block layer Lisp Finder

  1. #1
    All AUGI, all the time BCrouse's Avatar
    Join Date
    2003-04
    Location
    Bethlehem, PA
    Posts
    980
    Login to Give a bone
    0

    Smile Block layer Lisp Finder

    Does anyone have a lisp that will search a drawing and list each layer that the block has in it. The lisp needs to specify the block name and the list of layers.

  2. #2
    100 Club lance.81922's Avatar
    Join Date
    2005-01
    Location
    Santa Fe, NM
    Posts
    176
    Login to Give a bone
    0

    Default Re: Block layer Lisp Finder

    Do you mean "list each layer that has a block in it"?

  3. #3
    All AUGI, all the time BCrouse's Avatar
    Join Date
    2003-04
    Location
    Bethlehem, PA
    Posts
    980
    Login to Give a bone
    0

    Smile Re: Block layer Lisp Finder

    No. Becasue most blocks that I have were created with the layers already in them. So I am trying to get them to be set to a standard of being on layer 0.

    Thank you

  4. #4
    100 Club lance.81922's Avatar
    Join Date
    2005-01
    Location
    Santa Fe, NM
    Posts
    176
    Login to Give a bone
    0

    Default Re: Block layer Lisp Finder

    How about this? It's not stylish, and simply prints the layer names:
    Code:
    ;;; BLOCK_LAYERS
    (defun c:block_layers ( / myblock tlist ename llist ctr)
    (while (setq myblock (car (entsel "\nSelect a block: ")))
    	(if (= (cdr (assoc 0 (entget myblock))) "INSERT")
    	 (progn
    (setq tlist (tblsearch "BLOCK" (cdr (assoc 2 (entget myblock))))
    	 ename (cdr (assoc -2 tlist))
    )
    (while ename
    (if llist
    	 (setq llist
    	 (append (list (cdr (assoc 8 (entget ename)))) llist)
    	 )
    	 (setq llist (list (cdr (assoc 8 (entget ename)))))
    )
    (setq ename (entnext ename))
    )
    (setq ctr 0)
    (princ(strcat "\nBlock " (cdr (assoc 2 (entget myblock)))))
    (repeat(length llist)
    (princ(strcat "\n" (nth ctr llist)))
    (setq ctr(1+ ctr))
    )
     
    	 )
    	 (if myblock
    (princ "\nObject is not a block. ")
    	 )
    	)
     
    )
    (princ)
    )
    Last edited by lance.81922; 2005-05-06 at 06:45 PM.

  5. #5
    All AUGI, all the time BCrouse's Avatar
    Join Date
    2003-04
    Location
    Bethlehem, PA
    Posts
    980
    Login to Give a bone
    0

    Smile Re: Block layer Lisp Finder

    Thank you for your help!

  6. #6
    100 Club lance.81922's Avatar
    Join Date
    2005-01
    Location
    Santa Fe, NM
    Posts
    176
    Login to Give a bone
    0

    Default Re: Block layer Lisp Finder

    You're welcome. You could avoid duplicate layer names in llist by checking to see if the layer name was already a member:
    Code:
    (if(not(member(cdr (assoc 8 (entget ename)))llist))
    (setq llist(append(cdr (assoc 8 (entget ename))) llist))
    )
    DOH! Shoulda thought of that when I wrote it.
    Last edited by lance.81922; 2005-05-06 at 07:44 PM.

  7. #7
    All AUGI, all the time CAB2k's Avatar
    Join Date
    2016-01
    Location
    Brandon, Florida
    Posts
    687
    Login to Give a bone
    0

    Default Re: Block layer Lisp Finder

    I though the request was to set all objects in the block to zero?
    If so http://www.theswamp.org/phpBB2/viewt...light=fixblock

  8. #8
    100 Club lance.81922's Avatar
    Join Date
    2005-01
    Location
    Santa Fe, NM
    Posts
    176
    Login to Give a bone
    0

    Default Re: Block layer Lisp Finder

    No, the original request was
    Does anyone have a lisp that will search a drawing and list each layer that the block has in it. The lisp needs to specify the block name and the list of layers.
    I guess he wanted to display exactly which layers the user(s) had put into the block.

  9. #9
    All AUGI, all the time CAB2k's Avatar
    Join Date
    2016-01
    Location
    Brandon, Florida
    Posts
    687
    Login to Give a bone
    0

    Default Re: Block layer Lisp Finder

    Sorry Lance, I must have misunderstood the request when I saw this.
    Quote Originally Posted by bnc_designs
    No. Becasue most blocks that I have were created with the layers already in them. So I am trying to get them to be set to a standard of being on layer 0.

    Thank you
    I read this as a clarification of the request which was something totally different.
    Perhaps Brad was just rambling at this point in the thread.

  10. #10
    100 Club lance.81922's Avatar
    Join Date
    2005-01
    Location
    Santa Fe, NM
    Posts
    176
    Login to Give a bone
    0

    Default Re: Block layer Lisp Finder

    My take on this is to respond to the original request, and/or to ask for clarification of that request. You're not wrong, ab2draft, you just saw something different than what I saw. It's certainly true that FIXBLOCK (and utilities that I, and doubtless a zillion others, have written) will move all the objects in a block to layer 0, thus gaining for it (the block) the ability to take on the characteristics of the layer on which it's inserted. I just figured that if bnc_designs wanted a program to do that, he/she would have said so.

    It does seem logical to change the blocks over -- I agree. It's just that different users (our AutoLISP "customers") have different ideas of how to accomplish their goals. I figure it's MY job, as a programmer, to give them what they ask for. Then, if they realize that what they asked for is not what they really want, I just adjust to suit. Sort of a "be careful what you ask for because you just might get it" philosophy.

    Just my $0.02 (adjusted for inflation).

    Lance

Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 2
    Last Post: 2017-06-06, 08:39 AM
  2. LISP to create layer, hatch and set layer back to original.
    By jpcadconsulting347236 in forum AutoLISP
    Replies: 1
    Last Post: 2013-12-11, 07:22 PM
  3. Replies: 13
    Last Post: 2011-06-28, 03:31 PM
  4. Text Finder
    By HeribertoOlivo in forum AutoCAD General
    Replies: 4
    Last Post: 2010-03-30, 01:18 AM
  5. layer control: lisp vs layer manager
    By gseals in forum AutoCAD Customization
    Replies: 2
    Last Post: 2004-10-08, 02:36 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
  •