Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/27/2022 in all areas

  1. modified @ronjonp lisp to work on all blocks instead of selecting one at a time. https://www.cadtutor.net/forum/topic/76007-make-block-reference-names-unqiue/?do=findComment&comment=600502 (defun C:UB-ALL (/ s) (if (setq s (ssget "_X" (list '(0 . "INSERT")))) (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (vla-converttoanonymousblock (vlax-ename->vla-object e)) ) ) (princ) ) As long as you don't purge the "old" block definitions are still there. ---EDIT After you run above code use my code to add the date to the prefix to each block name. ;;----------------------------------------------------------------------------;; ;; Add Prefix/Suffix to Block Name (defun C:BLKRENAME (/ blklst SS blk lst c a n) (vl-load-com) (setq blklst (vla-get-Blocks Drawing)) (prompt "\nSelect Block(s) or Enter To Rename All") (if (or (setq ss (ssget '((0 . "INSERT")))) (setq ss (ssget "_X" '((0 . "INSERT"))))) (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))) (setq blk (cdr (assoc 2 (entget e)))) ;Get Block Name (if (not (vl-position blk lst)) ;If Block Name is not in List Add (setq lst (cons blk lst)) ) ) ) (setq c 0) ;Count (initget "Prefix Suffix") (setq rep (cond ((getkword "\n Specify your aim [Prefix/Suffix] :")) ( "Suffix") ) ) (cond ((= rep "Prefix") (setq prfx (getstring "\nEnter Prefix: ")) (foreach n lst (vla-put-Name (vla-item blklst n) (strcat prfx n)) (setq c (1+ c)) ) ) ((= rep "Suffix") (setq sufx (getstring "\nEnter Suffix: ")) (foreach n lst (vla-put-Name (vla-item blklst n) (strcat n sufx)) (setq c (1+ c)) ) ) ) (prompt (strcat "\n" (rtos c 2 0) " Block(s) Renamed")) (princ) )
    1 point
×
×
  • Create New...