Double numbers

Double numbers

Anonymous
Not applicable
684 Views
3 Replies
Message 1 of 4

Double numbers

Anonymous
Not applicable

Hi is it possible to search in a complete fiele with different blocks and attributs if numbers already exist in an automatically way and show a list with thr double names?

0 Likes
685 Views
3 Replies
Replies (3)
Message 2 of 4

3wood
Advisor
Advisor

You can try and register ALTEXT, save the codes below as a lsp file, then use it as a formula, as shown below.

It shows the result in the command line.

;;; This is an example formula for ALTEXT.vlx
;;; Summarize duplicated text and its quantity in the command line.
(defun ALTEXT_FORMULA (/ IfDup temp-list)
  
  (if (= ALTEXT_N4 0)
    (setq temp-list (list (cons ALTEXT_STR_ORG 1)))
    (progn
      (setq IfDup nil)
      (setq temp-list (mapcar '(lambda (y1) (if (equal (car y1) ALTEXT_STR_ORG) (progn (setq IfDup T) (cons ALTEXT_STR_ORG (1+ (cdr y1)))) y1))
			      temp-list
			      ))
      (if (not IfDup)
	(setq temp-list (append temp-list (list (cons ALTEXT_STR_ORG 1))))
	)
      )
    )
  (setq result "")
  
  (if (= ALTEXT_N4 (1- ALTEXT_TOTAL))
    (progn
      (foreach y2 temp-list (if (> (cdr y2) 1) (setq result (strcat result "\n" (car y2) "\t" (itoa (cdr y2))))))
      (if (not (equal result ""))
	(princ (strcat "\nDuplicated texts found:" result))
	(princ "\nNo duplicated text.")
	)
    )
    )

  nil
  )

ALTEXT_formula_24.gif

0 Likes
Message 3 of 4

Anonymous
Not applicable

Do not really like to register somwHere which is completly unknown where is behind it.

Regards

0 Likes
Message 4 of 4

norman.yuan
Mentor
Mentor

@Anonymous , there could some typos in your original post that may make people hesitate to reply: in the time you say "Double Number" while in the body you say "double name".  Do you mean you want to find out if there is duplicate attribute values from different block references (out of the same block definition)?

 

If so, yes, you can easily loop through the block references to find it out with VBA code. That is, simply use "For Each..." to go through the ModelSpace (assume that is where the block references are), test each entity to see if it is the block reference with given name. If easy, loop through the attribute references in the block reference and inspect its value.

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes