Quantcast
Channel: Autodesk AutoCAD forums
Viewing all articles
Browse latest Browse all 14319

Replacing text in tables

$
0
0

Consider the following code:

 

(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 "*PL*" (vlax-invoke a 'GetText r (setq c (1+ c)))) (vlax-invoke  a 'SetText r c "THREAD ONE END"))))) (vla-delete ss)));progn);if

 

Basically, it replaces this text inside a table:

 

1 1/2" NPTM - A53 - 3000LB - A-53 - 3000 LB

with:

thread both ends.

 

But I'm limited to the size of pipe, it's material and its pressure rating.  I can't change how the text in the field is populated.  It would be nice if, it did a search for NPTM, and when that string exists in the string, change it to "thread both ends".

 

Essentially right now, I have 46 lines (and growing) of different scenarios.  I just want the NPTM to trigger the string change.

 

Does that makes sense?

 

Thanks

KP


Viewing all articles
Browse latest Browse all 14319

Trending Articles