gjp
2007-09-21, 06:32 PM
I have (with help from others) come up with a few diesel expressions I use in my borders. Both expressions grab data from the dwgname to populate attributes within my border.
Typical drawing number
07028-18D-34-030-RA.dwg
The first grabs the first 16 characters (our drawing number) and places in the drawing number attribute.
$(substr,$(getvar,dwgname),1,16)
The second grabs only the 4th from the end character (our revision) and places in the drawing revision attribute.
$(substr, $(getvar, dwgname),$(-,$(strlen, $(getvar, dwgname)),4),1)
The third grabs only a portion out of the middle of the border (34) that we use for our area number.
$(substr,$(getvar,dwgname),11,2)
What I am having trouble with is finding a way (within diesel) to grab everything but the last 7 characters. In my example it would return the same value as my first example. However, sometimes our drawing number lengths differ and it would make sense to work from the end of the file to the front because the "-RA.dwg" will always be constant.
Any help is appreicated and I hope the 3 expressions I've listed are useful to other users.
..g
elea.lsp
Typical drawing number
07028-18D-34-030-RA.dwg
The first grabs the first 16 characters (our drawing number) and places in the drawing number attribute.
$(substr,$(getvar,dwgname),1,16)
The second grabs only the 4th from the end character (our revision) and places in the drawing revision attribute.
$(substr, $(getvar, dwgname),$(-,$(strlen, $(getvar, dwgname)),4),1)
The third grabs only a portion out of the middle of the border (34) that we use for our area number.
$(substr,$(getvar,dwgname),11,2)
What I am having trouble with is finding a way (within diesel) to grab everything but the last 7 characters. In my example it would return the same value as my first example. However, sometimes our drawing number lengths differ and it would make sense to work from the end of the file to the front because the "-RA.dwg" will always be constant.
Any help is appreicated and I hope the 3 expressions I've listed are useful to other users.
..g
elea.lsp