- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to use the IF function to display part of a drawing name, where the filename name varies in length due to the length of project numbers and other addtional parts of buildings and floors.
For example
12345-A1-A.dwg
12345-001-A1-A.dwg
12345-001-U1-A1-A.dwg
The red parts of the above filenames are the project number.
I found an IF statement in another forum which I adapted btu I'm getting unexpected results which appear to be due to the letters in the filename names, for example the "U" in the above exmaples.
$(if,$(substr,$(getvar,dwgname),6,3),"-00",$(substr,$(getvar,dwgname),1,9),$(substr,$(getvar,dwgname),1,5))
This expression is in the Field adjacent to "PC PPROJECT NO." In the example below it should be displaying 12345-001, ie the first 9 characters of the "DRAWING No."
If I change the filename so that the project number is the shorter of our options 12345 I get this:
If I use the longer of our Project No. options and instead of a Unit/Building number (the U1 or BB) I have a site code (eg 11) I get this, which is correct.
To me it seems that the letters are causing the IF statement to trip up. I was under the impression that it did not matter what the character was for an IF statement to work. I must be wrong.
Any help would be appreciated.
AutoCAD 2021
Solved! Go to Solution.