Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

String - search

4 REPLIES 4
Reply
Message 1 of 5
K_R_Venkat
272 Views, 4 Replies

String - search

Hi all,

In my drawing, there are 2 sets of Rebar Description(annotation) has been placed for same Bar in plan & Section respectively.

plan has been annotated by "8 T16-250-09-L-BARS" and the same has been annotated by "09" in Section.

now i want to change all the Section Annotation same as Plan Annotation.

for that one, i need to search the string which is contains "-09-" barmark.
and replace.

you know it is more risky to go one by one and edit.

could anyone have an idea about how to build the selection and replace the text by using lisp.

Anyidea about how to build a lisp (selection set, wcmatch & subst)

your idea's and suggestion greatly appreciated

Thanks,
Venkat Edited by: rpvrk_pss on Jun 7, 2009 10:45 AM
4 REPLIES 4
Message 2 of 5
Kent1Cooper
in reply to: K_R_Venkat

Have you tried the FIND command? It has a Replace with: option, and even a Replace All option so you don't have to step through each one it finds.

--
Kent Cooper
Kent Cooper, AIA
Message 3 of 5
K_R_Venkat
in reply to: K_R_Venkat

Thanks kent,

It seems that i didn't explain correctly.

There are two text. (1) 8 T16-250-09-L-BARS
(2) 09

Now text (2) is to be edit exactly same as (1). some how replace.

for that, i am using "-09-" to get the whole text (1) string in find and replace command, zoom to that location, copy text(1) string and paste it to text (2) string.

In one drawing there are around 50 text (2)strings needs to be update. (go one by one and find the co-related text(1) each)

lot of dwg's need to be update like this.

so i am looking for any help to simplify my task more efficiently.

Regards
Venkat
Message 4 of 5
MorganMcGuire
in reply to: K_R_Venkat

Hi,

Try this. Select all text entities if you wish, and then select the text you want to have the contents set to. It will only change text that have the contents of "09" solely. ie, won't change "09ABC" or "ABC09" etc.

I'd globally select all text as it will only replace text with "09" anyway. If you do this change the line (setq ss (ssget '((0 . "MTEXT,TEXT")))) to (setq ss (ssget "_X" '((0 . "MTEXT,TEXT"))))


{code}
(defun c:REP-TEXT (/ ss count tnum ent txt new-txt)
(setvar "cmdecho" 0)
(command "undo" "begin")
(prompt "\nSelect TEXT/MTEXT to change contents of:")
(setq ss (ssget '((0 . "MTEXT,TEXT"))))
(if ss
(progn
(setq new-txt (cdr (assoc 1 (entget (car (entsel "\nSelect text have contents of set to... "))))))
(setq count 0)
(setq tnum (sslength ss))
(while (< count tnum)
(setq ent (entget (ssname ss count)))
(setq txt (cdr (assoc 1 ent)))
(if (and (= (strlen txt) 2) (= (substr txt 1 2) "09"))
(progn
(setq ent (subst (cons 1 new-txt) (assoc 1 ent) ent))
(entmod ent)
) ; end progn
) ; end if
(setq count (1+ count))
) ; end while
) ; end progn
) ; end if
(command "undo" "end")
(setvar "cmdecho" 1)
(princ)
)
{code}

Morgan.
Message 5 of 5
K_R_Venkat
in reply to: K_R_Venkat

Hi Morgan,

Thank you so much.

is it possible to use WCMATCH function to compare?

do you have any idea about how to call a symbol for pattern? (wcmatch string pattern)

your help greatly appreciated

Regards,
Venkat

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost