TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: CAB on March 27, 2004, 09:56:16 PM

Title: Blocks, Whats in there?
Post by: CAB on March 27, 2004, 09:56:16 PM
In a effort to understand block entity structure a little better I
Took some code and came up with this routine that writes a blocks
entity list to a text file. It works with nested blocks and xrefs
as well. I believe it writes the complete entity list of blocks,
entities and sub blocks to the text file.
Please test it for yourself.

Here is the test DWG I used. Block Test.dwg (http://www.theswamp.org/lilly.pond/CAB/Block%20Test.dwg)

Suggestions & comments welcome..

Code: [Select]
;;;*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
;;; FUNCTION BlockInfo.lsp
;;;   Send a block definition to text file "Block Data-[block name].txt"
;;;   You should view text file with word wrap off because
;;;   some of the lined are very long
;;;
;;; ARGUMENTS
;;;   none
;;;
;;; USAGE
;;;   BlockInfo
;;;
;;; PLATFORMS
;;; 2000+
;;;
;;; AUTHOR
;;; Copyright© 2004 Charles Alan Butler  
;;;   ab2draft@TampaBay.rr.com
;;;
;;; VERSION
;;; 1.1 Sep. 23, 2004
;;;*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
;;;
;;; This routine may be used and copied for non-profit
;;;  purposes only. If you wish to include any of the file in a
;;;  commercial program, contact the author.
;;;
(defun c:BlockInfo (/ bname dxf data indent fname fn blkcnt indent)
  ;;  extract the data from dotted pair
  (defun dxf (x) (cdr (assoc x data)))

  (if (setq bname (entsel "Pick a block: "))
    (if (and (setq data (entget (car bname)))
    (or (= "INSERT" (dxf 0))
        (= "DIMENSION" (dxf 0))
    )
) ;and        
      (setq bname (dxf 2))
      (setq bname nil)
    ) ;if    
  ) ;if
  (cond
    (bname
     (setq Fname (Strcat "Block Data-" bname ".txt"))
     (setq fn (open  fname "w"))
     (prt "===============================================")
     (prt "                 BlockInfo.lsp")
     (prt "               Charles Alan Butler")
     (prt "            ab2draft@TampaBay.rr.com")
     (prt "               09/23/2004 Ver 1.1")
    (prt "===============================================")
     (setq blkcnt 0
  indent "| "
     )
     (listb bname)
     (prt "*********** END OF PARENT BLOCK *************")
     (setq indent nil)
     (prt "===============================================")
     (prt "=             End of Routine                  =")
     (prt "===============================================")
     (close fn)
     (prompt (strcat "\nBlock data written to file: " fname))
    )
    (t (print " no block found."))
  ) ;cond
  (princ)
)

;;--------------------------------------
;;  do the actual line print to file    
(defun prt (txt)
  (if indent
    (princ indent fn)
  )
  (princ txt fn)
  (write-line "" fn)
)

;;--------------------------------------
;;  This sub routine does all the work  
(defun listb (bname / dxf data wait)
  ;; return value from a dotted pair
  (defun dxf (x) (cdr (assoc x data)))

  ;; begin the main program
  (if (= blkcnt 0)
    (setq header (strcat "         Parent Block : " bname))
    (setq header (strcat "          Sub Block "
(itoa blkcnt); number of nested levels
" : "
bname
)
    )
  )
  (prt "***********************************************")
  (prt header)
  (prt "***********************************************")
 ; (prt (setq data (tblsearch "block" bname)))
  (prt (setq data (entget(tblobjname "block" bname))))
  (prt "---------    Objects In Block  ----------------")
  (setq data (dxf -2)) ; get first entity
  (prt (setq data (entget data '("*")))) ; get assoc list
  (while data
    (if (= (dxf 0) "INSERT")
      (progn
(setq blkcnt (1+ blkcnt)
     indent (strcat indent "| ")
)
(listb (dxf 2))
(setq indent (substr indent 3))
(prt "************ END OF SUB BLOCK **************")
      )
    )
    (if (setq data (entnext (dxf -1)))
      (prt (setq data (entget data '("*")))) ; get assoc list
    )
  ) ;while
  (princ)
)
(prompt "\nBlock Info Loaded, Enter BlockInfo to run.")
(princ)
;;;--- end of file -----------------------------------------
Title: Re: Blocks, Whats in there?
Post by: CAB on October 13, 2008, 10:41:14 PM
I see I have a newer version.
Code: [Select]
;;;*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
;;; FUNCTION BlockInfo.lsp
;;;   Send a block definition to text file "Block Data-[block name].txt"
;;;   You should view text file with word wrap off because
;;;   some of the lined are very long
;;;
;;; ARGUMENTS
;;;   none
;;;
;;; USAGE
;;;   BlockInfo
;;;
;;; PLATFORMS
;;; 2000+
;;;
;;; AUTHOR
;;; Copyright© 2004-2008 Charles Alan Butler 
;;;   ab2draft@TampaBay.rr.com
;;;
;;; VERSION
;;; 2.1 Oct 14, 2008
;;;*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
;;;
;;; This routine may be used and copied for non-profit
;;;  purposes only. If you wish to include any of the file in a
;;;  commercial program, contact the author.
;;;
(defun c:BlockInfo (/ ent bname dxf data indent fname fn blkcnt indent)
  ;;  extract the data from dotted pair
  (defun dxf (x) (cdr (assoc x data)))

  (if (setq ent (entsel "Pick a block: "))
    (if (and (setq data (entget (car ent)))
     (or (= "INSERT" (dxf 0))
         (= "DIMENSION" (dxf 0))
     )
) ;and       
      (setq bname (dxf 2))
      (setq bname nil)
    ) ;if
    (if (and
         (setq bname (getstring t "\nEnter the block name: "))
         (setq ss (ssget "_X" (list '(0 . "INSERT")(cons 2 bname))))
         (setq ename (ssname ss 0)))
      (princ); got a block
      (setq bname nil); GETNAME FAILED
      ); if
  ) ;if
  (cond
    (bname
     ;;  Revised for dynamic blocks, code by Tim Willey
     (setq Fname (Strcat (getvar 'dwgprefix) "Block Data-"
                   (if (= (substr bname 1 1) "*") (strcat "-star-" (substr bname 2)) bname) ".txt"))
     ;;(setq Fname (Strcat (getvar 'dwgprefix) "Block Data-" bname ".txt"))
     (setq fn (open  fname "w"))
     (prc "===============================================")
     (prc "                 BlockInfo.lsp")
     (prc "               Charles Alan Butler")
     (prc "            ab2draft@TampaBay.rr.com")
     (prc "               04/06/2008 Ver 2.1")
     (prc "===============================================")
      ;;  Create current Date & Time
      (setq tmp (rtos (getvar 'cdate) 2 4))
      (setq tmp (strcat "     <<  File Date "
                       (substr tmp 5 2) "/" (substr tmp 7 2) "/"
                       (substr tmp 1 4) "@" (substr tmp 10 2) ":"
                       (substr tmp 12 2) " >>"
                   )
      )
     (prc tmp)
     (setq blkcnt 0
   indent "| "
     )
     (if ent
       (progn
         (prc "---------    Insert entlist   -----------------")
         (prt (entget (car ent)))
        )
     )
     (listb bname)
     (prc "*********** END OF PARENT BLOCK *************")
     (setq indent nil)
     (prc "===============================================")
     (prc "=             End of Routine                  =")
     (prc "===============================================")
     (close fn)
     (prompt (strcat "\nBlock data written to file: " fname))
     (startapp "notepad" (findfile  Fname))
    )
    (t (print " no block found."))
  ) ;cond
  (princ)
)

;;--------------------------------------
;;  do the actual line print to file   
(defun prt (txt)
  (if indent
    (write-line (strcat indent (vl-prin1-to-string txt)) fn)
    (write-line (vl-prin1-to-string txt) fn)
  )
)

;;  do the actual line print to file   
(defun prc (txt)
  (if indent
    (write-line (strcat indent (vl-princ-to-string txt)) fn)
    (write-line (vl-princ-to-string txt) fn)
  )
)

;;--------------------------------------
;;  This recrusive sub routine does all the work 
(defun listb (bname / dxf data wait)
  ;; return value from a dotted pair
  (defun dxf (x) (cdr (assoc x data)))

  ;; begin the main program
  (if (= blkcnt 0)
    (setq header (strcat "         Parent Block : " bname))
    (setq header (strcat "          Sub Block "
(itoa blkcnt); number of nested levels
" : "
bname
)
    )
  )
  (prc "***********************************************")
  (prc header)
  (prc "***********************************************")
 ; (prt (setq data (tblsearch "block" bname)))
  (prc "---------    Block entlist   ------------------")
  (prt (setq data (entget(tblobjname "block" bname))))
  (prc "---------    Objects In Block  ----------------")
  (setq data (dxf -2)) ; get first entity
  (prt (setq data (entget data '("*")))) ; get assoc list
  (while data
    (if (= (dxf 0) "INSERT")
      (progn
(setq blkcnt (1+ blkcnt)
      indent (strcat indent "| ")
)
(listb (dxf 2)) ; recrusive call for sub blocks
(setq indent (substr indent 3))
(prc "************ END OF SUB BLOCK **************")
      )
    )
    (if (setq data (entnext (dxf -1)))
      (prt (setq data (entget data '("*")))) ; get assoc list
    )
  ) ;while
  (princ)
)
(prompt "\nBlock Info Loaded, Enter BlockInfo to run.")
(princ)
;;;--- end of file -----------------------------------------


<edit: code updated>
Title: Re: Blocks, Whats in there?
Post by: taner on October 14, 2008, 01:13:09 AM
Dear CAB,
I do not understand the code: (entget data '("*")),can you explain it more clearly. Can you change the code,I want to get the ename list of all subentity.Thanks.

Is there another way? such as vlisp?
Title: Re: Blocks, Whats in there?
Post by: Kerry on October 14, 2008, 05:19:43 AM
Dear CAB,
I do not understand the code: (entget data '("*")),can you explain it more clearly.

In the Vlide editor type entget .  Then select the entget text so it is highlighted.
Then press Ctrl F1 ... and read the help ... it is fairly clear.
(entget ename [applist])
Title: Re: Blocks, Whats in there?
Post by: CAB on October 14, 2008, 08:49:19 AM
Runnig my routine, selecting a block named "blk1" like this:

Code: [Select]
Command: blockinfo

Initializing...
Block Info Loaded, Enter BlockInfo to run.Pick a block:
Block data written to file: [b]Block Data-blk1.txt[/b]

You need to open the text file "Block Data-blk1.txt"
and you would find this:
Code: [Select]
===============================================
                 BlockInfo.lsp
               Charles Alan Butler
            ab2draft@TampaBay.rr.com
               04/06/2008 Ver 2.0
===============================================
     <<  File Date 10/14/2008@08:38 >>
| ---------    Insert entlist   -----------------
| ((-1 . <Entity name: 1c80778>) (0 . "INSERT") (330 . <Entity name: 1c6c810>) (5 . "A1FF") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "Duct") (100 . "AcDbBlockReference") (2 . "blk1") (10 1072.7 -166.344 0.0) (41 . 1.0) (42 . 1.0) (43 . 1.0) (50 . 0.0) (70 . 0) (71 . 0) (44 . 0.0) (45 . 0.0) (210 0.0 0.0 1.0))
| ***********************************************
|          Parent Block : blk1
| ***********************************************
| ---------    Block entlist   ------------------
| ((-1 . <Entity name: 1c80498>) (0 . "BLOCK") (330 . <Entity name: 1c80490>) (5 . "A193") (100 . "AcDbEntity") (67 . 0) (8 . "0") (100 . "AcDbBlockBegin") (70 . 0) (10 0.0 0.0 0.0) (-2 . <Entity name: 1c804a8>) (2 . "blk1") (1 . ""))
| ---------    Objects In Block  ----------------
| ((-1 . <Entity name: 1c804a8>) (0 . "LWPOLYLINE") (330 . <Entity name: 1c80490>) (5 . "A195") (100 . "AcDbEntity") (67 . 0) (8 . "0") (100 . "AcDbPolyline") (90 . 4) (70 . 1) (43 . 0.0) (38 . 0.0) (39 . -0.76) (10 12.8495 36.7524) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 17.0811 36.7524) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 17.0811 17.9402) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 12.8495 17.9402) (40 . 0.0) (41 . 0.0) (42 . 0.0) (210 0.0 0.0 1.0))
| ((-1 . <Entity name: 1c804b0>) (0 . "LWPOLYLINE") (330 . <Entity name: 1c80490>) (5 . "A196") (100 . "AcDbEntity") (67 . 0) (8 . "0") (100 . "AcDbPolyline") (90 . 4) (70 . 1) (43 . 0.0) (38 . 0.0) (39 . -0.76) (10 11.8112 10.0695) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 1.56641 10.0695) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 1.56641 28.753) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 11.8112 28.753) (40 . 0.0) (41 . 0.0) (42 . 0.0) (210 0.0 0.0 1.0))
| ((-1 . <Entity name: 1c804b8>) (0 . "LWPOLYLINE") (330 . <Entity name: 1c80490>) (5 . "A197") (100 . "AcDbEntity") (67 . 0) (8 . "0") (100 . "AcDbPolyline") (90 . 10) (70 . 0) (43 . 0.5) (38 . 0.0) (39 . -0.76) (10 12.7473 0.0) (40 . 0.5) (41 . 0.5) (42 . 0.0) (10 0.0 0.0) (40 . 0.5) (41 . 0.5) (42 . 0.0) (10 0.0 38.7977) (40 . 0.5) (41 . 0.5) (42 . 0.0) (10 9.85533 38.7977) (40 . 0.5) (41 . 0.5) (42 . 0.0) (10 9.85533 38.7977) (40 . 0.5) (41 . 0.5) (42 . 0.0) (10 19.9437 38.7977) (40 . 0.5) (41 . 0.5) (42 . 0.0) (10 19.9437 38.7977) (40 . 0.5) (41 . 0.5) (42 . 0.0) (10 29.8757 38.7977) (40 . 0.5) (41 . 0.5) (42 . 0.0) (10 29.8757 0.0) (40 . 0.5) (41 . 0.5) (42 . 0.0) (10 17.1409 0.0) (40 . 0.5) (41 . 0.5) (42 . 0.0) (210 0.0 0.0 1.0))
| ((-1 . <Entity name: 1c804c0>) (0 . "LWPOLYLINE") (330 . <Entity name: 1c80490>) (5 . "A198") (100 . "AcDbEntity") (67 . 0) (8 . "0") (100 . "AcDbPolyline") (90 . 4) (70 . 0) (43 . 0.0) (38 . 0.0) (39 . -0.76) (10 15.3658 8.87504) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 14.5649 8.87504) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 14.0521 9.3484) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 14.0521 17.9402) (40 . 0.0) (41 . 0.0) (42 . 0.0) (210 0.0 0.0 1.0))
| ((-1 . <Entity name: 1c804c8>) (0 . "LINE") (330 . <Entity name: 1c80490>) (5 . "A199") (100 . "AcDbEntity") (67 . 0) (8 . "0") (100 . "AcDbLine") (39 . -0.76) (10 13.0686 17.1784 0.0) (11 16.9266 17.95 0.0) (210 0.0 0.0 1.0))
| ((-1 . <Entity name: 1c804d0>) (0 . "LINE") (330 . <Entity name: 1c80490>) (5 . "A19A") (100 . "AcDbEntity") (67 . 0) (8 . "0") (100 . "AcDbLine") (39 . -0.76) (10 17.1324 15.7896 0.0) (11 13.0686 17.1784 0.0) (210 0.0 0.0 1.0))
| ((-1 . <Entity name: 1c804d8>) (0 . "LINE") (330 . <Entity name: 1c80490>) (5 . "A19B") (100 . "AcDbEntity") (67 . 0) (8 . "0") (100 . "AcDbLine") (39 . -0.76) (10 13.1225 14.5653 0.0) (11 17.1594 15.7802 0.0) (210 0.0 0.0 1.0))
| ((-1 . <Entity name: 1c804e0>) (0 . "LINE") (330 . <Entity name: 1c80490>) (5 . "A19C") (100 . "AcDbEntity") (67 . 0) (8 . "0") (100 . "AcDbLine") (39 . -0.76) (10 17.1594 12.9584 0.0) (11 13.1225 14.5653 0.0) (210 0.0 0.0 1.0))
| ((-1 . <Entity name: 1c804e8>) (0 . "LINE") (330 . <Entity name: 1c80490>) (5 . "A19D") (100 . "AcDbEntity") (67 . 0) (8 . "0") (100 . "AcDbLine") (39 . -0.76) (10 13.0833 11.8611 0.0) (11 17.1594 12.9584 0.0) (210 0.0 0.0 1.0))
| ((-1 . <Entity name: 1c804f0>) (0 . "LINE") (330 . <Entity name: 1c80490>) (5 . "A19E") (100 . "AcDbEntity") (67 . 0) (8 . "0") (100 . "AcDbLine") (39 . -0.76) (10 17.2378 10.1367 0.0) (11 13.0833 11.8611 0.0) (210 0.0 0.0 1.0))
| ((-1 . <Entity name: 1c804f8>) (0 . "LINE") (330 . <Entity name: 1c80490>) (5 . "A19F") (100 . "AcDbEntity") (67 . 0) (8 . "0") (100 . "AcDbLine") (39 . -0.76) (10 13.1225 9.15689 0.0) (11 17.2378 10.1367 0.0) (210 0.0 0.0 1.0))
| ((-1 . <Entity name: 1c80500>) (0 . "LINE") (330 . <Entity name: 1c80490>) (5 . "A1A0") (100 . "AcDbEntity") (67 . 0) (8 . "0") (100 . "AcDbLine") (39 . -0.76) (10 17.1986 7.23653 0.0) (11 13.1225 9.15689 0.0) (210 0.0 0.0 1.0))
| ((-1 . <Entity name: 1c80508>) (0 . "LINE") (330 . <Entity name: 1c80490>) (5 . "A1A1") (100 . "AcDbEntity") (67 . 0) (8 . "0") (100 . "AcDbLine") (39 . -0.76) (10 13.0833 5.78647 0.0) (11 17.1986 7.23653 0.0) (210 0.0 0.0 1.0))
| ((-1 . <Entity name: 1c80510>) (0 . "LINE") (330 . <Entity name: 1c80490>) (5 . "A1A2") (100 . "AcDbEntity") (67 . 0) (8 . "0") (100 . "AcDbLine") (39 . -0.76) (10 17.2207 3.86134 0.0) (11 13.0833 5.78647 0.0) (210 0.0 0.0 1.0))
| ((-1 . <Entity name: 1c80518>) (0 . "LINE") (330 . <Entity name: 1c80490>) (5 . "A1A3") (100 . "AcDbEntity") (67 . 0) (8 . "0") (100 . "AcDbLine") (39 . -0.76) (10 13.1113 1.69204 0.0) (11 17.2207 3.86134 0.0) (210 0.0 0.0 1.0))
| ((-1 . <Entity name: 1c80520>) (0 . "LWPOLYLINE") (330 . <Entity name: 1c80490>) (5 . "A1A4") (100 . "AcDbEntity") (67 . 0) (8 . "0") (100 . "AcDbPolyline") (90 . 4) (70 . 1) (43 . 0.0) (38 . 0.0) (39 . -0.76) (10 18.1195 10.0695) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 28.3643 10.0695) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 28.3643 28.753) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 18.1195 28.753) (40 . 0.0) (41 . 0.0) (42 . 0.0) (210 0.0 0.0 1.0))
| ((-1 . <Entity name: 1c80528>) (0 . "LWPOLYLINE") (330 . <Entity name: 1c80490>) (5 . "A1A5") (100 . "AcDbEntity") (67 . 0) (8 . "0") (100 . "AcDbPolyline") (90 . 6) (70 . 0) (43 . 0.0) (38 . 0.0) (39 . -0.76) (10 14.5649 -3.16418) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 14.5649 1.13547) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 14.0521 1.60882) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 12.7898 1.60882) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 12.7898 -3.16418) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 14.5649 -3.16418) (40 . 0.0) (41 . 0.0) (42 . 0.0) (210 0.0 0.0 1.0))
| ((-1 . <Entity name: 1c80530>) (0 . "LWPOLYLINE") (330 . <Entity name: 1c80490>) (5 . "A1A6") (100 . "AcDbEntity") (67 . 0) (8 . "0") (100 . "AcDbPolyline") (90 . 6) (70 . 0) (43 . 0.0) (38 . 0.0) (39 . -0.76) (10 15.3658 -3.16418) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 15.3658 1.13547) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 15.8786 1.60882) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 17.1409 1.60882) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 17.1409 -3.16418) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 15.3658 -3.16418) (40 . 0.0) (41 . 0.0) (42 . 0.0) (210 0.0 0.0 1.0))
| ((-1 . <Entity name: 1c80538>) (0 . "LWPOLYLINE") (330 . <Entity name: 1c80490>) (5 . "A1A7") (100 . "AcDbEntity") (67 . 0) (8 . "0") (100 . "AcDbPolyline") (90 . 4) (70 . 0) (43 . 0.0) (38 . 0.0) (39 . -0.76) (10 14.5649 8.87504) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 15.3658 8.87504) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 15.8786 9.3484) (40 . 0.0) (41 . 0.0) (42 . 0.0) (10 15.8786 17.9402) (40 . 0.0) (41 . 0.0) (42 . 0.0) (210 0.0 0.0 1.0))
| *********** END OF PARENT BLOCK *************
===============================================
=             End of Routine                  =
===============================================
Title: Re: Blocks, Whats in there?
Post by: Andrea on October 14, 2008, 09:18:08 AM
nice one.. :-)

