Hi there,
One existing lisp can change title block attribute from "0A" to "0B". Could you please advise me how to change it from "0B" to "0C"? Please see the screenshot and the lisp files below, the lisp and DWG file were attached as well. Thank you very much in advance.
the lisp file is below,
Solved! Go to Solution.
Solved by paullimapa. Go to Solution.
Just simply modify this function from:
(defun chgtxt (string)
(cond
(
(= (car (reverse (vl-string->list string))) 65)
(vl-string-subst "B" "A" string)
)
(
(= (car (reverse (vl-string->list string))) 97)
(vl-string-subst "b" "a" string)
)
)
)
To this:
(defun chgtxt (string)
(cond
(
(= (car (reverse (vl-string->list string))) 65)
(vl-string-subst "B" "A" string)
)
(
(= (car (reverse (vl-string->list string))) 66)
(vl-string-subst "C" "B" string)
)
(
(= (car (reverse (vl-string->list string))) 97)
(vl-string-subst "b" "a" string)
)
)
)
If I need to change it from "C" to "D", is the change below correct? Many thanks. 🙂
66 needs to be 67:
(= (car (reverse (vl-string->list string))) 67)
(vl-string-subst "D" "C" string)
)
"B" to "C" works well, but "C" to "D" did not work. Please see the portion of the lisp below,
One more place that needs to change from this:
(or
(wcmatch attribute_string "#[AaBb]")
(wcmatch attribute_string "##[AaBb]")
)
To this:
(or
(wcmatch attribute_string "#[AaBbCc]")
(wcmatch attribute_string "##[AaBbCc]")
)
But question:
1. Do you only want "0C" to change to "0D" or do you want any # in front as long as there's a C at the end to change to D ie: "0C" change to "0D" ; "1C" change to "1D" and "#C" change to "#D"?
Hello,
I want any # in front as long as there's a C at the end to change to D ie: "0C" change to "0D" ; "1C" change to "1D" .
In some cases, "D" needs to be changed "E", many thanks. 🙂
To make it easier for you to change on your own in the future, make the following changes.
Replace:
(defun chgtxt (string)
(cond
(
(= (car (reverse (vl-string->list string))) 65)
(vl-string-subst "B" "A" string)
)
(
(= (car (reverse (vl-string->list string))) 67)
(vl-string-subst "D" "C" string)
)
(
(= (car (reverse (vl-string->list string))) 97)
(vl-string-subst "b" "a" string)
)
)
)
with:
(defun chgtxt (string / num)
(cond
(
(= (chr (setq num (car (reverse (vl-string->list string))))) "C")
(vl-string-subst (chr (1+ num)) (chr num) string)
)
(
(= (chr (setq num (car (reverse (vl-string->list string))))) "c")
(vl-string-subst (chr (1+ num)) (chr num) string)
)
)
)
And replace this:
(or
(wcmatch attribute_string "#[AaBbCc]")
(wcmatch attribute_string "##[AaBbCc]")
)
With this:
(or
(wcmatch attribute_string "#[A-Z]")
(wcmatch attribute_string "##[A-Z]")
(wcmatch attribute_string "#[a-z]")
(wcmatch attribute_string "##[a-z]")
)
Now all you have to do when you want to change "C" or "c" to "D" or "d" is replace that character in that one location above
Hi there,
It looks like it did not work. I may make a mistake. Could you please look at it when you have chance? Thank you very much for your great support! 🙂
Did you try the Aset.lsp I attached in my previous post which should let you change 0C to 0D
once again glad to have helped...cheers!!!
Can't find what you're looking for? Ask the community or share your knowledge.