Lisp question
Hi I have a puzzling lisp issue.
I have routine that basically swaps blocks of one height/coluor; for ones of differing height/colour.
When we moved from acad to bricscad, this needed a slight tweak; but has worked fine since.
My issue arrises from wanting to add an extra item for this routine to look for and swap.
I am in no way a programer, but have over the years been able work out what most of our old lisp do and amend as required; this one i cannot get to work.
The routine works on all the existing parts as it should but, i seems it cannot see/accept the new addition.
Specifically, i have a group of .dwg called EU050 through to EU240, the number being the height. If i insert EU240 into the drawing as a block and then run the routine (MCLICK at commandline) and select one of the height options; this will swap EU240 with EU210(for example).
The colour choice part is for other blocks and works fine, so just hit enter; to go with the set option.
I now need to add a function for a part labeled OUL050 through OUL240.
I have added in lines of code for OUL, in the same form as that for EU; but the routine does not swap the OUL.
The OUL.dwg are in the same folder as those of the EU, so if it is able to see that location to find EU; then it should find the OUL.
But i cant work out from the code, where it is set to look for the .dwg to insert.
Nor can i work out if there is section that needs to be told there is an extra item in the code.
Can anyone assist with this?
I have attched the lisp and the above described .dwg
I have routine that basically swaps blocks of one height/coluor; for ones of differing height/colour.
When we moved from acad to bricscad, this needed a slight tweak; but has worked fine since.
My issue arrises from wanting to add an extra item for this routine to look for and swap.
I am in no way a programer, but have over the years been able work out what most of our old lisp do and amend as required; this one i cannot get to work.
The routine works on all the existing parts as it should but, i seems it cannot see/accept the new addition.
Specifically, i have a group of .dwg called EU050 through to EU240, the number being the height. If i insert EU240 into the drawing as a block and then run the routine (MCLICK at commandline) and select one of the height options; this will swap EU240 with EU210(for example).
The colour choice part is for other blocks and works fine, so just hit enter; to go with the set option.
I now need to add a function for a part labeled OUL050 through OUL240.
I have added in lines of code for OUL, in the same form as that for EU; but the routine does not swap the OUL.
The OUL.dwg are in the same folder as those of the EU, so if it is able to see that location to find EU; then it should find the OUL.
But i cant work out from the code, where it is set to look for the .dwg to insert.
Nor can i work out if there is section that needs to be told there is an extra item in the code.
Can anyone assist with this?
I have attched the lisp and the above described .dwg
0
Comments
-
Hi.... without testing, but doing a quick review of your code....
You are using a "#" wildcard to search for a number, but your prefix is "OUL" -> so the 3rd character is a letter, and so the (wcmatch n "OU#*") will return nil... You can either use (wcmatch n "OUL*") or (wcmatch n "OU*)
The "*" will search for any number of chartacters for any type... where "#" is a single numeric character...
So, (wcmatch rn "OU##*") will work if your are searching on "OU240" but not "OUL240"
Vince0 -
Thanks Vince, still working on it and its odd that all the other original options work with what should be wrong use of # and *; but not OU or OUL?
0