
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Is there a way to add attributes to this list?
I want this to work but i have to burst the block first then use the lisp created.
i want to select the block with attributes to work the same as selecting text strings im crossing my fingers!
LISP Routine Below:
Takes two arguments: A String to search for and a string to search in.
;; Usage: (charfind "ST" "TEST") ; This will return 3.
;;
;; Example: (if (> (setq pos (charfind "S" "TEST")) 0)(princ "Found the letter S at position: " . pos)(Princ "One or both search parameters was blank"))
;;
;; Return Values:
;; -1 = character not found within given string.
;; -2 = Search string is empty. (srch)
;; -4 = Test String is empty. (str)
;; -6 = Search String and Test String are both empty.
(defun strfind(srch str / pt pt2 cnt)
(setq cnt 0 pt 0 pt2 nil)
(if (EQ (strlen srch) 0) (setq pt -2))
(if (EQ (strlen str) 0) (setq pt (+ pt (- 0 4))))
(if (EQ pt 0)(setq pt -1))
(while (and (< pt 0) (> (strlen str) 0)(< cnt (strlen str)))
(if (eq srch (substr str (setq cnt (1+ cnt)) (strlen srch)))(setq pt cnt))
)
(setq pt2 pt)
)
(defun remTxt(ba)
(setq ent(ssget '(
(-4 . "<OR")
(0 . "TEXT")(0 . "MTEXT")
(-4 . "OR>")
))
)
(setq cnt -1)
(repeat (sslength ent)
(setq cent (entget (ssname ent (setq cnt (1+ cnt)))))
(setq cur (cdr(assoc 1 cent)))
(setq pos (strfind "~" cur))
(if (EQ ba 1)
(setq new (substr cur 1 (1- pos)))
(setq new (substr cur (1+ pos) (strlen cur)))
)
(setq cent(subst (cons 1 New) (cons 1 cur) cent))
(entmod cent)
)
)
(defun c:remA()
(remTxt 1)
)
(defun c:remB()
(remTxt 0)
)
Solved! Go to Solution.