ich habe in einer Autocad-Datei 450 Zahlen, diese sollen alle mit entsprechenden Texten ersetzt werden (für jede Zahl ein entsprechender Text, die Werte habe ich in einer Excel-Datei stehen).
Jetzt wollte ich mir mit dem srxTEXT-Plugin eine Befehlsliste schreiben und diese nur in AutoCAD kopieren. Allerdings scheitere ich an einer Stelle:
Das wäre das Beispiel.
Wenn ich jetzt eine Befehlsliste schreibe, muss diese ohne ein manuelles Enter auskommen (also völlig automatisch ablaufen).
funktioniert aber nicht, da er bei Searchstring (15) das leerzeichen nicht als Enter interpretiert und der Befehl daher nicht weitergeht.
Auch das hier funktioniert nicht:
srxTEXT Exact 15 'filter A camp 'filter All
Ich möchte hier also einfach den Text 15 durch den Text A camp ersetzen. In der nächsten Zeile würde dann beispielsweise 16 durch B pend ersetzt usw.
Zitat:
SRXTEXT - search/replace with regular expressions
(C) 2006, XANADU s.r.o. http://www.xanadu.cz
-----------------------------------------------------SRXTEXT is a LISP utility for AutoCAD 2000/i, 2002,
2004, 2005, 2006 which can search and/or replace
drawing texts (TEXT, MTEXT, DIMTEXT, ATTRIB, ATTDEF).
You can choose from exact string match, substring
match/replace or regular expressions. For the
regular expression functionality, AutoCAD Express
Tools are required.
You can search (and replace) the whole drawing,
any specified layer or selected objects.
SRXTEXT zooms to any matching text and offers to
Replace, Autoreplace (Don't ask), Skip to next or
Exit the search/replace loop.
Using regular expressions you can perform complex
replacements like changing:
D19-457-03667
to
Part:457/03667 Code 19
For this case you would use the search and replace
strings:
\([A-Z][0-9][0-9]\)\-\(...\)\-\(.*\)
Part:\2/\3 Code:\1
Or you can append strings to the beginning of your
texts:
^\(.\)
newprefix\1
or to the end of your texts:
\(.\)$
\1newsuffix
Or you can replace just the first occurrence of
a substring in text:
search: \(.\)oldtext\(.\)
replace: \1newtext\2
Another example of complex replacements:
KWD-5-3, KW-4-2, KWP-1-5
to
KCD-5-1, KC-4-1, KCP-1-1
search: \(.\)W\(.*\)\-\(.\)\-\(.\)
replace: \1C\2-\3-1
Cutting the number of decimal places to 1:
search: \([0-9]*\)\.\([0-9]\)[0-9]*
replace: \1.\2
Adding a thousands separator (",") to numbers.
search: -?\([0-9]+\)\([0-9][0-9][0-9]\)
replace: \1,\2
(repeat it for milion/bilion/... triplets)
Delete all text after the first period in text:
search: ^\([^\.]*\)\..*
replace: \1.
Tip:
MTEXT objects can contain hidden control character
codes, so they may appear to not meet the exact
matches (btw, you can use SRXTEXT to remove these
control characters)
Tip:
set _SRXTEXTNOZOOM to T (true) to disable running zooms
SRXTEXT2 contains also a LISP interface so you can
use the srxText functionality in our LISP routines:
(srxTEXT "<mode>" "<search>" "<replace>" "<layers>")
<mode> can be Substring or Regular or Exact
<search> is the searched string
<replace> is the replacement string
<layers> can be All or name of an existing layer
returned value is the number of replacements done
Example:
(srxTEXT "Substring" "Ford T1" "Ford Galaxy" "All")
srxTEXT,"Exact","15","A camp","All"
srxTEXT Exact 15 'filter A camp 'filter All
License: SRXTEXT is a free utility by XANADU,
do not publish it online on other than XANADU's
web servers.
----------------------------------------------------
Contact:
XANADU s.r.o.
Tylova 17, 370 01 Ceske Budejovice, Czech Republic
info@xanadu.cz www.xanadu.cz www.cadforum.cz