Hi,
I wonder if the below changes can be made to the current lisp?
1. The current lisp remove letter from the attribute of the blocks, for example, "1A", it will be changed to "1".
I want to add "1" to current attribute value, for example, if the current value is "2", the new value will be "3". The following blocks and respectively tag will be changed.
block names are BCH-X-BORD-DXXX, BCH-X-BORD-BXXX, BCH-X-BORD-AXXX, BCH-X-BORD-REVI, BCH-X-BORD-REVI-TRIA, BCH-X-ANNO-STMP-OBSO
attribute tag is REV_`#, R_NO, R_NO_D&E, R_NO_A&B, REV_NO
2. add one layer to the DWG, layer name: $X-ANNO-REVC-ELEC, color: 220
Please see the lisp below, the lisp file and one DWG file with blocks were attached as well, thank you very much in advance. 🙂
Solved! Go to Solution.
Solved by paullimapa. Go to Solution.
Solved by paullimapa. Go to Solution.
so since current attrib is 0A you want it changed to 1A or just 1
Sorry I did not say it clearly. The current one will remove the letter. For example, "1A", "2A" will be changed to "1", "2". I wish to increase value by "1". For instance, "1", "5" will be changed to "2", "6", thanks a lot!
so since your current example shows "0A", then you want it to be "1" right?
maybe there are mistakes in the lisp. I just run the lisp, "1A", "2A" attributes in the DWG were changed to "1", "2"
Maybe the below part did the job.
Then you must have posted the wrong sample dwg.
That one contains a Rev_# of 0A like I posted earlier:
When the current lisp you posted runs it changes Rev_# to 0:
For me either way works because the lisp can be revised so that:
If it sees a "0A", it'll be changed to "1"
If it sees a "1A", it'll be changed to "2"
I assume this is what you want, right?
yes, you are right. The dwg have some blocks, but it did not match the lisp. Sorry about it. What I wish:
1. the current value plus "1". "1" will be changed to "2", "5" will be changed to "6"
2. add one layer to the DWG, layer name: $X-ANNO-REVC-ELEC, color: 220
Thanks.
Ok, then I have another question.
What if REV_# only shows a single digit like "1" and no letters following?
Do you still want the "1" to become "2" or do you think there would NOT be a situation where you only have a single digit value for Rev_#?
all the attributes without letter, "1" becomes "2", "5" becomes "6", the value is added "1". sorry about it, thanks
Ok, give this revised ASet.lsp version a try.
Keep in my that every time it is run the Rev_# value will increment by 1
So don't run it again on the same dwg if you don't want it to change again.
I am little busy; I will test it later. Could you please advise me if the new layer was added as well? many thanks.
of course that's an easy add towards the end of the code like before.
Even you can do this:
(vl-cmdf "_.Layer" "_M" "$X-ANNO-REVC-ELEC" "_Co" 220 "" "") ; add layer name: $X-ANNO-REVC-ELEC, color: 220
Hi,
Great job! I wonder if the layer "$X-ANNO-REVC" can be freezed, I can't thank you enough. 🙂
Sure replace this line of code:
(vl-cmdf "_.Layer" "_M" "$X-ANNO-REVC-ELEC" "_Co" 220 "" "") ; add layer name: $X-ANNO-REVC-ELEC, color: 220
With these 2 lines:
(vl-cmdf "_.Layer" "_M" "$X-ANNO-REVC-ELEC" "_Co" 220 "" "") ; add layer name: $X-ANNO-REVC-ELEC, color: 220
(vl-cmdf "_.Layer" "_F" "$X-ANNO-REVC" "") ; freeze layer name: $$X-ANNO-REVC
make it look like this:
(vl-cmdf "_.Layer" "_M" "$X-ANNO-REVC-ELEC" "_Co" 220 "" "") ; add layer name: $X-ANNO-REVC-ELEC, color: 220
(vl-cmdf "_.Layer" "_F" "$X-ANNO-REVC" "") ; freeze layer name: $$X-ANNO-REVC
Glad to help … cheers!!!