PDA

View Full Version : Manipulating dwgname variable in diesel field expression



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

zoomharis
2007-09-22, 10:21 AM
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.


Use this expression


$(substr,$(getvar,DWGNAME),1,$(-,$(strlen,$(getvar,DWGNAME)),7))

kheajohn
2008-10-28, 11:49 AM
this is really great!

$(substr,$(getvar,DWGNAME),1,$(-,$(strlen,$(getvar,DWGNAME)),7))

how about making this expression with results upper case?

tedg
2008-10-28, 12:01 PM
this is really great!

$(substr,$(getvar,DWGNAME),1,$(-,$(strlen,$(getvar,DWGNAME)),7))

how about making this expression with results upper case?
Try this:
$(UPPER,$(SUBSTR,$(getvar,DWGNAME),1,$(-,$(strlen,$(getvar,DWGNAME)),7))
I stole from this thread (http://forums.augi.com/showthread.php?t=23263)

kheajohn
2008-11-03, 12:02 PM
Try this:
$(UPPER,$(SUBSTR,$(getvar,DWGNAME),1,$(-,$(strlen,$(getvar,DWGNAME)),7))
I stole from this thread
__________________
Ted
Those who master others have Force.
Those who master themselves have Strength.

i tried this before and does'nt work. Thanks.....anyone?

Tom Beauford
2014-08-06, 09:33 PM
Try this:
$(UPPER,$(SUBSTR,$(getvar,DWGNAME),1,$(-,$(strlen,$(getvar,DWGNAME)),7))
I stole from this thread (http://forums.augi.com/showthread.php?t=23263)

Appears to be missing a closing parentheses at the end.