Message 1 of 24
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a lot of dwg's where I want to separate all the text to it's own layers but leave the other objects where they are.
I know I need to get a list of layers.
create the list with a -text suffix
I've not gotten done commenting it out but here it is.
;; RJP » 2023-05-09 wrote most of this routine.
;;; DESCRIPTION
;;; 2023-05-09
;;; add prefix text- to new layers that have text
;;; Dig into blocks and do the same.
;;;Lonnie
;;;
(defun c:TSP (/ a d la ln pre)
(vlax-for l (setq la (vla-get-layers (setq d (vla-get-activedocument (vlax-get-acad-object)))))
(cond ((= -1 (vlax-get l 'lock)) (vlax-put l 'lock 0) (setq a (cons l a))))
)
(setq pre "TEXT-")
(vlax-for b (vla-get-blocks d)
(if (= 0 (vlax-get b 'isxref))
(vlax-for o b
(cond ((and (vlax-write-enabled-p o)
(vlax-property-available-p o 'textstring)
(not (wcmatch (strcase (setq ln (vla-get-layer o))) (strcat pre "*" )))
)
(entmod (append (entget (vlax-vla-object->ename o)) (list (cons 8 (strcat pre ln)))))
)
)
)
)
)
(foreach l a (vlax-put l 'lock -1))
(if (ssget "_X" '((0 . "INSERT") (66 . 1)))
(command "_.Attsync" "_N" "*")
)
(vla-regen d acallviewports)
(princ)
)
Then I need to gather up the text and move it to the new layer.
This is where I've been running into problem.
Solved! Go to Solution.