请检查这是否是您想要的(红色变化):
- (defun c:deldup1_txt (/ ss ssdup ct len e eb pt lay ang sty hgt str obj obj_list)
- (princ "\nSelect text objects.") ;Select objects and filter all but block insert objects.
- (setq ss (ssget (list (cons 0 "TEXT"))))
- (if ss ;If any valid objects were selected.
- (progn
- (princ "\nBuilding list of objects.")
- (setq ssdup (ssadd)) ;Initialize new selection set to hold objects to delete
- (setq len (sslength ss)) ;Find out how many objects were selected.
- (setq ct 0)
- (while (< ct len) ;Loop through selected objects
- (setq e (ssname ss ct)) ;Get an object name
- (setq eb (entget e)) ;Get the entity list from the object name
- (setq ct (+ ct 1)) ;Increment index into selection set
- (setq str (cdr (assoc 1 eb))) ;Access object's text string
- ;Make list of object properties
- (setq obj (list pt lay ang sty hgt str))
- (if (not (member obj obj_list)) ;If these properties are not already in list
- (setq obj_list (cons obj obj_list)) ;Add them to the list
- (ssadd e ssdup) ;Else add object to selection set to delete
- ) ;End if
- ) ;End of while loop
- (if (> (sslength ssdup) 0) ;If there are any objects in the selection set to delete
- (progn
- [color=red](princ "\n[color=red]Marking [/color]duplicate objects.")
- [/color] (setq len (sslength ssdup)) ;Find out how many many objects to delete.
- (setq ct 0)
- (while (< ct len) ;Loop through objects and delete.
- (setq e (ssname ssdup ct)) ;Get object name
- (setq ct (+ ct 1)) ;Increment index into selection set
- [color=red]; (entdel e) ;Delete duplicate object[/color]
- [color=red] (command "_CHPROP" e "" "_C" 1 "")[/color]
- ) ;End of while loop
- (princ ;Print the number of objects deleted to command line
- [color=red] (strcat "\n"[/color]
- [color=red] (itoa len)[/color]
- [color=red] " duplicate objects colored in RED."[/color]
- [color=red] ))[/color]
- ) ;End progn
- (princ "\nNo duplicates found.") ;Else no there were no duplicates to delete.
- ) ;End if
- ) ;End progn
- (princ "\nNo text objects selected.") ;Else there were no valid objects selected
- ) ;End if
- (princ)
- )
当做
米尔恰 |