Hi John Kaul (Se7en),
I am a writer on cadtutor.net,
https://www.cadtutor.net/forum/topic/74116-lisp-to-count-text-and-layers/ (https://www.cadtutor.net/forum/topic/74116-lisp-to-count-text-and-layers/)
Thank you very much for this article.
I saw the link and saw your post here but I still don't know how to combine the above code.
Do I just copy and combine all the code in that post into a single lisp and use it
Regards,
Layer 1_CRP_TEXT, Text = BUTT JOINT WITH BISCUIT, Count = 1
Layer 1_CRP_TEXT, Text = Base Not by C-tec, Count = 1
Layer 1_CRP_TEXT, Text = Birch Case work, Count = 1
Layer 1_CRP_TEXT, Text = Birch Casework, Count = 16
Layer 1_CRP_TEXT, Text = Birch Chair Rail, Count = 3
Layer 1_CRP_TEXT, Text = Birch Door, Count = 2
Layer 1_CRP_TEXT, Text = Birch Drawer Faces, Count = 1
Layer 1_CRP_TEXT, Text = Birch Interior, Count = 1
Layer 1_CRP_TEXT, Text = Birch Panels, Count = 1
Layer 1_CRP_TEXT, Text = Birch Support, Count = 1
Layer 1_CRP_TEXT, Text = Birch Veneer, Count = 1
Layer 1_CRP_TEXT, Text = Birch veneer base, Count = 1
Layer 1_CRP_TEXT, Text = Birch veneer over 3/4" MDF, Count = 1
Layer 1_CRP_TEXT, Text = Blocking BY GC, Count = 3
Layer 1_CRP_TEXT, Text = Blocking By GC, Count = 1
Layer 1_CRP_TEXT, Text = Blum File system, Count = 1
Layer 1_CRP_TEXT, Text = Butt Joint, Count = 1
Layer 1_CRP_TEXT, Text = C-TEC WILL PROVIDE GC A 1/2" PARTICAL BOARD TEMPLATE OF GLASS , Count = 2
Layer 1_CRP_TEXT, Text = Column, Count = 1
Layer 1_CRP_TEXT, Text = Continuous attachment cleat, Count = 1
Layer 1_CRP_TEXT, Text = Dado For Glass, Count = 1
Layer 1_CRP_TEXT, Text = Dark Stained Reveals, Count = 2
Layer 1_CRP_TEXT, Text = Dark Stained 1/4" Reveals, Count = 1
Layer 1_CRP_TEXT, Text = Dark Stained Birch, Count = 1
Layer 1_CRP_TEXT, Text = Dark Stained Birch
;;;===================================================================
;;; string-count
;;;-------------------------------------------------------------------
;;; Date: 2021.12.08
;;; Author: ancrayzy
;;;-------------------------------------------------------------------
;;; This will count strings in the drawing and create a table showing
;;; the text string and the layer the text resides on.
;;;
;;; Inspiration and code has been taken from:
;;; Vladimir Neterovsky
;;; LeeMac
;;;===================================================================
;;;===================================================================
;;; String-count
;;;-------------------------------------------------------------------
;;; Date: 2021.12.09
;;; Author: ancrayzy
;;;-------------------------------------------------------------------
;;; This will count strings in the drawing and create a table showing
;;; the text string and the layer the text resides on.
;;;
;;; Inspiration and code has been taken from:
;;; Vladimir Neterovsky
;;; LeeMac
;;;===================================================================
(defun c:stringcount ( / *acdocument* *acdocumentspace*)
textkeylist point )
(setq *acdocument*
(vla-get-activedocument (vlax-get-acad-object))
*acdocumentspace*
(vlax-get-property
*acdocument*
(if (= 1 (getvar 'CVPORT))
'Paperspace
'Modelspace
) ;_if
) ;_vlax-get-property
) ;_setq
(_StartUndo *acdocument*)
(setq textkeylist
(getk '(1 8)
(mapcar
'entget
(sel2lst
(ssget"X" '((0 . "TEXT,MTEXT")))))
) ;_getk
) ;_setq
(if (apply 'and textkeylist)
(setq textkeylist
(cons (list "String" "Layer") textkeylist))
(quit)
)
(setq point (getpoint "\nSpecify point for table: "))
(LM:AddTable
*acdocumentspace*
(trans point 1 0)
"STRING COUNT"
textkeylist
)
(_EndUndo *acdocument*)
) ;_defun
(princ "\nstring count lisp loaded. Type [stringcount] to
begin.")
Command: AP
APPLOAD STRINGS COUNT.LSP successfully loaded.
Command:
string count lisp loaded. Type [stringcount] to begin.
Command:
Command: STRINGCOUNT
; error: no function definition: _STARTUNDO
I modify the lisp as per BIGAL's answer but it still doesn't work. The following results ...
Thank you Mr Tharwat,
It work well, but the lisp must ask user to select the area before processed.
If it automatically runs, it will count all the texts in the drawing and it is not necessary for user.
Regards