I'm in way over my head with this.
I have the following code. The crux of the code is tis.
I have a lot drawings with tables, that get populated automatically by an external database. I can't modify the source of the text strings that I want to replace, so I have to replace them after they get generated.
Essentailly, the text i want to replace, well, it's garbage, but it does mean something, and that's what the code does. take thegarbage string and make it somethign that someone understands.
Anyway, here it is:
(defun C:EP (/ ss a b c r)
(vl-load-com)
(if (ssget "_X" '((0 . "ACAD_TABLE")(1 . "PIPE LIST")))
(progn
(vlax-for
a (setq ss (vla-get-ActiveSelectionSet
(vla-get-ActiveDocument
(vlax-get-acad-object))))
(repeat (setq r (vla-get-rows a)) (setq r (1- r) c -1) (repeat (vla-get-columns a) (if (eq "1 1/2\" PL" (vlax-invoke a 'GetText r (setq c (1+ c)))) (vlax-invoke a 'SetText r c "NONE"))));repeat)
(repeat (setq r (vla-get-rows a)) (setq r (1- r) c -1) (repeat (vla-get-columns a) (if (eq "1 1/2\" NPTM - 150LB" (vlax-invoke a 'GetText r (setq c (1+ c)))) (vlax-invoke a 'SetText r c "THREAD BOTH ENDS"))));repeat)
(repeat (setq r (vla-get-rows a)) (setq r (1- r) c -1) (repeat (vla-get-columns a) (if (eq "1 1/2\" PL - 1 1/2\" NPTM - 150LB" (vlax-invoke a 'GetText r (setq c (1+ c)))) (vlax-invoke a 'SetText r c "THREAD ONE END"))));repeat)
(vla-delete ss) ) ;progn
)
)
)
This list can and will get quite lengthy, as there so many potential possibilities for treating the ends of pipe for fabrication.
Is this a tall order or something?
it's totally possible to do what you want using LISP. That said, it may take some debugging. At the risk of offending LISP gurus, you might be better off using VB.NET (or even VBA) to do this as I personally think it's probably more suited to the job in that it's much more logical in their approach to processing the table entries/contents.