I put my contribution...
Code: [Select]
(if (findfile Fname)
(startapp "notepad" (findfile  Fname))
(alert "Write permission denide")
)

revised.
Title: Re: Blocks, Whats in there?
Post by: CAB on October 14, 2008, 09:30:40 AM
Good idea Andrea!
Title: Re: Blocks, Whats in there?
Post by: ronjonp on October 14, 2008, 11:30:04 AM
hey CAB,

FWIW..I also added the (getvar 'dwgprefix) to your fname so the output file would be in the same directory.

Ron
Title: Re: Blocks, Whats in there?
Post by: CAB on October 14, 2008, 11:44:51 AM
Picky picky picky.

Just kidding, I updated the version 2.1 with the suggestions.
Comments & suggestions are always welcome. :-)

Two heads are better than one.
Title: Re: Blocks, Whats in there?
Post by: ronjonp on October 14, 2008, 11:59:05 AM
Picky picky picky.
...

 :-D
Title: Re: Blocks, Whats in there?
Post by: T.Willey on October 15, 2008, 06:59:31 PM
Alan,

  You maybe want to change it for dynamic blocks, as the star in the name of the block will make it error.  I just tried it and it error'ed out of me; just and FYI.

My quick fix.
Code: [Select]
(setq Fname (Strcat (getvar 'dwgprefix) "Block Data-" (if (= (substr bname 1 1) "*") (strcat "-star-" (substr bname 2)) bname) ".txt"))
Title: Re: Blocks, Whats in there?
Post by: CAB on October 15, 2008, 07:22:13 PM
Thanks Tim, I updated the code above with your fix.
Title: Re: Blocks, Whats in there?
Post by: CAB on August 17, 2009, 08:12:26 AM
Latest version attached.
Title: Re: Blocks, Whats in there?
Post by: GDF on August 18, 2009, 11:39:22 AM
Latest version attached.


Using 2010 version.

Pick a block: ; error: bad argument type: lentityp nil

I tried it on an attributed block...It still writes out to file.
Title: Re: Blocks, Whats in there?
Post by: Lee Mac on August 18, 2009, 12:12:38 PM
Fails in this loop:

Code: [Select]
(while
             (/= (assoc 0 (setq elst (entget (setq ent (entnext ent))))) "")
           )
Title: Re: Blocks, Whats in there?
Post by: Lee Mac on August 18, 2009, 12:17:52 PM
This should fix it  :wink:
Title: Re: Blocks, Whats in there?
Post by: CAB on August 18, 2009, 01:21:48 PM
Thanks Lee. 8-)
Title: Re: Blocks, Whats in there?
Post by: Lee Mac on August 18, 2009, 01:42:51 PM
You'd do the same for me  :wink:
Title: Re: Blocks, Whats in there?
Post by: GDF on August 18, 2009, 02:03:07 PM
That fixed it Lee.
Nice routine Alan. Thanks for sharing it.
Title: Re: Blocks, Whats in there?
Post by: CAB on August 18, 2009, 03:21:18 PM
You're quite welcome. 8-)
Title: Re: Blocks, Whats in there?
Post by: CAB on August 19, 2009, 05:44:34 PM
Version 2.4 is here:  http://www.theswamp.org/index.php?topic=29953.msg355214#msg355214